Reading image files

Mike Parker via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Nov 25 19:56:58 PST 2016


On Friday, 25 November 2016 at 20:10:56 UTC, solidstate1991 wrote:
> 
> glitchy image after rendering the result) and I have no idea 
> how DerelictFI works at all,

DerelictFI is just a binding to FreeImage, so the more relevant 
point to consider is how FreeImage works :-) Everything you need 
to know can be found at [1]. Download the FreeImage DLL for 
Windows, or install it via your package manager on other systems. 
Then add DerelictFI as a dependency to your dub configuration [2] 
(I suggest version "~>2.0.3" -- don't use the alpha version), 
then you can do this:

import derelict.freeimage.freeimage;

void main() {
     DerelictFI.load();
}

This loads the FreeImage shared library into your process space 
if it's on your system path. (on Windows, you should make sure 
the DLL is in the same directory as your executable). From then 
on, you can call FreeImage functions as per the project's 
documentation.

[1] http://freeimage.sourceforge.net/
[2] https://code.dlang.org/packages/derelict-fi


More information about the Digitalmars-d-learn mailing list