Add freeimage source.

Change-Id: I6b83548e118853b41cfbac3c937d2b552e6453bb
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..c23ca65
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,33 @@
+/build
+/source/build
+*.mode1v3
+*.pbxuser
+*.pbxindex/
+!user.pbxuser
+/*.log
+*.user
+*.ncb
+*.suo
+*.pdb
+*.pdf
+*.html
+*.idb
+*.o
+*.lo
+*.a
+*.so
+*.so.0
+*.la
+.deps
+.libs
+*.pyc
+.DS_Store
+# Emacs and other editor backup files
+*~
+
+# builds on Windows
+Debug/
+Release/
+release/
+
+/Dist/FreeImage.h
\ No newline at end of file
diff --git a/Dist/delete.me b/Dist/delete.me
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Dist/delete.me
diff --git a/Examples/Generic/BatchLoad.cpp b/Examples/Generic/BatchLoad.cpp
new file mode 100644
index 0000000..1612050
--- /dev/null
+++ b/Examples/Generic/BatchLoad.cpp
@@ -0,0 +1,214 @@
+// ==========================================================
+// Batch loader
+//
+// Design and implementation by 
+// - Floris van den Berg
+// - Hervé Drolon
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at own risk!
+// ==========================================================
+
+//
+//  This example shows how to easily batch load a directory
+//  full of images. Because not all formats can be identified
+//  by their header (some images don't have a header or one
+//  at the end of the file) we make use of the
+//  FreeImage_GetFIFFromFilename function. This function
+//  receives a file name, for example 'myfile.bmp', and returns
+//  a FREE_IMAGE_TYPE enum which identifies that bitmap.
+//
+//  Functions used in this sample : 
+//  FreeImage_GetFileType, FreeImage_GetFIFFromFilename, FreeImage_FIFSupportsReading, 
+//  FreeImage_Load, FreeImage_GetBPP, FreeImage_FIFSupportsWriting, FreeImage_GetFormatFromFIF
+//  FreeImage_FIFSupportsExportBPP, FreeImage_Save, FreeImage_Unload,
+//  FreeImage_SetOutputMessage, FreeImage_GetVersion, FreeImage_GetCopyrightMessage
+//
+// ==========================================================
+
+#include <assert.h>
+#include <stdio.h>
+#include <io.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "FreeImage.h"
+
+// ----------------------------------------------------------
+
+/** Generic image loader
+	@param lpszPathName Pointer to the full file name
+	@param flag Optional load flag constant
+	@return Returns the loaded dib if successful, returns NULL otherwise
+*/
+FIBITMAP* GenericLoader(const char* lpszPathName, int flag) {
+	FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;
+
+	// check the file signature and deduce its format
+	// (the second argument is currently not used by FreeImage)
+	fif = FreeImage_GetFileType(lpszPathName, 0);
+	if(fif == FIF_UNKNOWN) {
+		// no signature ?
+		// try to guess the file format from the file extension
+		fif = FreeImage_GetFIFFromFilename(lpszPathName);
+	}
+	// check that the plugin has reading capabilities ...
+	if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) {
+		// ok, let's load the file
+		FIBITMAP *dib = FreeImage_Load(fif, lpszPathName, flag);
+		// unless a bad file format, we are done !
+		return dib;
+	}
+	return NULL;
+}
+
+/** Generic image writer
+	@param dib Pointer to the dib to be saved
+	@param lpszPathName Pointer to the full file name
+	@param flag Optional save flag constant
+	@return Returns true if successful, returns false otherwise
+*/
+bool GenericWriter(FIBITMAP* dib, const char* lpszPathName, int flag) {
+	FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;
+	BOOL bSuccess = FALSE;
+
+	if(dib) {
+		// try to guess the file format from the file extension
+		fif = FreeImage_GetFIFFromFilename(lpszPathName);
+		if(fif != FIF_UNKNOWN ) {
+			// check that the plugin has sufficient writing and export capabilities ...
+			WORD bpp = FreeImage_GetBPP(dib);
+			if(FreeImage_FIFSupportsWriting(fif) && FreeImage_FIFSupportsExportBPP(fif, bpp)) {
+				// ok, we can save the file
+				bSuccess = FreeImage_Save(fif, dib, lpszPathName, flag);
+				// unless an abnormal bug, we are done !
+			}
+		}
+	}
+	return (bSuccess == TRUE) ? true : false;
+}
+
+// ----------------------------------------------------------
+
+/**
+	FreeImage error handler
+	@param fif Format / Plugin responsible for the error 
+	@param message Error message
+*/
+void FreeImageErrorHandler(FREE_IMAGE_FORMAT fif, const char *message) {
+	printf("\n*** "); 
+	if(fif != FIF_UNKNOWN) {
+		printf("%s Format\n", FreeImage_GetFormatFromFIF(fif));
+	}
+	printf(message);
+	printf(" ***\n");
+}
+
+// ----------------------------------------------------------
+
+#ifndef MAX_PATH
+#define MAX_PATH	260
+#endif
+
+int 
+main(int argc, char *argv[]) {
+
+	const char *input_dir = "d:\\images\\";
+	FIBITMAP *dib = NULL;
+	int id = 1;
+
+	// call this ONLY when linking with FreeImage as a static library
+#ifdef FREEIMAGE_LIB
+	FreeImage_Initialise();
+#endif // FREEIMAGE_LIB
+
+	// initialize your own FreeImage error handler
+
+	FreeImage_SetOutputMessage(FreeImageErrorHandler);
+
+	// print version & copyright infos
+
+	printf(FreeImage_GetVersion());
+	printf("\n");
+	printf(FreeImage_GetCopyrightMessage());
+	printf("\n");
+
+	// open the log file
+
+	FILE *log_file = fopen("log_file.txt", "w");
+
+	// batch convert all supported bitmaps
+
+	_finddata_t finddata;
+	long handle;
+	char image_path[MAX_PATH];
+
+	// scan all files
+	strcpy(image_path, input_dir);
+	strcat(image_path, "*.*");
+
+	if ((handle = _findfirst(image_path, &finddata)) != -1) {
+		do {
+			// make a path to a directory
+
+			char *directory = new char[MAX_PATH];
+			strcpy(directory, input_dir);
+			strcat(directory, finddata.name);
+
+			// make a unique filename
+
+			char *unique = new char[128];
+			itoa(id, unique, 10);
+			strcat(unique, ".png");
+
+			// open and load the file using the default load option
+			dib = GenericLoader(directory, 0);
+
+			if (dib != NULL) {
+				// save the file as PNG
+				bool bSuccess = GenericWriter(dib, unique, PNG_DEFAULT);
+
+				// free the dib
+				FreeImage_Unload(dib);
+
+				if(bSuccess) {
+					fwrite(unique, strlen(unique), 1, log_file);
+				} else {
+					strcpy(unique, "FAILED");
+					fwrite(unique, strlen(unique), 1, log_file);
+				}
+				fwrite(" >> ", 4, 1, log_file);
+				fwrite(directory, strlen(directory), 1, log_file);
+				fwrite("\n", 1, 1, log_file);
+
+				id++;
+			}
+
+			delete [] unique;
+			delete [] directory;
+
+		} while (_findnext(handle, &finddata) == 0);
+
+		_findclose(handle);
+	}
+
+	fclose(log_file);
+
+	// call this ONLY when linking with FreeImage as a static library
+#ifdef FREEIMAGE_LIB
+	FreeImage_DeInitialise();
+#endif // FREEIMAGE_LIB
+
+	return 0;
+}
diff --git a/Examples/Generic/CloneMultiPage.cpp b/Examples/Generic/CloneMultiPage.cpp
new file mode 100644
index 0000000..2124998
--- /dev/null
+++ b/Examples/Generic/CloneMultiPage.cpp
@@ -0,0 +1,112 @@
+// ==========================================================
+// Multipage functions demonstration
+//
+// Design and implementation by 
+// - Hervé Drolon
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at own risk!
+// ==========================================================
+
+// This sample shows how to clone a multipage TIFF
+//
+// Functions used in this sample : 
+// FreeImage_OpenMultiBitmap, FreeImage_GetPageCount, FreeImage_LockPage, 
+// FreeImage_AppendPage, FreeImage_UnlockPage, FreeImage_CloseMultiBitmap; 
+// FreeImage_SetOutputMessage
+//
+// ==========================================================
+
+#include <iostream.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "FreeImage.h"
+
+// ----------------------------------------------------------
+
+/**
+	FreeImage error handler
+*/
+void MyMessageFunc(FREE_IMAGE_FORMAT fif, const char *message) {
+	cout << "\n*** " << message << " ***\n";
+	cout.flush();
+}
+
+// ----------------------------------------------------------
+
+bool CloneMultiPage(FREE_IMAGE_FORMAT fif, char *input, char *output, int output_flag) {
+
+	BOOL bMemoryCache = TRUE;
+
+	// Open src file (read-only, use memory cache)
+	FIMULTIBITMAP *src = FreeImage_OpenMultiBitmap(fif, input, FALSE, TRUE, bMemoryCache);
+
+	if(src) {
+		// Open dst file (creation, use memory cache)
+		FIMULTIBITMAP *dst = FreeImage_OpenMultiBitmap(fif, output, TRUE, FALSE, bMemoryCache);
+
+		// Get src page count
+		int count = FreeImage_GetPageCount(src);
+
+		// Clone src to dst
+		for(int page = 0; page < count; page++) {
+			// Load the bitmap at position 'page'
+			FIBITMAP *dib = FreeImage_LockPage(src, page);
+			if(dib) {
+				// add a new bitmap to dst
+				FreeImage_AppendPage(dst, dib);
+				// Unload the bitmap (do not apply any change to src)
+				FreeImage_UnlockPage(src, dib, FALSE);
+			}
+		}
+
+		// Close src
+		FreeImage_CloseMultiBitmap(src, 0);
+		// Save and close dst
+		FreeImage_CloseMultiBitmap(dst, output_flag);
+
+		return true;
+	}
+
+	return false;
+}
+
+
+int 
+main(int argc, char *argv[]) {
+
+	char *input_filename = "images\\input.tif";
+	char *output_filename = "images\\clone.tif";
+
+	// call this ONLY when linking with FreeImage as a static library
+#ifdef FREEIMAGE_LIB
+	FreeImage_Initialise();
+#endif // FREEIMAGE_LIB
+
+	// initialize our own FreeImage error handler
+
+	FreeImage_SetOutputMessage(MyMessageFunc);
+
+	// Copy 'input.tif' to 'clone.tif'
+
+	CloneMultiPage(FIF_TIFF, input_filename, output_filename, 0);
+
+	// call this ONLY when linking with FreeImage as a static library
+#ifdef FREEIMAGE_LIB
+	FreeImage_DeInitialise();
+#endif // FREEIMAGE_LIB
+
+	return 0;
+}
diff --git a/Examples/Generic/CreateAlpha.cpp b/Examples/Generic/CreateAlpha.cpp
new file mode 100644
index 0000000..77bb2a2
--- /dev/null
+++ b/Examples/Generic/CreateAlpha.cpp
@@ -0,0 +1,181 @@
+// ==========================================================
+// Alpha channel manipulation example
+//
+// Design and implementation by 
+// - Hervé Drolon
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at own risk!
+// ==========================================================
+
+//   This example shows how to create a transparent image from any input image
+//   using the greyscale version of the input image as the alpha channel mask.
+//   The alpha channel is set using the FreeImage_SetChannel function.
+// 
+//
+// ==========================================================
+
+#include <stdio.h>
+#include "FreeImage.h"
+
+// ----------------------------------------------------------
+
+/** Generic image loader
+	@param lpszPathName Pointer to the full file name
+	@param flag Optional load flag constant
+	@return Returns the loaded dib if successful, returns NULL otherwise
+*/
+FIBITMAP* GenericLoader(const char* lpszPathName, int flag) {
+	FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;
+
+	// check the file signature and deduce its format
+	// (the second argument is currently not used by FreeImage)
+	fif = FreeImage_GetFileType(lpszPathName, 0);
+	if(fif == FIF_UNKNOWN) {
+		// no signature ?
+		// try to guess the file format from the file extension
+		fif = FreeImage_GetFIFFromFilename(lpszPathName);
+	}
+	// check that the plugin has reading capabilities ...
+	if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) {
+		// ok, let's load the file
+		FIBITMAP *dib = FreeImage_Load(fif, lpszPathName, flag);
+		// unless a bad file format, we are done !
+		return dib;
+	}
+	return NULL;
+}
+
+/** Generic image writer
+	@param dib Pointer to the dib to be saved
+	@param lpszPathName Pointer to the full file name
+	@param flag Optional save flag constant
+	@return Returns true if successful, returns false otherwise
+*/
+bool GenericWriter(FIBITMAP* dib, const char* lpszPathName, int flag) {
+	FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;
+	BOOL bSuccess = FALSE;
+
+	if(dib) {
+		// try to guess the file format from the file extension
+		fif = FreeImage_GetFIFFromFilename(lpszPathName);
+		if(fif != FIF_UNKNOWN ) {
+			// check that the plugin has sufficient writing and export capabilities ...
+			WORD bpp = FreeImage_GetBPP(dib);
+			if(FreeImage_FIFSupportsWriting(fif) && FreeImage_FIFSupportsExportBPP(fif, bpp)) {
+				// ok, we can save the file
+				bSuccess = FreeImage_Save(fif, dib, lpszPathName, flag);
+				// unless an abnormal bug, we are done !
+			}
+		}
+	}
+	return (bSuccess == TRUE) ? true : false;
+}
+
+// ----------------------------------------------------------
+
+/**
+	FreeImage error handler
+	@param fif Format / Plugin responsible for the error 
+	@param message Error message
+*/
+void FreeImageErrorHandler(FREE_IMAGE_FORMAT fif, const char *message) {
+	printf("\n*** "); 
+	if(fif != FIF_UNKNOWN) {
+		printf("%s Format\n", FreeImage_GetFormatFromFIF(fif));
+	}
+	printf(message);
+	printf(" ***\n");
+}
+
+// ----------------------------------------------------------
+
+
+/**
+ Creates a 32-bit transparent image using the black channel of the source image
+ @param src Source image
+ @return Returns a 32-bit transparent image
+*/
+FIBITMAP* CreateAlphaFromLightness(FIBITMAP *src) {
+	// create a 32-bit image from the source
+	FIBITMAP *dst = FreeImage_ConvertTo32Bits(src);
+
+	// create a 8-bit mask
+	FreeImage_Invert(src);
+	FIBITMAP *mask = FreeImage_ConvertTo8Bits(src);
+	FreeImage_Invert(src);
+
+	// insert the mask as an alpha channel
+	FreeImage_SetChannel(dst, mask, FICC_ALPHA);
+
+	// free the mask and return
+	FreeImage_Unload(mask);
+
+	return dst;
+}
+
+int 
+main(int argc, char *argv[]) {
+	
+	// call this ONLY when linking with FreeImage as a static library
+#ifdef FREEIMAGE_LIB
+	FreeImage_Initialise();
+#endif // FREEIMAGE_LIB
+
+	// initialize your own FreeImage error handler
+
+	FreeImage_SetOutputMessage(FreeImageErrorHandler);
+
+	// print version & copyright infos
+
+	printf("FreeImage version : %s", FreeImage_GetVersion());
+	printf("\n");
+	printf(FreeImage_GetCopyrightMessage());
+	printf("\n");
+
+
+	if(argc != 3) {
+		printf("Usage : CreateAlpha <input file name> <output file name>\n");
+		return 0;
+	}
+
+	// Load the source image
+	FIBITMAP *src = GenericLoader(argv[1], 0);
+	if(src) {
+		// Create a transparent image from the lightness image of src
+		FIBITMAP *dst = CreateAlphaFromLightness(src);
+
+		if(dst) {
+			// Save the destination image
+			bool bSuccess = GenericWriter(dst, argv[2], 0);
+			if(!bSuccess) {
+				printf("\nUnable to save %s file", argv[2]);
+				printf("\nThis format does not support 32-bit images");
+			}
+
+			// Free dst
+			FreeImage_Unload(dst);
+		}
+
+		// Free src
+		FreeImage_Unload(src);
+	}
+
+	// call this ONLY when linking with FreeImage as a static library
+#ifdef FREEIMAGE_LIB
+	FreeImage_DeInitialise();
+#endif // FREEIMAGE_LIB
+
+	return 0;
+}
diff --git a/Examples/Generic/FIFImportExport.cpp b/Examples/Generic/FIFImportExport.cpp
new file mode 100644
index 0000000..ec791b2
--- /dev/null
+++ b/Examples/Generic/FIFImportExport.cpp
@@ -0,0 +1,149 @@
+// ==========================================================
+// Plugin functions demonstration
+//
+// Design and implementation by 
+// - Hervé Drolon
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at own risk!
+// ==========================================================
+
+// This example shows how to use Plugin functions to explore FreeImage capabilities. 
+// Whenever an external plugin is added to the library, it is automatically loaded 
+// with FreeImage and can be asked for its capabilities via the plugin functions.
+// 
+// Functions used in this sample : 
+// FreeImage_FIFSupportsExportBPP, FreeImage_FIFSupportsICCProfiles, FreeImage_FIFSupportsReading, 
+// FreeImage_FIFSupportsWriting, FreeImage_GetFIFCount, FreeImage_GetFIFDescription, 
+// FreeImage_GetFIFExtensionList, FreeImage_GetFormatFromFIF, 
+// FreeImage_GetVersion, FreeImage_GetCopyrightMessage, FreeImage_SetOutputMessage
+//
+// ==========================================================
+
+#include <iostream.h>
+#include <fstream.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "FreeImage.h"
+
+// ----------------------------------------------------------
+
+/**
+	FreeImage error handler
+*/
+void MyMessageFunc(FREE_IMAGE_FORMAT fif, const char *message) {
+	cout << "\n*** " << message << " ***\n";
+}
+
+// ----------------------------------------------------------
+
+/**
+	Print plugins import capabilities
+*/
+void PrintImportFormats(iostream& ios) {
+	int count = FreeImage_GetFIFCount();
+	if(count)
+		ios << "FORMAT;DESCRIPTION;EXTENSIONS;ICC PROFILES\n";
+	for(int i = 0; i < count; i++) {
+		FREE_IMAGE_FORMAT fif = (FREE_IMAGE_FORMAT)i;
+
+		if(FreeImage_FIFSupportsReading(fif)) {
+			const char * format = FreeImage_GetFormatFromFIF(fif);
+			const char * description = FreeImage_GetFIFDescription(fif);
+			const char * ext = FreeImage_GetFIFExtensionList(fif);
+			const char * icc = "*";
+			if(FreeImage_FIFSupportsICCProfiles(fif)) {
+				ios << format << ";" << description << ";" << ext << ";" << icc << "\n";
+			} else {
+				ios << format << ";" << description << ";" << ext << "; \n";
+			}
+		}
+	}
+}
+
+/**
+	Print plugins export capabilities
+*/
+void PrintExportFormats(iostream& ios) {
+	int count = FreeImage_GetFIFCount();
+	if(count)
+		ios << "FORMAT;DESCRIPTION;EXTENSIONS;BITDEPTH;ICC PROFILES\n";
+	for(int i = 0; i < count; i++) {
+		FREE_IMAGE_FORMAT fif = (FREE_IMAGE_FORMAT)i;
+
+		if(FreeImage_FIFSupportsWriting(fif)) {
+			const char * format = FreeImage_GetFormatFromFIF(fif);
+			const char * description = FreeImage_GetFIFDescription(fif);
+			const char * ext = FreeImage_GetFIFExtensionList(fif);
+			const char * icc = "*";
+
+			ios << format << ";" << description << ";" << ext << ";";
+			if(FreeImage_FIFSupportsExportBPP(fif, 1))
+				ios << "1 ";
+			if(FreeImage_FIFSupportsExportBPP(fif, 4))
+				ios << "4 ";
+			if(FreeImage_FIFSupportsExportBPP(fif, 8))
+				ios << "8 ";
+			if(FreeImage_FIFSupportsExportBPP(fif, 16))
+				ios << "16 ";
+			if(FreeImage_FIFSupportsExportBPP(fif, 24))
+				ios << "24 ";
+			if(FreeImage_FIFSupportsExportBPP(fif, 32))
+				ios << "32 ";
+			if(FreeImage_FIFSupportsICCProfiles(fif)) {
+				ios << ";" << icc;
+			} else {
+				ios << "; ";
+			}
+			ios << "\n";
+		}
+	}
+}
+
+int 
+main(int argc, char *argv[]) {
+	// call this ONLY when linking with FreeImage as a static library
+#ifdef FREEIMAGE_LIB
+	FreeImage_Initialise();
+#endif // FREEIMAGE_LIB
+
+	// initialize FreeImage error handler
+
+	FreeImage_SetOutputMessage(MyMessageFunc);
+
+	// print version & copyright infos
+
+	cout << "FreeImage " << FreeImage_GetVersion() << "\n";
+	cout << FreeImage_GetCopyrightMessage() << "\n\n";
+
+	// Print input formats (including external plugins) known by the library
+	fstream importFile("fif_import.csv", ios::out);
+	PrintImportFormats(importFile);
+	importFile.close();
+
+	// Print output formats (including plugins) known by the library
+	// for each export format, supported bitdepths are given
+	fstream exportFile("fif_export.csv", ios::out);
+	PrintExportFormats(exportFile);
+	exportFile.close();
+
+	// call this ONLY when linking with FreeImage as a static library
+#ifdef FREEIMAGE_LIB
+	FreeImage_DeInitialise();
+#endif // FREEIMAGE_LIB
+
+	return 0;
+
+}
diff --git a/Examples/Generic/FIIO_Mem.cpp b/Examples/Generic/FIIO_Mem.cpp
new file mode 100644
index 0000000..703acb1
--- /dev/null
+++ b/Examples/Generic/FIIO_Mem.cpp
@@ -0,0 +1,146 @@
+/*--------------------------------------------------------------------------*\
+|| fiio_mem.cpp by Ryan Rubley <ryan@lostreality.org>                       ||
+||                                                                          ||
+|| (v1.02) 4-28-2004                                                        ||
+|| FreeImageIO to memory                                                    ||
+||                                                                          ||
+\*--------------------------------------------------------------------------*/
+
+#include <string.h>
+#include <stdlib.h>
+#include "fiio_mem.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+FIBITMAP *
+FreeImage_LoadFromMem(FREE_IMAGE_FORMAT fif, fiio_mem_handle *handle, int flags) {
+	FreeImageIO io;
+	SetMemIO(&io);
+	
+	if (handle && handle->data) {
+		handle->curpos = 0;
+		return FreeImage_LoadFromHandle(fif, &io, (fi_handle)handle, flags);
+	}
+
+	return NULL;
+}
+
+BOOL
+FreeImage_SaveToMem(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, fiio_mem_handle *handle, int flags) {
+	FreeImageIO io;
+	SetMemIO(&io);
+
+	if (handle) {
+		handle->filelen = 0;
+		handle->curpos = 0;
+		return FreeImage_SaveToHandle(fif, dib, &io, (fi_handle)handle, flags);
+	}
+
+	return FALSE;
+}
+
+// ----------------------------------------------------------
+
+void
+SetMemIO(FreeImageIO *io) {
+	io->read_proc  = fiio_mem_ReadProc;
+	io->seek_proc  = fiio_mem_SeekProc;
+	io->tell_proc  = fiio_mem_TellProc;
+	io->write_proc = fiio_mem_WriteProc;
+}
+
+// ----------------------------------------------------------
+
+#define FIIOMEM(member) (((fiio_mem_handle *)handle)->member)
+
+unsigned
+fiio_mem_ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle) {
+	unsigned x;
+	for( x=0; x<count; x++ ) {
+		//if there isnt size bytes left to read, set pos to eof and return a short count
+		if( FIIOMEM(filelen)-FIIOMEM(curpos) < (long)size ) {
+			FIIOMEM(curpos) = FIIOMEM(filelen);
+			break;
+		}
+		//copy size bytes count times
+		memcpy( buffer, (char *)FIIOMEM(data) + FIIOMEM(curpos), size );
+		FIIOMEM(curpos) += size;
+		buffer = (char *)buffer + size;
+	}
+	return x;
+}
+
+unsigned
+fiio_mem_WriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle) {
+	void *newdata;
+	long newdatalen;
+	//double the data block size if we need to
+	while( FIIOMEM(curpos)+(long)(size*count) >= FIIOMEM(datalen) ) {
+		//if we are at or above 1G, we cant double without going negative
+		if( FIIOMEM(datalen) & 0x40000000 ) {
+			//max 2G
+			if( FIIOMEM(datalen) == 0x7FFFFFFF ) {
+				return 0;
+			}
+			newdatalen = 0x7FFFFFFF;
+		} else if( FIIOMEM(datalen) == 0 ) {
+			//default to 4K if nothing yet
+			newdatalen = 4096;
+		} else {
+			//double size
+			newdatalen = FIIOMEM(datalen) << 1;
+		}
+		newdata = realloc( FIIOMEM(data), newdatalen );
+		if( !newdata ) {
+			return 0;
+		}
+		FIIOMEM(data) = newdata;
+		FIIOMEM(datalen) = newdatalen;
+	}
+	memcpy( (char *)FIIOMEM(data) + FIIOMEM(curpos), buffer, size*count );
+	FIIOMEM(curpos) += size*count;
+	if( FIIOMEM(curpos) > FIIOMEM(filelen) ) {
+		FIIOMEM(filelen) = FIIOMEM(curpos);
+	}
+	return count;
+}
+
+int
+fiio_mem_SeekProc(fi_handle handle, long offset, int origin) {
+	switch(origin) { //0 to filelen-1 are 'inside' the file
+	default:
+	case SEEK_SET: //can fseek() to 0-7FFFFFFF always
+		if( offset >= 0 ) {
+			FIIOMEM(curpos) = offset;
+			return 0;
+		}
+		break;
+
+	case SEEK_CUR:
+		if( FIIOMEM(curpos)+offset >= 0 ) {
+			FIIOMEM(curpos) += offset;
+			return 0;
+		}
+		break;
+
+	case SEEK_END:
+		if( FIIOMEM(filelen)+offset >= 0 ) {
+			FIIOMEM(curpos) = FIIOMEM(filelen)+offset;
+			return 0;
+		}
+		break;
+	}
+
+	return -1;
+}
+
+long
+fiio_mem_TellProc(fi_handle handle) {
+	return FIIOMEM(curpos);
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/Examples/Generic/FIIO_Mem.h b/Examples/Generic/FIIO_Mem.h
new file mode 100644
index 0000000..e686b1c
--- /dev/null
+++ b/Examples/Generic/FIIO_Mem.h
@@ -0,0 +1,74 @@
+/*--------------------------------------------------------------------------*\
+|| fiio_mem.h by Ryan Rubley <ryan@lostreality.org>                         ||
+||                                                                          ||
+|| (v1.02) 4-28-2004                                                        ||
+|| FreeImageIO to memory                                                    ||
+||                                                                          ||
+\*--------------------------------------------------------------------------*/
+
+#ifndef _FIIO_MEM_H_
+#define _FIIO_MEM_H_
+
+#include "freeimage.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct fiio_mem_handle_s {
+	long filelen,datalen,curpos;
+	void *data;
+} fiio_mem_handle;
+
+/* it is up to the user to create a fiio_mem_handle and init datalen and data
+ * filelen will be pre-set to 0 by SaveToMem
+ * curpos will be pre-set to 0 by SaveToMem and LoadFromMem
+ * IMPORTANT: data should be set to NULL and datalen to 0,
+ *            unless the user wants to manually malloc a larger buffer
+ */
+FIBITMAP *FreeImage_LoadFromMem(FREE_IMAGE_FORMAT fif, fiio_mem_handle *handle, int flags);
+BOOL FreeImage_SaveToMem(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, fiio_mem_handle *handle, int flags);
+
+void SetMemIO(FreeImageIO *io);
+unsigned fiio_mem_ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle);
+unsigned fiio_mem_WriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle);
+int fiio_mem_SeekProc(fi_handle handle, long offset, int origin);
+long fiio_mem_TellProc(fi_handle handle);
+
+/*** Example Usage ***
+
+//variables
+FIBITMAP *bitmap, *bitmap2;
+fiio_mem_handle fmh;
+
+//important initialization
+fmh.data = NULL;
+fmh.datalen = 0;
+
+//load a regular file
+bitmap = FreeImage_Load(FIF_PNG, "sample.png");
+
+//save the file to memory
+FreeImage_SaveToMem(FIF_PNG, bitmap, &fmh, 0);
+
+//at this point, fmh.data contains the entire PNG data in memory
+//fmh.datalen is the amount of space malloc'd for the image in memory,
+//but only fmh.filelen amount of that space is actually used.
+
+//its easy load an image from memory as well
+bitmap2 = FreeImage_LoadFromMem(FIF_PNG, &fmh, 0);
+//you could also have image data in memory via some other method, and just set
+//fmh.data to point to it, and set both fmh.datalen and fmh.filelen to the
+//size of that data, then FreeImage_LoadFromMem could load the image from that
+//memory
+
+//make sure to free the data since SaveToMem will cause it to be malloc'd
+free(fmh.data);
+
+*/
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/Examples/Generic/LoadFromHandle.cpp b/Examples/Generic/LoadFromHandle.cpp
new file mode 100644
index 0000000..45afb46
--- /dev/null
+++ b/Examples/Generic/LoadFromHandle.cpp
@@ -0,0 +1,145 @@
+// ==========================================================
+// Load From Handle Example
+//
+// Design and implementation by 
+// - Hervé Drolon
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at own risk!
+// ==========================================================
+
+//   This example shows how to load a bitmap from a
+//   user allocated FILE pointer.
+// 
+// Functions used in this sample : 
+// FreeImage_GetFormatFromFIF, FreeImage_GetFileTypeFromHandle, FreeImage_LoadFromHandle, 
+// FreeImage_GetFIFFromFilename, FreeImage_Save, FreeImage_Unload
+// FreeImage_GetVersion, FreeImage_GetCopyrightMessage, FreeImage_SetOutputMessage
+//
+// ==========================================================
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "FreeImage.h"
+
+// ----------------------------------------------------------
+
+/**
+	FreeImage error handler
+	@param fif Format / Plugin responsible for the error 
+	@param message Error message
+*/
+void FreeImageErrorHandler(FREE_IMAGE_FORMAT fif, const char *message) {
+	printf("\n*** "); 
+	if(fif != FIF_UNKNOWN) {
+		printf("%s Format\n", FreeImage_GetFormatFromFIF(fif));
+	}
+	printf(message);
+	printf(" ***\n");
+}
+
+// ----------------------------------------------------------
+
+unsigned DLL_CALLCONV
+myReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle) {
+	return fread(buffer, size, count, (FILE *)handle);
+}
+
+unsigned DLL_CALLCONV
+myWriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle) {
+	return fwrite(buffer, size, count, (FILE *)handle);
+}
+
+int DLL_CALLCONV
+mySeekProc(fi_handle handle, long offset, int origin) {
+	return fseek((FILE *)handle, offset, origin);
+}
+
+long DLL_CALLCONV
+myTellProc(fi_handle handle) {
+	return ftell((FILE *)handle);
+}
+
+// ----------------------------------------------------------
+
+int 
+main(int argc, char *argv[]) {
+	
+	// call this ONLY when linking with FreeImage as a static library
+#ifdef FREEIMAGE_LIB
+	FreeImage_Initialise();
+#endif // FREEIMAGE_LIB
+
+	// initialize your own FreeImage error handler
+
+	FreeImage_SetOutputMessage(FreeImageErrorHandler);
+
+	// print version & copyright infos
+
+	printf(FreeImage_GetVersion());
+	printf("\n");
+	printf(FreeImage_GetCopyrightMessage());
+	printf("\n");
+
+
+	if(argc != 2) {
+		printf("Usage : LoadFromHandle <input file name>\n");
+		return 0;
+	}
+
+	// initialize your own IO functions
+
+	FreeImageIO io;
+
+	io.read_proc  = myReadProc;
+	io.write_proc = myWriteProc;
+	io.seek_proc  = mySeekProc;
+	io.tell_proc  = myTellProc;
+
+	FILE *file = fopen(argv[1], "rb");
+
+	if (file != NULL) {
+		// find the buffer format
+		FREE_IMAGE_FORMAT fif = FreeImage_GetFileTypeFromHandle(&io, (fi_handle)file, 0);
+
+		if(fif != FIF_UNKNOWN) {
+			// load from the file handle
+			FIBITMAP *dib = FreeImage_LoadFromHandle(fif, &io, (fi_handle)file, 0);
+
+			// save the bitmap as a PNG ...
+			const char *output_filename = "test.png";
+
+			// first, check the output format from the file name or file extension
+			FREE_IMAGE_FORMAT out_fif = FreeImage_GetFIFFromFilename(output_filename);
+
+			if(out_fif != FIF_UNKNOWN) {
+				// then save the file
+				FreeImage_Save(out_fif, dib, output_filename, 0);
+			}
+
+			// free the loaded FIBITMAP
+			FreeImage_Unload(dib);
+		}
+		fclose(file);
+	}
+
+	// call this ONLY when linking with FreeImage as a static library
+#ifdef FREEIMAGE_LIB
+	FreeImage_DeInitialise();
+#endif // FREEIMAGE_LIB
+
+	return 0;
+}
diff --git a/Examples/Generic/LoadFromMemory-classified.cpp b/Examples/Generic/LoadFromMemory-classified.cpp
new file mode 100644
index 0000000..5466f48
--- /dev/null
+++ b/Examples/Generic/LoadFromMemory-classified.cpp
@@ -0,0 +1,101 @@
+// ==========================================================
+// Classified FreeImageIO handler
+//
+// Design and implementation by
+// - schickb (schickb@hotmail.com)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+class MemIO : public FreeImageIO {
+public :
+    MemIO( BYTE *data ) : _start(data), _cp(data) {
+        read_proc  = _ReadProc;
+        write_proc = _WriteProc;
+        tell_proc  = _TellProc;
+        seek_proc  = _SeekProc;
+    }
+
+    void Reset() {
+		_cp = _start;
+	}
+
+    static unsigned _ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle);
+    static unsigned _WriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle);
+    static int _SeekProc(fi_handle handle, long offset, int origin);
+	static long _TellProc(fi_handle handle);
+
+private:
+    BYTE * const _start;
+    BYTE *_cp;
+};
+
+
+unsigned
+MemIO::_ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle) {
+    MemIO *memIO = (MemIO*)handle;
+    
+    BYTE *tmp = (BYTE *)buffer;
+
+    for (unsigned c = 0; c < count; c++) {
+        memcpy(tmp, memIO->_cp, size);
+
+        memIO->_cp = memIO->_cp + size;
+
+        tmp += size;
+    }
+
+    return count;
+}
+
+unsigned
+MemIO::_WriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle) {
+    ASSERT( false );
+    return size;
+}
+
+int
+MemIO::_SeekProc(fi_handle handle, long offset, int origin) {
+    ASSERT(origin != SEEK_END);
+
+    MemIO *memIO = (MemIO*)handle;
+
+    if (origin == SEEK_SET) 
+        memIO->_cp = memIO->_start + offset;
+    else
+        memIO->_cp = memIO->_cp + offset;
+
+    return 0;
+}
+
+long
+MemIO::_TellProc(fi_handle handle) {
+    MemIO *memIO = (MemIO*)handle;
+
+    return memIO->_cp - memIO->_start;
+}
+
+// ----------------------------------------------------------
+// PSEUDOCODE... HELPS TO UNDERSTAND HOW THE MEMIO CLASS WORKS
+// ----------------------------------------------------------
+
+int
+main(int argc, char *argv[]) {
+	BYTE *data = loadimagesomehow();
+
+	MemIO memIO(data);
+
+	FIBITMAP *fbmp = FreeImage_LoadFromHandle( fif, &memIO, (fi_handle)&memIO );
+}
\ No newline at end of file
diff --git a/Examples/Generic/LoadFromMemory.cpp b/Examples/Generic/LoadFromMemory.cpp
new file mode 100644
index 0000000..026ebff
--- /dev/null
+++ b/Examples/Generic/LoadFromMemory.cpp
@@ -0,0 +1,113 @@
+// ==========================================================
+// Load From Memory Example
+//
+// Design and implementation by Floris van den Berg
+//
+// This file is part of FreeImage 3
+//
+// Use at own risk!
+// ==========================================================
+//
+//  This example shows how to load a bitmap from memory
+//  rather than from a file. To do this we make use of the
+//  FreeImage_LoadFromHandle functions where we override
+//  the i/o functions to simulate FILE* access in memory.
+//
+//  For seeking purposes the fi_handle passed to the i/o
+//  functions contain the start of the data block where the
+//  bitmap is stored.
+//
+// ==========================================================
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "FreeImage.h"
+
+// ----------------------------------------------------------
+
+fi_handle g_load_address;
+
+// ----------------------------------------------------------
+
+inline unsigned _stdcall
+_ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle) {
+	BYTE *tmp = (BYTE *)buffer;
+
+	for (unsigned c = 0; c < count; c++) {
+		memcpy(tmp, g_load_address, size);
+
+		g_load_address = (BYTE *)g_load_address + size;
+
+		tmp += size;
+	}
+
+	return count;
+}
+
+inline unsigned _stdcall
+_WriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle) {
+	// there's not much use for saving the bitmap into memory now, is there?
+
+	return size;
+}
+
+inline int _stdcall
+_SeekProc(fi_handle handle, long offset, int origin) {
+	assert(origin != SEEK_END);
+
+	if (origin == SEEK_SET) {
+		g_load_address = (BYTE *)handle + offset;
+	} else {
+		g_load_address = (BYTE *)g_load_address + offset;
+	}
+
+	return 0;
+}
+
+inline long _stdcall
+_TellProc(fi_handle handle) {
+	assert((int)handle > (int)g_load_address);
+
+	return ((int)g_load_address - (int)handle);
+}
+
+// ----------------------------------------------------------
+
+int 
+main(int argc, char *argv[]) {
+	FreeImageIO io;
+
+	io.read_proc  = _ReadProc;
+	io.write_proc = _WriteProc;
+	io.tell_proc  = _TellProc;
+	io.seek_proc  = _SeekProc;
+
+	// allocate some memory for the bitmap
+
+	BYTE *test = new BYTE[159744];
+
+	if (test != NULL) {
+		// load the bitmap into memory. ofcourse you can do this any way you want
+
+		FILE *file = fopen("e:\\projects\\images\\money-256.tif", "rb");
+		fread(test, 159744, 1, file);
+		fclose(file);
+
+		// we store the load address of the bitmap for internal reasons
+
+		g_load_address = test;
+
+		// convert the bitmap
+		
+		FIBITMAP *dib = FreeImage_LoadFromHandle(FIF_TIFF, &io, (fi_handle)test);
+
+		// don't forget to free the dib !
+		FreeImage_Unload(dib);
+
+		delete [] test;
+	}
+
+	return 0;
+}
\ No newline at end of file
diff --git a/Examples/Generic/ShowMetadata.cpp b/Examples/Generic/ShowMetadata.cpp
new file mode 100644
index 0000000..95d8be1
--- /dev/null
+++ b/Examples/Generic/ShowMetadata.cpp
@@ -0,0 +1,317 @@
+// ==========================================================
+// Simple metadata reader
+//
+// Design and implementation by 
+// - Hervé Drolon
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at own risk!
+// ==========================================================
+
+//
+//  This example shows how to easily parse all metadata 
+//  contained in a JPEG, TIFF or PNG image. 
+//  Comments, Exif and IPTC/NAA metadata tags are written to a HTML file 
+//  for later reading, and Adobe XMP XML packets are written 
+//  in a file whose extension is '.xmp'. This file can be later 
+//  processed using a XML parser. 
+//
+//  Metadata functions showed in this sample : 
+//  FreeImage_GetMetadataCount, FreeImage_FindFirstMetadata, FreeImage_FindNextMetadata, 
+//  FreeImage_FindCloseMetadata, FreeImage_TagToString, FreeImage_GetMetadata
+//
+// ==========================================================
+
+#include <iostream>
+#include <sstream>
+#include <fstream>
+
+using namespace std;
+
+#include "FreeImage.h"
+
+// ----------------------------------------------------------
+
+/** Generic image loader
+	@param lpszPathName Pointer to the full file name
+	@param flag Optional load flag constant
+	@return Returns the loaded dib if successful, returns NULL otherwise
+*/
+FIBITMAP* GenericLoader(const char* lpszPathName, int flag) {
+	FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;
+
+	// check the file signature and deduce its format
+	// (the second argument is currently not used by FreeImage)
+	fif = FreeImage_GetFileType(lpszPathName, 0);
+	if(fif == FIF_UNKNOWN) {
+		// no signature ?
+		// try to guess the file format from the file extension
+		fif = FreeImage_GetFIFFromFilename(lpszPathName);
+	}
+	// check that the plugin has reading capabilities ...
+	if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) {
+		// ok, let's load the file
+		FIBITMAP *dib = FreeImage_Load(fif, lpszPathName, flag);
+		// unless a bad file format, we are done !
+		return dib;
+	}
+	return NULL;
+}
+
+/** Generic image writer
+	@param dib Pointer to the dib to be saved
+	@param lpszPathName Pointer to the full file name
+	@param flag Optional save flag constant
+	@return Returns true if successful, returns false otherwise
+*/
+bool GenericWriter(FIBITMAP* dib, const char* lpszPathName, int flag) {
+	FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;
+	BOOL bSuccess = FALSE;
+
+	if(dib) {
+		// try to guess the file format from the file extension
+		fif = FreeImage_GetFIFFromFilename(lpszPathName);
+		if(fif != FIF_UNKNOWN ) {
+			// check that the plugin has sufficient writing and export capabilities ...
+			WORD bpp = FreeImage_GetBPP(dib);
+			if(FreeImage_FIFSupportsWriting(fif) && FreeImage_FIFSupportsExportBPP(fif, bpp)) {
+				// ok, we can save the file
+				bSuccess = FreeImage_Save(fif, dib, lpszPathName, flag);
+				// unless an abnormal bug, we are done !
+			}
+		}
+	}
+	return (bSuccess == TRUE) ? true : false;
+}
+
+// ----------------------------------------------------------
+
+/**
+	FreeImage error handler
+	@param fif Format / Plugin responsible for the error 
+	@param message Error message
+*/
+void FreeImageErrorHandler(FREE_IMAGE_FORMAT fif, const char *message) {
+	cout << "\n*** ";
+	if(fif != FIF_UNKNOWN) {
+		cout << FreeImage_GetFormatFromFIF(fif) << " Format\n";
+	}
+	cout << message;
+	cout << " ***\n";
+}
+
+// ----------------------------------------------------------
+
+/**
+Print a basic HTML header
+*/
+void PrintHTMLHeader(iostream& ios) {
+	ios << "<HTML>\n<BODY>\n<CENTER>\n";
+	ios << "<FONT FACE = \"Arial\">\n";
+}
+
+/**
+Print a HTML footer
+*/
+void PrintHTMLFooter(iostream& ios) {
+	ios << "</CENTER>\n</FONT>\n</BODY>\n</HTML>\n";
+}
+
+/**
+Print a table header
+*/
+void PrintTableHeader(iostream& ios, const char *title) {
+	ios << "<TABLE BORDER=\"1\">\n";
+	ios << "<TR><TD ALIGN=CENTER COLSPAN=\"3\" BGCOLOR=\"#CCCCCC\"><B><font face=\"Arial\">" << title << "</font></B></TD></TR>\n";
+}
+
+/**
+Print a table section
+*/
+void PrintTableSection(iostream& ios, const char *title) {
+	ios << "<TR><TD ALIGN=CENTER COLSPAN=\"3\" BGCOLOR=\"#FFFFCC\"><B><font face=\"Arial\">" << title << "</font></B></TD></TR>\n";
+	ios << "<TR><TD><B>Tag name</B></TD><TD><B>Tag value</B></TD><TD><B>Description</B></TD></TR>";
+}
+
+/**
+Print a table footer
+*/
+void PrintTableFooter(iostream& ios) {
+	ios << "</TABLE>\n";
+}
+
+
+/**
+Print the metadata tags to a HTML file
+*/
+void PrintMetadata(iostream& ios, const char *sectionTitle, FIBITMAP *dib, FREE_IMAGE_MDMODEL model) {
+	FITAG *tag = NULL;
+	FIMETADATA *mdhandle = NULL;
+
+	mdhandle = FreeImage_FindFirstMetadata(model, dib, &tag);
+
+	if(mdhandle) {
+		// Print a table section
+		PrintTableSection(ios, sectionTitle);
+
+		do {
+			// convert the tag value to a string
+			const char *value = FreeImage_TagToString(model, tag);
+
+			// print the tag 
+			// note that most tags do not have a description, 
+			// especially when the metadata specifications are not available
+			if(FreeImage_GetTagDescription(tag)) {
+				ios << "<TR><TD>" << FreeImage_GetTagKey(tag) << "</TD><TD>" << value << "</TD><TD>" << FreeImage_GetTagDescription(tag) << "</TD></TR>\n";
+			} else {
+				ios << "<TR><TD>" << FreeImage_GetTagKey(tag) << "</TD><TD>" << value << "</TD><TD>" << "&nbsp;" << "</TD></TR>\n";
+			}
+
+		} while(FreeImage_FindNextMetadata(mdhandle, &tag));
+	}
+
+	FreeImage_FindCloseMetadata(mdhandle);
+}
+
+int 
+main(int argc, char *argv[]) {
+	unsigned count;
+
+	// call this ONLY when linking with FreeImage as a static library
+#ifdef FREEIMAGE_LIB
+	FreeImage_Initialise();
+#endif // FREEIMAGE_LIB
+
+	// initialize your own FreeImage error handler
+
+	FreeImage_SetOutputMessage(FreeImageErrorHandler);
+
+	// print version & copyright infos
+
+	cout << "FreeImage " << FreeImage_GetVersion() << "\n";
+	cout << FreeImage_GetCopyrightMessage() << "\n\n";
+
+	if(argc != 2) {
+		cout << "Usage : ShowMetadata <input file name>\n";
+		return 0;
+	}
+
+	// Load the bitmap
+
+	FIBITMAP *dib = GenericLoader(argv[1], 0);
+	if(!dib)
+		return 0;
+
+	// Create a HTML file
+	std::string html_file(strtok(argv[1], ".") + std::string(".html"));
+
+	fstream metadataFile(html_file.c_str(), ios::out);
+
+	// Print the header
+
+	PrintHTMLHeader(metadataFile);
+	PrintTableHeader(metadataFile, argv[1]);
+
+	// Parse and print metadata
+
+	if(count = FreeImage_GetMetadataCount(FIMD_COMMENTS, dib)) {
+		cout << "\nFIMD_COMMENTS (" << count << " data)\n-----------------------------------------\n";
+
+		PrintMetadata(metadataFile, "Comments", dib, FIMD_COMMENTS);
+	}	
+	if(count = FreeImage_GetMetadataCount(FIMD_EXIF_MAIN, dib)) {
+		cout << "\nFIMD_EXIF_MAIN (" << count << " data)\n-----------------------------------------\n";
+
+		PrintMetadata(metadataFile, "Exif - main info", dib, FIMD_EXIF_MAIN);
+	}
+	if(count = FreeImage_GetMetadataCount(FIMD_EXIF_EXIF, dib)) {
+		cout << "\nFIMD_EXIF_EXIF (" << count << " data)\n-----------------------------------------\n";
+
+		PrintMetadata(metadataFile, "Exif - advanced info", dib, FIMD_EXIF_EXIF);
+	}
+	if(count = FreeImage_GetMetadataCount(FIMD_EXIF_GPS, dib)) {
+		cout << "\nFIMD_EXIF_GPS (" << count << " data)\n-----------------------------------------\n";
+
+		PrintMetadata(metadataFile, "Exif GPS", dib, FIMD_EXIF_GPS);
+	}
+	if(count = FreeImage_GetMetadataCount(FIMD_EXIF_INTEROP, dib)) {
+		cout << "\nFIMD_EXIF_INTEROP (" << count << " data)\n-----------------------------------------\n";
+
+		PrintMetadata(metadataFile, "Exif interoperability", dib, FIMD_EXIF_INTEROP);
+	}
+	if(count = FreeImage_GetMetadataCount(FIMD_EXIF_MAKERNOTE, dib)) {
+		cout << "\nFIMD_EXIF_MAKERNOTE (" << count << " data)\n-----------------------------------------\n";
+
+		// Get the camera model
+		FITAG *tagMake = NULL;
+		FreeImage_GetMetadata(FIMD_EXIF_MAIN, dib, "Make", &tagMake);
+
+		std::string buffer((char*)FreeImage_GetTagValue(tagMake));
+		buffer += " Makernote";
+
+		PrintMetadata(metadataFile, buffer.c_str(), dib, FIMD_EXIF_MAKERNOTE);
+	}
+	if(count = FreeImage_GetMetadataCount(FIMD_IPTC, dib)) {
+		cout << "\nFIMD_IPTC (" << count << " data)\n-----------------------------------------\n";
+
+		PrintMetadata(metadataFile, "IPTC/NAA", dib, FIMD_IPTC);
+	}
+	if(count = FreeImage_GetMetadataCount(FIMD_GEOTIFF, dib)) {
+		cout << "\nFIMD_GEOTIFF (" << count << " data)\n-----------------------------------------\n";
+
+		PrintMetadata(metadataFile, "GEOTIFF", dib, FIMD_GEOTIFF);
+	}
+
+	// Print the footer
+
+	PrintTableFooter(metadataFile);
+	PrintHTMLFooter(metadataFile);
+
+	// close the HTML file
+
+	metadataFile.close();
+
+	// print XMP data
+
+	if(count = FreeImage_GetMetadataCount(FIMD_XMP, dib)) {
+		cout << "\nFIMD_XMP (" << count << " packet)\n-----------------------------------------\n";
+
+		std::string xmp_file(strtok(argv[1], ".") + std::string(".xmp"));
+		metadataFile.open(xmp_file.c_str(), ios::out);
+
+		FITAG *tag = NULL;
+		FreeImage_GetMetadata(FIMD_XMP, dib, "XMLPacket", &tag);
+		if(tag) {
+			metadataFile << (char*)FreeImage_GetTagValue(tag);
+		}
+
+		metadataFile.close();
+	}
+
+
+	// Unload the bitmap
+
+	FreeImage_Unload(dib);
+
+
+	// call this ONLY when linking with FreeImage as a static library
+#ifdef FREEIMAGE_LIB
+	FreeImage_DeInitialise();
+#endif // FREEIMAGE_LIB
+
+	return 0;
+}
+
+
+
diff --git a/Examples/Linux/Makefile b/Examples/Linux/Makefile
new file mode 100644
index 0000000..48f9b7a
--- /dev/null
+++ b/Examples/Linux/Makefile
@@ -0,0 +1,25 @@
+CC = gcc
+CPP = g++
+COMPILERFLAGS = -O3
+INCLUDE = -I../../Dist -I/usr/include/asm
+VGALIBRARIES = -lfreeimage -lvga
+GTKLIBRARIES = -lfreeimage -lgtk -lgdk
+GTKINCLUDE = -I/usr/lib/glib/include
+CFLAGS = $(COMPILERFLAGS) $(INCLUDE)
+
+
+
+all: default
+
+default: linux-svgalib linux-gtk
+
+linux-svgalib: linux-svgalib.c
+	$(CC) $(CFLAGS) $< -o $@ $(VGALIBRARIES)
+	strip $@
+
+linux-gtk: linux-gtk.c
+	$(CC) $(CFLAGS) $< -o $@ $(GTKLIBRARIES) $(GTKINCLUDE)
+	strip $@
+
+clean:
+	rm -f core linux-svgalib linux-gtk
diff --git a/Examples/Linux/linux-gtk.c b/Examples/Linux/linux-gtk.c
new file mode 100644
index 0000000..d7296ac
--- /dev/null
+++ b/Examples/Linux/linux-gtk.c
@@ -0,0 +1,97 @@
+#include <gtk/gtk.h>
+#include "FreeImage.h"
+
+void destroy(GtkWidget * widget, gpointer data) {
+	gtk_main_quit();
+}
+
+int main(int argc, char *argv[])
+{
+	GtkWidget *window, *imagebox;
+	GdkVisual *visual;
+	GdkImage *image;
+	FIBITMAP *dib;
+	int y;
+
+	// initialize the FreeImage library
+	FreeImage_Initialise();
+
+	dib = FreeImage_Load(FIF_PNG, "freeimage.png", PNG_DEFAULT);
+
+	gtk_init(&argc, &argv);
+
+	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+
+	gtk_signal_connect(GTK_OBJECT(window), "destroy",
+				GTK_SIGNAL_FUNC(destroy), NULL);
+
+	visual = gdk_visual_get_system();
+
+	image = gdk_image_new(GDK_IMAGE_NORMAL,visual,
+		FreeImage_GetWidth(dib),FreeImage_GetHeight(dib));
+
+	g_print("picture: %d bpp\n"
+		"system:  %d bpp   byteorder: %d\n"
+		"  redbits: %d   greenbits: %d   bluebits: %d\n"
+		"image:   %d bpp   %d bytes/pixel\n",
+		FreeImage_GetBPP(dib),
+		visual->depth,visual->byte_order,
+		visual->red_prec,visual->green_prec,visual->blue_prec,
+		image->depth,image->bpp );
+
+	if (FreeImage_GetBPP(dib) != (image->bpp << 3)) {
+		FIBITMAP *ptr;
+
+		switch (image->bpp) {
+			case 1:
+				ptr = FreeImage_ConvertTo8Bits(dib);
+				break;
+
+			case 2:
+				if (image->depth == 15) {
+					ptr = FreeImage_ConvertTo16Bits555(dib);
+				} else {
+					ptr = FreeImage_ConvertTo16Bits565(dib);
+				}
+
+				break;
+			case 3:
+				ptr = FreeImage_ConvertTo24Bits(dib);
+				break;
+
+			default:
+			case 4:
+				ptr = FreeImage_ConvertTo32Bits(dib);
+				break;
+		}
+
+		FreeImage_Unload(dib);
+		dib = ptr;
+	}
+
+//makes it upside down :(
+//	memcpy(image->mem, FreeImage_GetBits(dib), image->bpl * image->height);
+
+	BYTE *ptr = FreeImage_GetBits(dib);
+
+	for (y = 0; y < image->height; y++) {
+		memcpy(image->mem + (y * image->bpl),
+			ptr + ((image->height - y - 1) * image->bpl),
+			image->bpl);
+	}
+
+	FreeImage_Unload(dib);
+
+	imagebox = gtk_image_new(image, NULL);
+	gtk_container_add(GTK_CONTAINER(window), imagebox);
+
+	gtk_widget_show(imagebox);
+	gtk_widget_show(window);
+
+	gtk_main();
+
+	// release the FreeImage library
+	FreeImage_DeInitialise();
+
+	return 0;
+}
diff --git a/Examples/Linux/linux-svgalib.c b/Examples/Linux/linux-svgalib.c
new file mode 100644
index 0000000..f0eb68c
--- /dev/null
+++ b/Examples/Linux/linux-svgalib.c
@@ -0,0 +1,96 @@
+#include <vga.h>
+#include "FreeImage.h"
+
+int main(void)
+{
+	FIBITMAP *dib,*ptr;
+	vga_modeinfo *inf;
+	int length,height,bpp,y;
+
+	// initialize the FreeImage library
+	FreeImage_Initialise();
+
+	dib = FreeImage_Load(FIF_PNG, "freeimage.png", PNG_DEFAULT);
+
+	vga_init();
+	vga_setmode(vga_getdefaultmode());
+
+	inf = vga_getmodeinfo(vga_getcurrentmode());
+
+	switch(inf->colors) {
+	default:
+		printf("Must be at least 256 color mode!\n");
+		return;
+
+	case 1 << 8:
+		bpp = 8;
+		break;
+
+	case 1 << 15:
+		bpp = 15;
+		break;
+
+	case 1 << 16:
+		bpp = 16;
+		break;
+
+	case 1 << 24:
+		if( inf->bytesperpixel == 3 ) {
+			bpp = 24;
+		} else {
+			bpp = 32;
+		}
+		break;
+	}
+
+	if(FreeImage_GetBPP(dib) != bpp) {
+		switch(bpp) {
+		case 8:
+			ptr = FreeImage_ConvertTo8Bits(dib);
+			break;
+
+		case 15:
+			ptr = FreeImage_ConvertTo16Bits555(dib);
+			break;
+
+		case 16:
+			ptr = FreeImage_ConvertTo16Bits565(dib);
+			break;
+
+		case 24:
+			ptr = FreeImage_ConvertTo24Bits(dib);
+			break;
+
+		default:
+		case 32:
+			ptr = FreeImage_ConvertTo32Bits(dib);
+			break;
+		}
+
+		FreeImage_Unload(dib);
+		dib = ptr;
+	}
+
+	length = FreeImage_GetWidth(dib);
+	if( inf->width < length ) {
+		length = inf->width;
+	}
+	height = FreeImage_GetHeight(dib);
+	if( inf->height < height ) {
+		height = inf->height;
+	}
+
+	for(y = 0; y < height; y++) {
+		vga_drawscansegment(FreeImage_GetScanLine(dib, y), 0, y, length);
+	}
+
+	FreeImage_Unload(dib);
+
+	vga_getch();
+	vga_setmode(TEXT);
+
+	// release the FreeImage library
+	FreeImage_DeInitialise();
+
+	return 0;
+}
diff --git a/Examples/OpenGL/TextureManager/TextureManager.cpp b/Examples/OpenGL/TextureManager/TextureManager.cpp
new file mode 100644
index 0000000..cbd69a0
--- /dev/null
+++ b/Examples/OpenGL/TextureManager/TextureManager.cpp
@@ -0,0 +1,145 @@
+//**********************************************
+//Singleton Texture Manager class
+//Written by Ben English
+//benjamin.english@oit.edu
+//
+//For use with OpenGL and the FreeImage library
+//**********************************************
+
+#include "TextureManager.h"
+
+TextureManager* TextureManager::m_inst(0);
+
+TextureManager* TextureManager::Inst()
+{
+	if(!m_inst)
+		m_inst = new TextureManager();
+
+	return m_inst;
+}
+
+TextureManager::TextureManager()
+{
+	// call this ONLY when linking with FreeImage as a static library
+	#ifdef FREEIMAGE_LIB
+		FreeImage_Initialise();
+	#endif
+}
+
+//these should never be called
+//TextureManager::TextureManager(const TextureManager& tm){}
+//TextureManager& TextureManager::operator=(const TextureManager& tm){}
+	
+TextureManager::~TextureManager()
+{
+	// call this ONLY when linking with FreeImage as a static library
+	#ifdef FREEIMAGE_LIB
+		FreeImage_DeInitialise();
+	#endif
+
+	UnloadAllTextures();
+	m_inst = 0;
+}
+
+bool TextureManager::LoadTexture(const char* filename, const unsigned int texID, GLenum image_format, GLint internal_format, GLint level, GLint border)
+{
+	//image format
+	FREE_IMAGE_FORMAT fif = FIF_UNKNOWN;
+	//pointer to the image, once loaded
+	FIBITMAP *dib(0);
+	//pointer to the image data
+	BYTE* bits(0);
+	//image width and height
+	unsigned int width(0), height(0);
+	//OpenGL's image ID to map to
+	GLuint gl_texID;
+	
+	//check the file signature and deduce its format
+	fif = FreeImage_GetFileType(filename, 0);
+	//if still unknown, try to guess the file format from the file extension
+	if(fif == FIF_UNKNOWN) 
+		fif = FreeImage_GetFIFFromFilename(filename);
+	//if still unkown, return failure
+	if(fif == FIF_UNKNOWN)
+		return false;
+
+	//check that the plugin has reading capabilities and load the file
+	if(FreeImage_FIFSupportsReading(fif))
+		dib = FreeImage_Load(fif, filename);
+	//if the image failed to load, return failure
+	if(!dib)
+		return false;
+
+	//retrieve the image data
+	bits = FreeImage_GetBits(dib);
+	//get the image width and height
+	width = FreeImage_GetWidth(dib);
+	height = FreeImage_GetHeight(dib);
+	//if this somehow one of these failed (they shouldn't), return failure
+	if((bits == 0) || (width == 0) || (height == 0))
+		return false;
+	
+	//if this texture ID is in use, unload the current texture
+	if(m_texID.find(texID) != m_texID.end())
+		glDeleteTextures(1, &(m_texID[texID]));
+
+	//generate an OpenGL texture ID for this texture
+	glGenTextures(1, &gl_texID);
+	//store the texture ID mapping
+	m_texID[texID] = gl_texID;
+	//bind to the new texture ID
+	glBindTexture(GL_TEXTURE_2D, gl_texID);
+	//store the texture data for OpenGL use
+	glTexImage2D(GL_TEXTURE_2D, level, internal_format, width, height,
+		border, image_format, GL_UNSIGNED_BYTE, bits);
+
+	//Free FreeImage's copy of the data
+	FreeImage_Unload(dib);
+
+	//return success
+	return true;
+}
+
+bool TextureManager::UnloadTexture(const unsigned int texID)
+{
+	bool result(true);
+	//if this texture ID mapped, unload it's texture, and remove it from the map
+	if(m_texID.find(texID) != m_texID.end())
+	{
+		glDeleteTextures(1, &(m_texID[texID]));
+		m_texID.erase(texID);
+	}
+	//otherwise, unload failed
+	else
+	{
+		result = false;
+	}
+
+	return result;
+}
+
+bool TextureManager::BindTexture(const unsigned int texID)
+{
+	bool result(true);
+	//if this texture ID mapped, bind it's texture as current
+	if(m_texID.find(texID) != m_texID.end())
+		glBindTexture(GL_TEXTURE_2D, m_texID[texID]);
+	//otherwise, binding failed
+	else
+		result = false;
+
+	return result;
+}
+
+void TextureManager::UnloadAllTextures()
+{
+	//start at the begginning of the texture map
+	std::map<unsigned int, GLuint>::iterator i = m_texID.begin();
+
+	//Unload the textures untill the end of the texture map is found
+	while(i != m_texID.end())
+		UnloadTexture(i->first);
+
+	//clear the texture map
+	m_texID.clear();
+}
\ No newline at end of file
diff --git a/Examples/OpenGL/TextureManager/TextureManager.h b/Examples/OpenGL/TextureManager/TextureManager.h
new file mode 100644
index 0000000..0afa4b1
--- /dev/null
+++ b/Examples/OpenGL/TextureManager/TextureManager.h
@@ -0,0 +1,51 @@
+//**********************************************
+//Singleton Texture Manager class
+//Written by Ben English
+//benjamin.english@oit.edu
+//
+//For use with OpenGL and the FreeImage library
+//**********************************************
+
+#ifndef TextureManager_H
+#define TextureManager_H
+
+#include <windows.h>
+#include <gl/gl.h>
+#include "FreeImage.h"
+#include <map>
+
+class TextureManager
+{
+public:
+	static TextureManager* Inst();
+	virtual ~TextureManager();
+
+	//load a texture an make it the current texture
+	//if texID is already in use, it will be unloaded and replaced with this texture
+	bool LoadTexture(const char* filename,	//where to load the file from
+		const unsigned int texID,			//arbitrary id you will reference the texture by
+											//does not have to be generated with glGenTextures
+		GLenum image_format = GL_RGB,		//format the image is in
+		GLint internal_format = GL_RGB,		//format to store the image in
+		GLint level = 0,					//mipmapping level
+		GLint border = 0);					//border size
+
+	//free the memory for a texture
+	bool UnloadTexture(const unsigned int texID);
+
+	//set the current texture
+	bool BindTexture(const unsigned int texID);
+
+	//free all texture memory
+	void UnloadAllTextures();
+
+protected:
+	TextureManager();
+	TextureManager(const TextureManager& tm);
+	TextureManager& operator=(const TextureManager& tm);
+
+	static TextureManager* m_inst;
+	std::map<unsigned int, GLuint> m_texID;
+};
+
+#endif
\ No newline at end of file
diff --git a/Examples/OpenGL/TextureManager/readme.txt b/Examples/OpenGL/TextureManager/readme.txt
new file mode 100644
index 0000000..9cbd7f7
--- /dev/null
+++ b/Examples/OpenGL/TextureManager/readme.txt
@@ -0,0 +1,31 @@
+Hello everyone, this is my 2D texture manager class for OpenGL using the FreeImage Library.  
+
+Requirements:
+--------------------
+OpenGL
+STL map class
+FreeImage (included)
+
+
+Usage
+--------------------
+To load a texture, simply call the LoadTexture function:
+
+TextureManager::Inst()->LoadTexture("img\\bg.jpg", BACKGROUND_IMAGE_ID);
+
+This also binds the loaded texture as the current texture, so after calling it you may make any calls to glTexParameter you may need to specify the properties of the texture.
+
+When you are rendering, just call the TextureManager's BindImage function instead of glBindImage:
+
+TextureManager::Inst()->BindImage(BACKGROUND_IMAGE_ID);
+
+and then do your rendering as normal.
+--------------------
+
+
+Feel free to distribute this as you like, but mind the FreeImage licence included in license-fi.txt, and please don't take credit for my code.  If you modify it, be sure to mention me (Ben English) somewhere.
+
+Please send any comments or suggestions to me at benjamin.english@oit.edu
+
+
+Thanks to Herve Drolon for the FreeImage library, I've found it to be very useful!
\ No newline at end of file
diff --git a/Examples/Plugin/PluginCradle.cpp b/Examples/Plugin/PluginCradle.cpp
new file mode 100644
index 0000000..5dcdbd0
--- /dev/null
+++ b/Examples/Plugin/PluginCradle.cpp
@@ -0,0 +1,253 @@
+// ==========================================================
+// Loader/Saver Plugin Cradle
+//
+// Design and implementation by
+// - Floris van den Berg (flvdberg@wxs.nl)
+// - Hervé Drolon (drolon@infonie.fr)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#include <windows.h>
+#include <stdlib.h>
+
+#include "FreeImage.h"
+#include "Utilities.h"
+
+// ==========================================================
+
+BOOL APIENTRY
+DllMain(HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved) {
+	switch (ul_reason_for_call) {
+		case DLL_PROCESS_ATTACH :
+		case DLL_PROCESS_DETACH :
+		case DLL_THREAD_ATTACH  :
+		case DLL_THREAD_DETACH  :
+			break;
+    }
+
+    return TRUE;
+}
+
+// ==========================================================
+// Plugin Interface
+// ==========================================================
+
+static int s_format_id;
+
+// ==========================================================
+// Plugin Implementation
+// ==========================================================
+
+/**
+    Returns the format string for the plugin. Each plugin,
+	both internal in the DLL and external in a .fip file, must have
+	a unique format string to be addressable.
+*/
+
+static const char * DLL_CALLCONV
+Format() {
+	return "CRADLE";
+}
+
+/**
+    Returns a description string for the plugin. Though a
+	description is not necessary per-se,
+	it is advised to return an unique string in order to tell the
+	user what type of bitmaps this plugin will read and/or write.
+*/
+
+static const char * DLL_CALLCONV
+Description() {
+	return "Here comes the description for your image loader/saver";
+}
+
+/**
+    Returns a comma separated list of file extensions indicating 
+	what files this plugin can open. no spaces or whatsoever are allowed. 
+	The list, being used by FreeImage_GetFIFFromFilename, is usually
+	used as a last resort in finding the type of the bitmap we
+	are dealing with. Best is to check the first few bytes on
+	the low-level bits level first and compare them with a known
+	signature . If this fails, FreeImage_GetFIFFromFilename can be
+	used.
+*/
+
+static const char * DLL_CALLCONV
+Extension() {
+	return "ext1,ext2";
+}
+
+/**
+	RegExpr is only needed for the Qt wrapper
+	It allows the Qt mechanism for loading bitmaps to identify the bitmap
+*/
+static const char * DLL_CALLCONV
+RegExpr() {
+	return NULL;
+}
+
+/**
+	Returns a MIME content type string for that format (MIME stands
+	for Multipurpose Internet Mail Extension).
+*/
+static const char * DLL_CALLCONV
+MimeType() {
+	return "image/myformat";
+}
+
+/**
+	FreeImage's internal way of seeing if a bitmap is of the desired type.
+	When the type of a bitmap is to be retrieved, FreeImage runs Validate
+	for each registered plugin until one returns true. If a plugin doesn't
+	have a validate function, a return value of false is assumed.
+
+	You can always force to use a particular plugin by directly specifying
+	it on the command line, but this can result in a dead DLL if the plugin
+	was not made for the bitmap.
+*/
+static BOOL DLL_CALLCONV
+Validate(FreeImageIO &io, fi_handle handle) {
+	return FALSE;
+}
+
+/**
+	SupportsExportDepth is the first in a possible range of new plugin functions
+	to ask specific information to that plugin. This function returns TRUE if it
+	can save a bitmap in the required bitdepth. If it can't the bitmap has to be
+	converted by the user or another plugin has to be chosen.
+*/
+static BOOL DLL_CALLCONV
+SupportsExportDepth(int depth) {
+	return FALSE;
+}
+
+/**
+	Returns TRUE if the plugin belonging to the given FREE_IMAGE_FORMAT can save a
+	bitmap in the desired data type, returns FALSE otherwise. Currently, TIFF is the only plugin
+	able to save all non-standard images. The PNG plugin is able to save unsigned 16-bit
+	images.
+*/
+static BOOL DLL_CALLCONV 
+SupportsExportType(FREE_IMAGE_TYPE type) {
+	return (type == FIT_BITMAP) ? TRUE : FALSE;
+}
+
+/**
+	SupportsICCProfiles informs FreeImage that a plugin supports ICC profiles. 
+	This function returns TRUE if the plugin can load and save a profile.
+	ICC profile information is accessed via freeimage->get_icc_profile_proc(dib)
+*/
+static BOOL DLL_CALLCONV
+SupportsICCProfiles() {
+	return FALSE;
+}
+
+
+// ----------------------------------------------------------
+
+/**
+    Loads a bitmap into memory. On entry it is assumed that
+	the bitmap to be loaded is of the correct type. If the bitmap
+	is of an incorrect type, the plugin might not gracefully fail but
+	crash or enter an endless loop. It is also assumed that all
+	the bitmap data is available at one time. If the bitmap is not complete,
+	for example because it is being downloaded while loaded, the plugin
+	might also not gracefully fail.
+
+	The Load function has the following parameters:
+
+    The first parameter (FreeImageIO *io) is a structure providing
+	function pointers in order to make use of FreeImage's IO redirection. Using
+	FreeImage's file i/o functions instead of standard ones it is garantueed
+	that all bitmap types, both current and future ones, can be loaded from
+	memory, file cabinets, the internet and more. The second parameter (fi_handle handle)
+	is a companion of FreeImageIO and can be best compared with the standard FILE* type,
+	in a generalized form.
+
+	The third parameter (int page) indicates wether we will be loading a certain page
+	in the bitmap or if we will load the default one. This parameter is only used if
+	the plugin supports multi-paged bitmaps, e.g. cabinet bitmaps that contain a series
+	of images or pages. If the plugin does support multi-paging, the page parameter
+	can contain either a number higher or equal to 0 to load a certain page, or -1 to 
+	load the default page. If the plugin does not support multi-paging,
+	the page parameter is always -1.
+	
+	The fourth parameter (int flags) manipulates the load function to load a bitmap
+	in a certain way. Every plugin has a different flag parameter with different meanings.
+
+	The last parameter (void *data) can contain a special data block used when
+	the file is read multi-paged. Because not every plugin supports multi-paging
+	not every plugin will use the data parameter and it will be set to NULL.However,
+	when the plugin does support multi-paging the parameter contains a pointer to a
+	block of data allocated by the Open function.
+*/
+
+static FIBITMAP * DLL_CALLCONV
+Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
+	return NULL;
+}
+
+static BOOL DLL_CALLCONV
+Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data) {
+	return FALSE;
+}
+
+// ==========================================================
+//   Init
+// ==========================================================
+
+/**
+    Initialises the plugin. The first parameter (Plugin *plugin)
+	contains a pointer to a pre-allocated Plugin structure
+	wherein pointers to the available plugin functions
+	has to be stored. The second parameter (int format_id) is an identification
+	number that the plugin may use to show plugin specific warning messages
+	or other information to the user. The plugin number
+	is generated by FreeImage and can differ everytime the plugin is
+	initialised.
+
+    If you want to create your own plugin you have to take some
+	rules into account. Plugin functions have to be compiled
+	__stdcall using the multithreaded c runtime libraries. Throwing
+	exceptions in plugin functions is allowed, as long as those exceptions
+	are being caught inside the same plugin. It is forbidden for a plugin
+	function to directly call FreeImage functions or to allocate memory
+	and pass it to the main DLL. Exception to this rule is the special file data
+	block that may be allocated the Open function. Allocating a FIBITMAP inside a
+	plugin can be using the function allocate_proc in the FreeImage structure,
+	which will allocate the memory using the DLL's c runtime library.
+*/
+
+void DLL_CALLCONV
+Init(Plugin *plugin, int format_id) {
+	s_format_id = format_id;
+
+	plugin->format_proc = Format;
+	plugin->description_proc = Description;
+	plugin->extension_proc = Extension;
+	plugin->regexpr_proc = RegExpr;
+	plugin->open_proc = NULL;
+	plugin->close_proc = NULL;
+	plugin->pagecount_proc = NULL;
+	plugin->pagecapability_proc = NULL;
+	plugin->load_proc = Load;
+	plugin->save_proc = Save;
+	plugin->validate_proc = Validate;
+	plugin->mime_proc = MimeType;
+	plugin->supports_export_bpp_proc = SupportsExportDepth;
+	plugin->supports_export_type_proc = SupportsExportType;
+	plugin->supports_icc_profiles_proc = SupportsICCProfiles;
+}
diff --git a/Examples/Plugin/PluginCradle.h b/Examples/Plugin/PluginCradle.h
new file mode 100644
index 0000000..b049efb
--- /dev/null
+++ b/Examples/Plugin/PluginCradle.h
@@ -0,0 +1,45 @@
+// ==========================================================
+// JBIG Plugin
+//
+// Design and implementation by
+// - Floris van den Berg (flvdberg@wxs.nl)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#ifndef PLUGINCRADLE_H
+#define PLUGINCRADLE_H
+
+#ifdef PLUGINCRADLE_EXPORTS
+#define PLUGIN_API __declspec(dllexport)
+#else
+#define PLUGIN_API __declspec(dllimport)
+#endif
+
+// ----------------------------------------------------------
+
+struct Plugin;
+
+// ----------------------------------------------------------
+
+#define DLL_CALLCONV __stdcall
+
+// ----------------------------------------------------------
+
+extern "C" {
+	PLUGIN_API void DLL_CALLCONV Init(Plugin *plugin, int format_id);
+}
+
+#endif
diff --git a/FreeImage.2003.sln b/FreeImage.2003.sln
new file mode 100644
index 0000000..0c34340
--- /dev/null
+++ b/FreeImage.2003.sln
@@ -0,0 +1,118 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeImage", "FreeImage.2003.vcproj", "{B39ED2B3-D53A-4077-B957-930979A3577D}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E3536C28-A7F1-4B53-8E52-7D2232F9E098} = {E3536C28-A7F1-4B53-8E52-7D2232F9E098}
+		{1B0A722E-A6A5-4DF2-9A7F-DE24E20E6937} = {1B0A722E-A6A5-4DF2-9A7F-DE24E20E6937}
+		{431E3F3F-7C4D-430A-B8F1-4F165DB64EDC} = {431E3F3F-7C4D-430A-B8F1-4F165DB64EDC}
+		{912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC} = {912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC}
+		{17A4874B-0606-4687-90B6-F91F8CB3B8AF} = {17A4874B-0606-4687-90B6-F91F8CB3B8AF}
+		{7DB10B50-CE00-4D7A-B322-6824F05D2FCB} = {7DB10B50-CE00-4D7A-B322-6824F05D2FCB}
+		{5E1D4E5F-E10C-4BA3-B663-F33014FD21D9} = {5E1D4E5F-E10C-4BA3-B663-F33014FD21D9}
+		{33134F61-C1AD-4B6F-9CEA-503A9F140C52} = {33134F61-C1AD-4B6F-9CEA-503A9F140C52}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeImageLib", "SOURCE\FreeImageLib\FreeImageLib.2003.vcproj", "{9E219DF2-315D-478E-8A07-8960C377CE1E}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E3536C28-A7F1-4B53-8E52-7D2232F9E098} = {E3536C28-A7F1-4B53-8E52-7D2232F9E098}
+		{1B0A722E-A6A5-4DF2-9A7F-DE24E20E6937} = {1B0A722E-A6A5-4DF2-9A7F-DE24E20E6937}
+		{431E3F3F-7C4D-430A-B8F1-4F165DB64EDC} = {431E3F3F-7C4D-430A-B8F1-4F165DB64EDC}
+		{912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC} = {912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC}
+		{17A4874B-0606-4687-90B6-F91F8CB3B8AF} = {17A4874B-0606-4687-90B6-F91F8CB3B8AF}
+		{7DB10B50-CE00-4D7A-B322-6824F05D2FCB} = {7DB10B50-CE00-4D7A-B322-6824F05D2FCB}
+		{5E1D4E5F-E10C-4BA3-B663-F33014FD21D9} = {5E1D4E5F-E10C-4BA3-B663-F33014FD21D9}
+		{33134F61-C1AD-4B6F-9CEA-503A9F140C52} = {33134F61-C1AD-4B6F-9CEA-503A9F140C52}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeImagePlus", "Wrapper\FreeImagePlus\FreeImagePlus.2003.vcproj", "{12AAE1F1-E982-49D3-B24E-63FD677FCE77}"
+	ProjectSection(ProjectDependencies) = postProject
+		{B39ED2B3-D53A-4077-B957-930979A3577D} = {B39ED2B3-D53A-4077-B957-930979A3577D}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibJPEG", "Source\LibJPEG\LibJPEG.2003.vcproj", "{5E1D4E5F-E10C-4BA3-B663-F33014FD21D9}"
+	ProjectSection(ProjectDependencies) = postProject
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibMNG", "Source\LibMNG\LibMNG.2003.vcproj", "{912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC}"
+	ProjectSection(ProjectDependencies) = postProject
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibPNG", "Source\LibPNG\LibPNG.2003.vcproj", "{7DB10B50-CE00-4D7A-B322-6824F05D2FCB}"
+	ProjectSection(ProjectDependencies) = postProject
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibTIFF", "Source\LibTIFF\LibTIFF.2003.vcproj", "{431E3F3F-7C4D-430A-B8F1-4F165DB64EDC}"
+	ProjectSection(ProjectDependencies) = postProject
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZLib", "Source\ZLib\ZLib.2003.vcproj", "{33134F61-C1AD-4B6F-9CEA-503A9F140C52}"
+	ProjectSection(ProjectDependencies) = postProject
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenEXR", "Source\OpenEXR\OpenEXR.2003.vcproj", "{17A4874B-0606-4687-90B6-F91F8CB3B8AF}"
+	ProjectSection(ProjectDependencies) = postProject
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibOpenJPEG", "Source\LibOpenJPEG\LibOpenJPEG.2003.vcproj", "{E3536C28-A7F1-4B53-8E52-7D2232F9E098}"
+	ProjectSection(ProjectDependencies) = postProject
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibRawLite", "Source\LibRawLite\LibRawLite.2003.vcproj", "{1B0A722E-A6A5-4DF2-9A7F-DE24E20E6937}"
+	ProjectSection(ProjectDependencies) = postProject
+	EndProjectSection
+EndProject
+Global
+	GlobalSection(SolutionConfiguration) = preSolution
+		Debug = Debug
+		Release = Release
+	EndGlobalSection
+	GlobalSection(ProjectDependencies) = postSolution
+	EndGlobalSection
+	GlobalSection(ProjectConfiguration) = postSolution
+		{B39ED2B3-D53A-4077-B957-930979A3577D}.Debug.ActiveCfg = Debug|Win32
+		{B39ED2B3-D53A-4077-B957-930979A3577D}.Debug.Build.0 = Debug|Win32
+		{B39ED2B3-D53A-4077-B957-930979A3577D}.Release.ActiveCfg = Release|Win32
+		{B39ED2B3-D53A-4077-B957-930979A3577D}.Release.Build.0 = Release|Win32
+		{9E219DF2-315D-478E-8A07-8960C377CE1E}.Debug.ActiveCfg = Debug|Win32
+		{9E219DF2-315D-478E-8A07-8960C377CE1E}.Release.ActiveCfg = Release|Win32
+		{12AAE1F1-E982-49D3-B24E-63FD677FCE77}.Debug.ActiveCfg = Debug|Win32
+		{12AAE1F1-E982-49D3-B24E-63FD677FCE77}.Debug.Build.0 = Debug|Win32
+		{12AAE1F1-E982-49D3-B24E-63FD677FCE77}.Release.ActiveCfg = Release|Win32
+		{12AAE1F1-E982-49D3-B24E-63FD677FCE77}.Release.Build.0 = Release|Win32
+		{5E1D4E5F-E10C-4BA3-B663-F33014FD21D9}.Debug.ActiveCfg = Debug|Win32
+		{5E1D4E5F-E10C-4BA3-B663-F33014FD21D9}.Debug.Build.0 = Debug|Win32
+		{5E1D4E5F-E10C-4BA3-B663-F33014FD21D9}.Release.ActiveCfg = Release|Win32
+		{5E1D4E5F-E10C-4BA3-B663-F33014FD21D9}.Release.Build.0 = Release|Win32
+		{912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC}.Debug.ActiveCfg = Debug|Win32
+		{912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC}.Debug.Build.0 = Debug|Win32
+		{912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC}.Release.ActiveCfg = Release|Win32
+		{912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC}.Release.Build.0 = Release|Win32
+		{7DB10B50-CE00-4D7A-B322-6824F05D2FCB}.Debug.ActiveCfg = Debug|Win32
+		{7DB10B50-CE00-4D7A-B322-6824F05D2FCB}.Debug.Build.0 = Debug|Win32
+		{7DB10B50-CE00-4D7A-B322-6824F05D2FCB}.Release.ActiveCfg = Release|Win32
+		{7DB10B50-CE00-4D7A-B322-6824F05D2FCB}.Release.Build.0 = Release|Win32
+		{431E3F3F-7C4D-430A-B8F1-4F165DB64EDC}.Debug.ActiveCfg = Debug|Win32
+		{431E3F3F-7C4D-430A-B8F1-4F165DB64EDC}.Debug.Build.0 = Debug|Win32
+		{431E3F3F-7C4D-430A-B8F1-4F165DB64EDC}.Release.ActiveCfg = Release|Win32
+		{431E3F3F-7C4D-430A-B8F1-4F165DB64EDC}.Release.Build.0 = Release|Win32
+		{33134F61-C1AD-4B6F-9CEA-503A9F140C52}.Debug.ActiveCfg = Debug|Win32
+		{33134F61-C1AD-4B6F-9CEA-503A9F140C52}.Debug.Build.0 = Debug|Win32
+		{33134F61-C1AD-4B6F-9CEA-503A9F140C52}.Release.ActiveCfg = Release|Win32
+		{33134F61-C1AD-4B6F-9CEA-503A9F140C52}.Release.Build.0 = Release|Win32
+		{17A4874B-0606-4687-90B6-F91F8CB3B8AF}.Debug.ActiveCfg = Debug|Win32
+		{17A4874B-0606-4687-90B6-F91F8CB3B8AF}.Debug.Build.0 = Debug|Win32
+		{17A4874B-0606-4687-90B6-F91F8CB3B8AF}.Release.ActiveCfg = Release|Win32
+		{17A4874B-0606-4687-90B6-F91F8CB3B8AF}.Release.Build.0 = Release|Win32
+		{E3536C28-A7F1-4B53-8E52-7D2232F9E098}.Debug.ActiveCfg = Debug|Win32
+		{E3536C28-A7F1-4B53-8E52-7D2232F9E098}.Debug.Build.0 = Debug|Win32
+		{E3536C28-A7F1-4B53-8E52-7D2232F9E098}.Release.ActiveCfg = Release|Win32
+		{E3536C28-A7F1-4B53-8E52-7D2232F9E098}.Release.Build.0 = Release|Win32
+		{1B0A722E-A6A5-4DF2-9A7F-DE24E20E6937}.Debug.ActiveCfg = Debug|Win32
+		{1B0A722E-A6A5-4DF2-9A7F-DE24E20E6937}.Debug.Build.0 = Debug|Win32
+		{1B0A722E-A6A5-4DF2-9A7F-DE24E20E6937}.Release.ActiveCfg = Release|Win32
+		{1B0A722E-A6A5-4DF2-9A7F-DE24E20E6937}.Release.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+	EndGlobalSection
+	GlobalSection(ExtensibilityAddIns) = postSolution
+	EndGlobalSection
+EndGlobal
diff --git a/FreeImage.2003.vcproj b/FreeImage.2003.vcproj
new file mode 100644
index 0000000..c9beacb
--- /dev/null
+++ b/FreeImage.2003.vcproj
@@ -0,0 +1,495 @@
+<?xml version="1.0" encoding="Windows-1252"?>

+<VisualStudioProject

+	ProjectType="Visual C++"

+	Version="7.10"

+	Name="FreeImage"

+	SccProjectName=""

+	SccLocalPath="">

+	<Platforms>

+		<Platform

+			Name="Win32"/>

+	</Platforms>

+	<Configurations>

+		<Configuration

+			Name="Release|Win32"

+			OutputDirectory=".\Release"

+			IntermediateDirectory=".\Release"

+			ConfigurationType="2"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE"

+			CharacterSet="2">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="2"

+				GlobalOptimizations="TRUE"

+				InlineFunctionExpansion="2"

+				EnableIntrinsicFunctions="TRUE"

+				FavorSizeOrSpeed="1"

+				OmitFramePointers="TRUE"

+				OptimizeForProcessor="3"

+				AdditionalIncludeDirectories="Source;Source\ZLib;Source\DeprecationManager;Source\OpenEXR\Half;Source\OpenEXR\Iex;Source\OpenEXR\IlmImf;Source\OpenEXR\Imath;Source\OpenEXR\IlmThread"

+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;OPJ_STATIC;LIBRAW_NODLL;FREEIMAGE_EXPORTS;_SECURE_NO_DEPRECATE"

+				StringPooling="TRUE"

+				RuntimeLibrary="0"

+				BufferSecurityCheck="FALSE"

+				TreatWChar_tAsBuiltInType="TRUE"

+				PrecompiledHeaderFile=".\Release/FreeImage.pch"

+				AssemblerListingLocation=".\Release/"

+				ObjectFile=".\Release/"

+				ProgramDataBaseFileName=".\Release/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"

+				CompileAs="2"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLinkerTool"

+				OutputFile=".\Release/FreeImage.dll"

+				LinkIncremental="1"

+				SuppressStartupBanner="TRUE"

+				ProgramDatabaseFile=".\Release/FreeImage.pdb"

+				ImportLibrary=".\Release/FreeImage.lib"

+				TargetMachine="1"/>

+			<Tool

+				Name="VCMIDLTool"

+				PreprocessorDefinitions="NDEBUG"

+				MkTypLibCompatible="TRUE"

+				SuppressStartupBanner="TRUE"

+				TargetEnvironment="1"

+				TypeLibraryName=".\Release/FreeImage.tlb"

+				HeaderFileName=""/>

+			<Tool

+				Name="VCPostBuildEventTool"

+				CommandLine="copy Release\FreeImage.dll Dist

+copy Release\FreeImage.lib Dist

+copy Source\FreeImage.h Dist

+"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="NDEBUG"

+				Culture="1033"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCWebDeploymentTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+		<Configuration

+			Name="Debug|Win32"

+			OutputDirectory=".\Debug"

+			IntermediateDirectory=".\Debug"

+			ConfigurationType="2"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="FALSE"

+			CharacterSet="2">

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				AdditionalIncludeDirectories="Source;Source\ZLib;Source\DeprecationManager;Source\OpenEXR\Half;Source\OpenEXR\Iex;Source\OpenEXR\IlmImf;Source\OpenEXR\Imath;Source\OpenEXR\IlmThread"

+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;OPJ_STATIC;FREEIMAGE_EXPORTS;_SECURE_NO_DEPRECATE;LIBRAW_NODLL"

+				StringPooling="TRUE"

+				BasicRuntimeChecks="3"

+				RuntimeLibrary="1"

+				TreatWChar_tAsBuiltInType="TRUE"

+				PrecompiledHeaderFile=""

+				AssemblerListingLocation=".\Debug/"

+				ObjectFile=".\Debug/"

+				ProgramDataBaseFileName=".\Debug/"

+				WarningLevel="3"

+				SuppressStartupBanner="TRUE"

+				DebugInformationFormat="4"

+				CompileAs="2"/>

+			<Tool

+				Name="VCCustomBuildTool"/>

+			<Tool

+				Name="VCLinkerTool"

+				OutputFile="Debug/FreeImaged.dll"

+				LinkIncremental="2"

+				SuppressStartupBanner="TRUE"

+				GenerateDebugInformation="TRUE"

+				ProgramDatabaseFile=".\Debug/FreeImaged.pdb"

+				ImportLibrary=".\Debug/FreeImaged.lib"

+				TargetMachine="1"/>

+			<Tool

+				Name="VCMIDLTool"

+				PreprocessorDefinitions="_DEBUG"

+				MkTypLibCompatible="TRUE"

+				SuppressStartupBanner="TRUE"

+				TargetEnvironment="1"

+				TypeLibraryName=".\Debug/FreeImage.tlb"

+				HeaderFileName=""/>

+			<Tool

+				Name="VCPostBuildEventTool"

+				CommandLine="copy Debug\FreeImaged.dll Dist

+copy Debug\FreeImaged.lib Dist

+copy Source\FreeImage.h Dist

+"/>

+			<Tool

+				Name="VCPreBuildEventTool"/>

+			<Tool

+				Name="VCPreLinkEventTool"/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="_DEBUG"

+				Culture="1033"/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"/>

+			<Tool

+				Name="VCWebDeploymentTool"/>

+			<Tool

+				Name="VCManagedWrapperGeneratorTool"/>

+			<Tool

+				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>

+		</Configuration>

+	</Configurations>

+	<References>

+	</References>

+	<Files>

+		<Filter

+			Name="Source Files"

+			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">

+			<File

+				RelativePath="Source\FreeImage\BitmapAccess.cpp">

+			</File>

+			<File

+				RelativePath="Source\FreeImage\ColorLookup.cpp">

+			</File>

+			<File

+				RelativePath="Source\FreeImage\FreeImage.cpp">

+			</File>

+			<File

+				RelativePath="FreeImage.rc">

+			</File>

+			<File

+				RelativePath="Source\FreeImage\FreeImageC.c">

+			</File>

+			<File

+				RelativePath="Source\FreeImage\FreeImageIO.cpp">

+			</File>

+			<File

+				RelativePath="Source\FreeImage\GetType.cpp">

+			</File>

+			<File

+				RelativePath="Source\FreeImage\MemoryIO.cpp">

+			</File>

+			<File

+				RelativePath="Source\FreeImage\PixelAccess.cpp">

+			</File>

+			<Filter

+				Name="Plugins"

+				Filter="">

+				<File

+					RelativePath=".\source\FreeImage\J2KHelper.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Plugin.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginBMP.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginCUT.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginDDS.cpp">

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\PluginEXR.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginG3.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginGIF.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginHDR.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginICO.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginIFF.cpp">

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\PluginJ2K.cpp">

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\PluginJP2.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginJPEG.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginKOALA.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginMNG.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginPCD.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginPCX.cpp">

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\PluginPFM.cpp">

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\PluginPICT.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginPNG.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginPNM.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginPSD.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginRAS.cpp">

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\PluginRAW.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginSGI.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginTARGA.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginTIFF.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginWBMP.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginXBM.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginXPM.cpp">

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\PSDParser.cpp">

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\TIFFLogLuv.cpp">

+				</File>

+			</Filter>

+			<Filter

+				Name="Conversion"

+				Filter="">

+				<File

+					RelativePath="Source\FreeImage\Conversion.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Conversion16_555.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Conversion16_565.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Conversion24.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Conversion32.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Conversion4.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Conversion8.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\ConversionRGBF.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\ConversionType.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Halftoning.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\tmoColorConvert.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\tmoDrago03.cpp">

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\tmoFattal02.cpp">

+					<FileConfiguration

+						Name="Debug|Win32">

+						<Tool

+							Name="VCCLCompilerTool"

+							WarningLevel="4"/>

+					</FileConfiguration>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\tmoReinhard05.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\ToneMapping.cpp">

+				</File>

+			</Filter>

+			<Filter

+				Name="Quantizers"

+				Filter="">

+				<File

+					RelativePath="Source\FreeImage\NNQuantizer.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\WuQuantizer.cpp">

+				</File>

+			</Filter>

+			<Filter

+				Name="DeprecationMgr"

+				Filter="">

+				<File

+					RelativePath=".\source\DeprecationManager\Deprecated.cpp">

+				</File>

+				<File

+					RelativePath="Source\DeprecationManager\DeprecationMgr.cpp">

+				</File>

+			</Filter>

+			<Filter

+				Name="MultiPaging"

+				Filter="">

+				<File

+					RelativePath="Source\FreeImage\CacheFile.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\MultiPage.cpp">

+				</File>

+				<File

+					RelativePath="Source\FreeImage\ZLibInterface.cpp">

+				</File>

+			</Filter>

+			<Filter

+				Name="Metadata"

+				Filter="">

+				<File

+					RelativePath="Source\Metadata\Exif.cpp">

+				</File>

+				<File

+					RelativePath="Source\Metadata\FIRational.cpp">

+				</File>

+				<File

+					RelativePath="Source\Metadata\FreeImageTag.cpp">

+				</File>

+				<File

+					RelativePath="Source\Metadata\IPTC.cpp">

+				</File>

+				<File

+					RelativePath="Source\Metadata\TagConversion.cpp">

+				</File>

+				<File

+					RelativePath="Source\Metadata\TagLib.cpp">

+				</File>

+				<File

+					RelativePath="Source\Metadata\XTIFF.cpp">

+				</File>

+			</Filter>

+		</Filter>

+		<Filter

+			Name="Header Files"

+			Filter="h;hpp;hxx;hm;inl">

+			<File

+				RelativePath="Source\CacheFile.h">

+			</File>

+			<File

+				RelativePath="Source\DeprecationManager\DeprecationMgr.h">

+			</File>

+			<File

+				RelativePath="Source\Metadata\FIRational.h">

+			</File>

+			<File

+				RelativePath="Source\FreeImage.h">

+			</File>

+			<File

+				RelativePath="Source\FreeImageIO.h">

+			</File>

+			<File

+				RelativePath="Source\Metadata\FreeImageTag.h">

+			</File>

+			<File

+				RelativePath="Source\Plugin.h">

+			</File>

+			<File

+				RelativePath=".\source\FreeImage\PSDParser.h">

+			</File>

+			<File

+				RelativePath="Source\Quantizers.h">

+			</File>

+			<File

+				RelativePath="Source\ToneMapping.h">

+			</File>

+			<File

+				RelativePath="Source\Utilities.h">

+			</File>

+		</Filter>

+		<Filter

+			Name="Toolkit Files"

+			Filter="">

+			<File

+				RelativePath=".\source\FreeImageToolkit\Background.cpp">

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\BSplineRotate.cpp">

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\Channels.cpp">

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\ClassicRotate.cpp">

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\Colors.cpp">

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\CopyPaste.cpp">

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\Display.cpp">

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\Flip.cpp">

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\JPEGTransform.cpp">

+			</File>

+			<File

+				RelativePath=".\source\FreeImageToolkit\MultigridPoissonSolver.cpp">

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\Rescale.cpp">

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\Resize.cpp">

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\Resize.h">

+			</File>

+		</Filter>

+		<File

+			RelativePath="Todo.txt">

+		</File>

+		<File

+			RelativePath="Whatsnew.txt">

+		</File>

+	</Files>

+	<Globals>

+	</Globals>

+</VisualStudioProject>

diff --git a/FreeImage.2005.sln b/FreeImage.2005.sln
new file mode 100644
index 0000000..8de2196
--- /dev/null
+++ b/FreeImage.2005.sln
@@ -0,0 +1,103 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeImage", "FreeImage.2005.vcproj", "{B39ED2B3-D53A-4077-B957-930979A3577D}"
+	ProjectSection(ProjectDependencies) = postProject
+		{431E3F3F-7C4D-430A-B8F1-4F165DB64EDC} = {431E3F3F-7C4D-430A-B8F1-4F165DB64EDC}
+		{912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC} = {912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC}
+		{17A4874B-0606-4687-90B6-F91F8CB3B8AF} = {17A4874B-0606-4687-90B6-F91F8CB3B8AF}
+		{7DB10B50-CE00-4D7A-B322-6824F05D2FCB} = {7DB10B50-CE00-4D7A-B322-6824F05D2FCB}
+		{5E1D4E5F-E10C-4BA3-B663-F33014FD21D9} = {5E1D4E5F-E10C-4BA3-B663-F33014FD21D9}
+		{33134F61-C1AD-4B6F-9CEA-503A9F140C52} = {33134F61-C1AD-4B6F-9CEA-503A9F140C52}
+		{07F662C1-1323-42AB-B6AF-FBFD34A7437A} = {07F662C1-1323-42AB-B6AF-FBFD34A7437A}
+		{E3536C28-A7F1-4B53-8E52-7D2232F9E098} = {E3536C28-A7F1-4B53-8E52-7D2232F9E098}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeImageLib", "Source\FreeImageLib\FreeImageLib.2005.vcproj", "{9E219DF2-315D-478E-8A07-8960C377CE1E}"
+	ProjectSection(ProjectDependencies) = postProject
+		{431E3F3F-7C4D-430A-B8F1-4F165DB64EDC} = {431E3F3F-7C4D-430A-B8F1-4F165DB64EDC}
+		{912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC} = {912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC}
+		{17A4874B-0606-4687-90B6-F91F8CB3B8AF} = {17A4874B-0606-4687-90B6-F91F8CB3B8AF}
+		{7DB10B50-CE00-4D7A-B322-6824F05D2FCB} = {7DB10B50-CE00-4D7A-B322-6824F05D2FCB}
+		{5E1D4E5F-E10C-4BA3-B663-F33014FD21D9} = {5E1D4E5F-E10C-4BA3-B663-F33014FD21D9}
+		{33134F61-C1AD-4B6F-9CEA-503A9F140C52} = {33134F61-C1AD-4B6F-9CEA-503A9F140C52}
+		{07F662C1-1323-42AB-B6AF-FBFD34A7437A} = {07F662C1-1323-42AB-B6AF-FBFD34A7437A}
+		{E3536C28-A7F1-4B53-8E52-7D2232F9E098} = {E3536C28-A7F1-4B53-8E52-7D2232F9E098}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeImagePlus", "Wrapper\FreeImagePlus\FreeImagePlus.2005.vcproj", "{94F36908-A4E2-4533-939D-64FF6EADA5A1}"
+	ProjectSection(ProjectDependencies) = postProject
+		{B39ED2B3-D53A-4077-B957-930979A3577D} = {B39ED2B3-D53A-4077-B957-930979A3577D}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibJPEG", "Source\LibJPEG\LibJPEG.2005.vcproj", "{5E1D4E5F-E10C-4BA3-B663-F33014FD21D9}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibMNG", "Source\LibMNG\LibMNG.2005.vcproj", "{912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibPNG", "Source\LibPNG\LibPNG.2005.vcproj", "{7DB10B50-CE00-4D7A-B322-6824F05D2FCB}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibTIFF", "Source\LibTIFF\LibTIFF.2005.vcproj", "{431E3F3F-7C4D-430A-B8F1-4F165DB64EDC}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZLib", "Source\ZLib\ZLib.2005.vcproj", "{33134F61-C1AD-4B6F-9CEA-503A9F140C52}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "OpenEXR", "Source\OpenEXR\OpenEXR.2005.vcproj", "{17A4874B-0606-4687-90B6-F91F8CB3B8AF}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibOpenJPEG", "Source\LibOpenJPEG\LibOpenJPEG.2005.vcproj", "{E3536C28-A7F1-4B53-8E52-7D2232F9E098}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibRawLite", "Source\LibRawLite\LibRawLite.2005.vcproj", "{07F662C1-1323-42AB-B6AF-FBFD34A7437A}"
+	ProjectSection(ProjectDependencies) = postProject
+		{5E1D4E5F-E10C-4BA3-B663-F33014FD21D9} = {5E1D4E5F-E10C-4BA3-B663-F33014FD21D9}
+	EndProjectSection
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{B39ED2B3-D53A-4077-B957-930979A3577D}.Debug|Win32.ActiveCfg = Debug|Win32
+		{B39ED2B3-D53A-4077-B957-930979A3577D}.Debug|Win32.Build.0 = Debug|Win32
+		{B39ED2B3-D53A-4077-B957-930979A3577D}.Release|Win32.ActiveCfg = Release|Win32
+		{B39ED2B3-D53A-4077-B957-930979A3577D}.Release|Win32.Build.0 = Release|Win32
+		{9E219DF2-315D-478E-8A07-8960C377CE1E}.Debug|Win32.ActiveCfg = Debug|Win32
+		{9E219DF2-315D-478E-8A07-8960C377CE1E}.Release|Win32.ActiveCfg = Release|Win32
+		{94F36908-A4E2-4533-939D-64FF6EADA5A1}.Debug|Win32.ActiveCfg = Debug|Win32
+		{94F36908-A4E2-4533-939D-64FF6EADA5A1}.Debug|Win32.Build.0 = Debug|Win32
+		{94F36908-A4E2-4533-939D-64FF6EADA5A1}.Release|Win32.ActiveCfg = Release|Win32
+		{94F36908-A4E2-4533-939D-64FF6EADA5A1}.Release|Win32.Build.0 = Release|Win32
+		{5E1D4E5F-E10C-4BA3-B663-F33014FD21D9}.Debug|Win32.ActiveCfg = Debug|Win32
+		{5E1D4E5F-E10C-4BA3-B663-F33014FD21D9}.Debug|Win32.Build.0 = Debug|Win32
+		{5E1D4E5F-E10C-4BA3-B663-F33014FD21D9}.Release|Win32.ActiveCfg = Release|Win32
+		{5E1D4E5F-E10C-4BA3-B663-F33014FD21D9}.Release|Win32.Build.0 = Release|Win32
+		{912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC}.Debug|Win32.ActiveCfg = Debug|Win32
+		{912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC}.Debug|Win32.Build.0 = Debug|Win32
+		{912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC}.Release|Win32.ActiveCfg = Release|Win32
+		{912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC}.Release|Win32.Build.0 = Release|Win32
+		{7DB10B50-CE00-4D7A-B322-6824F05D2FCB}.Debug|Win32.ActiveCfg = Debug|Win32
+		{7DB10B50-CE00-4D7A-B322-6824F05D2FCB}.Debug|Win32.Build.0 = Debug|Win32
+		{7DB10B50-CE00-4D7A-B322-6824F05D2FCB}.Release|Win32.ActiveCfg = Release|Win32
+		{7DB10B50-CE00-4D7A-B322-6824F05D2FCB}.Release|Win32.Build.0 = Release|Win32
+		{431E3F3F-7C4D-430A-B8F1-4F165DB64EDC}.Debug|Win32.ActiveCfg = Debug|Win32
+		{431E3F3F-7C4D-430A-B8F1-4F165DB64EDC}.Debug|Win32.Build.0 = Debug|Win32
+		{431E3F3F-7C4D-430A-B8F1-4F165DB64EDC}.Release|Win32.ActiveCfg = Release|Win32
+		{431E3F3F-7C4D-430A-B8F1-4F165DB64EDC}.Release|Win32.Build.0 = Release|Win32
+		{33134F61-C1AD-4B6F-9CEA-503A9F140C52}.Debug|Win32.ActiveCfg = Debug|Win32
+		{33134F61-C1AD-4B6F-9CEA-503A9F140C52}.Debug|Win32.Build.0 = Debug|Win32
+		{33134F61-C1AD-4B6F-9CEA-503A9F140C52}.Release|Win32.ActiveCfg = Release|Win32
+		{33134F61-C1AD-4B6F-9CEA-503A9F140C52}.Release|Win32.Build.0 = Release|Win32
+		{17A4874B-0606-4687-90B6-F91F8CB3B8AF}.Debug|Win32.ActiveCfg = Debug|Win32
+		{17A4874B-0606-4687-90B6-F91F8CB3B8AF}.Debug|Win32.Build.0 = Debug|Win32
+		{17A4874B-0606-4687-90B6-F91F8CB3B8AF}.Release|Win32.ActiveCfg = Release|Win32
+		{17A4874B-0606-4687-90B6-F91F8CB3B8AF}.Release|Win32.Build.0 = Release|Win32
+		{E3536C28-A7F1-4B53-8E52-7D2232F9E098}.Debug|Win32.ActiveCfg = Debug|Win32
+		{E3536C28-A7F1-4B53-8E52-7D2232F9E098}.Debug|Win32.Build.0 = Debug|Win32
+		{E3536C28-A7F1-4B53-8E52-7D2232F9E098}.Release|Win32.ActiveCfg = Release|Win32
+		{E3536C28-A7F1-4B53-8E52-7D2232F9E098}.Release|Win32.Build.0 = Release|Win32
+		{07F662C1-1323-42AB-B6AF-FBFD34A7437A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{07F662C1-1323-42AB-B6AF-FBFD34A7437A}.Debug|Win32.Build.0 = Debug|Win32
+		{07F662C1-1323-42AB-B6AF-FBFD34A7437A}.Release|Win32.ActiveCfg = Release|Win32
+		{07F662C1-1323-42AB-B6AF-FBFD34A7437A}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
diff --git a/FreeImage.2005.vcproj b/FreeImage.2005.vcproj
new file mode 100644
index 0000000..d05f3c9
--- /dev/null
+++ b/FreeImage.2005.vcproj
@@ -0,0 +1,645 @@
+<?xml version="1.0" encoding="Windows-1252"?>

+<VisualStudioProject

+	ProjectType="Visual C++"

+	Version="8.00"

+	Name="FreeImage"

+	ProjectGUID="{B39ED2B3-D53A-4077-B957-930979A3577D}"

+	RootNamespace="FreeImage"

+	>

+	<Platforms>

+		<Platform

+			Name="Win32"

+		/>

+	</Platforms>

+	<ToolFiles>

+	</ToolFiles>

+	<Configurations>

+		<Configuration

+			Name="Release|Win32"

+			OutputDirectory=".\Release"

+			IntermediateDirectory=".\Release"

+			ConfigurationType="2"

+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="2"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+				PreprocessorDefinitions="NDEBUG"

+				MkTypLibCompatible="true"

+				SuppressStartupBanner="true"

+				TargetEnvironment="1"

+				TypeLibraryName=".\Release/FreeImage.tlb"

+				HeaderFileName=""

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="2"

+				InlineFunctionExpansion="2"

+				EnableIntrinsicFunctions="true"

+				FavorSizeOrSpeed="1"

+				OmitFramePointers="true"

+				AdditionalIncludeDirectories="Source;Source\ZLib;Source\DeprecationManager;Source\OpenEXR\Half;Source\OpenEXR\Iex;Source\OpenEXR\IlmImf;Source\OpenEXR\Imath;Source\OpenEXR\IlmThread"

+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;OPJ_STATIC;FREEIMAGE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;LIBRAW_NODLL"

+				StringPooling="true"

+				RuntimeLibrary="0"

+				BufferSecurityCheck="false"

+				PrecompiledHeaderFile=".\Release/FreeImage.pch"

+				AssemblerListingLocation=".\Release/"

+				ObjectFile=".\Release/"

+				ProgramDataBaseFileName=".\Release/"

+				WarningLevel="3"

+				SuppressStartupBanner="true"

+				Detect64BitPortabilityProblems="true"

+				CompileAs="0"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="NDEBUG"

+				Culture="1033"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				OutputFile=".\Release/FreeImage.dll"

+				LinkIncremental="1"

+				SuppressStartupBanner="true"

+				ProgramDatabaseFile=".\Release/FreeImage.pdb"

+				ImportLibrary=".\Release/FreeImage.lib"

+				TargetMachine="1"

+				Profile="true"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCWebDeploymentTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+				CommandLine="copy Release\FreeImage.dll Dist&#x0D;&#x0A;copy Release\FreeImage.lib Dist&#x0D;&#x0A;copy Source\FreeImage.h Dist&#x0D;&#x0A;"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug|Win32"

+			OutputDirectory=".\Debug"

+			IntermediateDirectory=".\Debug"

+			ConfigurationType="2"

+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="2"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+				PreprocessorDefinitions="_DEBUG"

+				MkTypLibCompatible="true"

+				SuppressStartupBanner="true"

+				TargetEnvironment="1"

+				TypeLibraryName=".\Debug/FreeImage.tlb"

+				HeaderFileName=""

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				Optimization="0"

+				AdditionalIncludeDirectories="Source;Source\ZLib;Source\DeprecationManager;Source\OpenEXR\Half;Source\OpenEXR\Iex;Source\OpenEXR\IlmImf;Source\OpenEXR\Imath;Source\OpenEXR\IlmThread"

+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;OPJ_STATIC;FREEIMAGE_EXPORTS;_CRT_SECURE_NO_DEPRECATE;LIBRAW_NODLL"

+				StringPooling="true"

+				BasicRuntimeChecks="3"

+				RuntimeLibrary="1"

+				PrecompiledHeaderFile=".\Debug/FreeImage.pch"

+				AssemblerListingLocation=".\Debug/"

+				ObjectFile=".\Debug/"

+				ProgramDataBaseFileName=".\Debug/"

+				WarningLevel="3"

+				SuppressStartupBanner="true"

+				Detect64BitPortabilityProblems="true"

+				DebugInformationFormat="4"

+				CompileAs="0"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="_DEBUG"

+				Culture="1033"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				OutputFile="Debug/FreeImaged.dll"

+				LinkIncremental="2"

+				SuppressStartupBanner="true"

+				GenerateDebugInformation="true"

+				ProgramDatabaseFile=".\Debug/FreeImaged.pdb"

+				ImportLibrary=".\Debug/FreeImaged.lib"

+				TargetMachine="1"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCWebDeploymentTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+				CommandLine="copy Debug\FreeImaged.dll Dist&#x0D;&#x0A;copy Debug\FreeImaged.lib Dist&#x0D;&#x0A;copy Source\FreeImage.h Dist&#x0D;&#x0A;"

+			/>

+		</Configuration>

+	</Configurations>

+	<References>

+	</References>

+	<Files>

+		<Filter

+			Name="Source Files"

+			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"

+			>

+			<File

+				RelativePath="Source\FreeImage\BitmapAccess.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImage\ColorLookup.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImage\FreeImage.cpp"

+				>

+			</File>

+			<File

+				RelativePath="FreeImage.rc"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImage\FreeImageC.c"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImage\FreeImageIO.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImage\GetType.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImage\MemoryIO.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImage\PixelAccess.cpp"

+				>

+			</File>

+			<Filter

+				Name="Plugins"

+				>

+				<File

+					RelativePath=".\source\FreeImage\J2KHelper.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Plugin.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginBMP.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginCUT.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginDDS.cpp"

+					>

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\PluginEXR.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginG3.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginGIF.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginHDR.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginICO.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginIFF.cpp"

+					>

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\PluginJ2K.cpp"

+					>

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\PluginJP2.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginJPEG.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginKOALA.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginMNG.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginPCD.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginPCX.cpp"

+					>

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\PluginPFM.cpp"

+					>

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\PluginPICT.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginPNG.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginPNM.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginPSD.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginRAS.cpp"

+					>

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\PluginRAW.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginSGI.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginTARGA.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginTIFF.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginWBMP.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginXBM.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginXPM.cpp"

+					>

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\PSDParser.cpp"

+					>

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\TIFFLogLuv.cpp"

+					>

+				</File>

+			</Filter>

+			<Filter

+				Name="Conversion"

+				>

+				<File

+					RelativePath="Source\FreeImage\Conversion.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Conversion16_555.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Conversion16_565.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Conversion24.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Conversion32.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Conversion4.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Conversion8.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\ConversionRGBF.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\ConversionType.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Halftoning.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\tmoColorConvert.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\tmoDrago03.cpp"

+					>

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\tmoFattal02.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\tmoReinhard05.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\ToneMapping.cpp"

+					>

+				</File>

+			</Filter>

+			<Filter

+				Name="Quantizers"

+				>

+				<File

+					RelativePath="Source\FreeImage\NNQuantizer.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\WuQuantizer.cpp"

+					>

+				</File>

+			</Filter>

+			<Filter

+				Name="DeprecationMgr"

+				>

+				<File

+					RelativePath=".\source\DeprecationManager\Deprecated.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\DeprecationManager\DeprecationMgr.cpp"

+					>

+				</File>

+			</Filter>

+			<Filter

+				Name="MultiPaging"

+				>

+				<File

+					RelativePath="Source\FreeImage\CacheFile.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\MultiPage.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\ZLibInterface.cpp"

+					>

+				</File>

+			</Filter>

+			<Filter

+				Name="Metadata"

+				>

+				<File

+					RelativePath="Source\Metadata\Exif.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\Metadata\FIRational.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\Metadata\FreeImageTag.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\Metadata\IPTC.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\Metadata\TagConversion.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\Metadata\TagLib.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\Metadata\XTIFF.cpp"

+					>

+				</File>

+			</Filter>

+		</Filter>

+		<Filter

+			Name="Header Files"

+			Filter="h;hpp;hxx;hm;inl"

+			>

+			<File

+				RelativePath="Source\CacheFile.h"

+				>

+			</File>

+			<File

+				RelativePath="Source\DeprecationManager\DeprecationMgr.h"

+				>

+			</File>

+			<File

+				RelativePath="Source\Metadata\FIRational.h"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImage.h"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageIO.h"

+				>

+			</File>

+			<File

+				RelativePath="Source\Metadata\FreeImageTag.h"

+				>

+			</File>

+			<File

+				RelativePath="Source\Plugin.h"

+				>

+			</File>

+			<File

+				RelativePath=".\source\FreeImage\PSDParser.h"

+				>

+			</File>

+			<File

+				RelativePath="Source\Quantizers.h"

+				>

+			</File>

+			<File

+				RelativePath="Source\ToneMapping.h"

+				>

+			</File>

+			<File

+				RelativePath="Source\Utilities.h"

+				>

+			</File>

+		</Filter>

+		<Filter

+			Name="Toolkit Files"

+			>

+			<File

+				RelativePath=".\source\FreeImageToolkit\Background.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\BSplineRotate.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\Channels.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\ClassicRotate.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\Colors.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\CopyPaste.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\Display.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\Flip.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\JPEGTransform.cpp"

+				>

+			</File>

+			<File

+				RelativePath=".\source\FreeImageToolkit\MultigridPoissonSolver.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\Rescale.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\Resize.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\Resize.h"

+				>

+			</File>

+		</Filter>

+		<File

+			RelativePath="Todo.txt"

+			>

+		</File>

+		<File

+			RelativePath="Whatsnew.txt"

+			>

+		</File>

+	</Files>

+	<Globals>

+	</Globals>

+</VisualStudioProject>

diff --git a/FreeImage.2008.sln b/FreeImage.2008.sln
new file mode 100644
index 0000000..39db41d
--- /dev/null
+++ b/FreeImage.2008.sln
@@ -0,0 +1,76 @@
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeImage", "FreeImage.2008.vcproj", "{B39ED2B3-D53A-4077-B957-930979A3577D}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E3536C28-A7F1-4B53-8E52-7D2232F9E098} = {E3536C28-A7F1-4B53-8E52-7D2232F9E098}
+		{431E3F3F-7C4D-430A-B8F1-4F165DB64EDC} = {431E3F3F-7C4D-430A-B8F1-4F165DB64EDC}
+		{912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC} = {912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC}
+		{7DB10B50-CE00-4D7A-B322-6824F05D2FCB} = {7DB10B50-CE00-4D7A-B322-6824F05D2FCB}
+		{5E1D4E5F-E10C-4BA3-B663-F33014FD21D9} = {5E1D4E5F-E10C-4BA3-B663-F33014FD21D9}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeImageLib", "Source\FreeImageLib\FreeImageLib.2008.vcproj", "{9E219DF2-315D-478E-8A07-8960C377CE1E}"
+	ProjectSection(ProjectDependencies) = postProject
+		{E3536C28-A7F1-4B53-8E52-7D2232F9E098} = {E3536C28-A7F1-4B53-8E52-7D2232F9E098}
+		{431E3F3F-7C4D-430A-B8F1-4F165DB64EDC} = {431E3F3F-7C4D-430A-B8F1-4F165DB64EDC}
+		{912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC} = {912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC}
+		{7DB10B50-CE00-4D7A-B322-6824F05D2FCB} = {7DB10B50-CE00-4D7A-B322-6824F05D2FCB}
+		{5E1D4E5F-E10C-4BA3-B663-F33014FD21D9} = {5E1D4E5F-E10C-4BA3-B663-F33014FD21D9}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeImagePlus", "Wrapper\FreeImagePlus\FreeImagePlus.2008.vcproj", "{94F36908-A4E2-4533-939D-64FF6EADA5A1}"
+	ProjectSection(ProjectDependencies) = postProject
+		{B39ED2B3-D53A-4077-B957-930979A3577D} = {B39ED2B3-D53A-4077-B957-930979A3577D}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibJPEG", "Source\LibJPEG\LibJPEG.2008.vcproj", "{5E1D4E5F-E10C-4BA3-B663-F33014FD21D9}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibMNG", "Source\LibMNG\LibMNG.2008.vcproj", "{912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibPNG", "Source\LibPNG\LibPNG.2008.vcproj", "{7DB10B50-CE00-4D7A-B322-6824F05D2FCB}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibTIFF", "Source\LibTIFF\LibTIFF.2008.vcproj", "{431E3F3F-7C4D-430A-B8F1-4F165DB64EDC}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibOpenJPEG", "Source\LibOpenJPEG\LibOpenJPEG.2008.vcproj", "{E3536C28-A7F1-4B53-8E52-7D2232F9E098}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{B39ED2B3-D53A-4077-B957-930979A3577D}.Debug|Win32.ActiveCfg = Debug|Win32
+		{B39ED2B3-D53A-4077-B957-930979A3577D}.Debug|Win32.Build.0 = Debug|Win32
+		{B39ED2B3-D53A-4077-B957-930979A3577D}.Release|Win32.ActiveCfg = Release|Win32
+		{B39ED2B3-D53A-4077-B957-930979A3577D}.Release|Win32.Build.0 = Release|Win32
+		{9E219DF2-315D-478E-8A07-8960C377CE1E}.Debug|Win32.ActiveCfg = Debug|Win32
+		{9E219DF2-315D-478E-8A07-8960C377CE1E}.Release|Win32.ActiveCfg = Release|Win32
+		{94F36908-A4E2-4533-939D-64FF6EADA5A1}.Debug|Win32.ActiveCfg = Debug|Win32
+		{94F36908-A4E2-4533-939D-64FF6EADA5A1}.Debug|Win32.Build.0 = Debug|Win32
+		{94F36908-A4E2-4533-939D-64FF6EADA5A1}.Release|Win32.ActiveCfg = Release|Win32
+		{94F36908-A4E2-4533-939D-64FF6EADA5A1}.Release|Win32.Build.0 = Release|Win32
+		{5E1D4E5F-E10C-4BA3-B663-F33014FD21D9}.Debug|Win32.ActiveCfg = Debug|Win32
+		{5E1D4E5F-E10C-4BA3-B663-F33014FD21D9}.Debug|Win32.Build.0 = Debug|Win32
+		{5E1D4E5F-E10C-4BA3-B663-F33014FD21D9}.Release|Win32.ActiveCfg = Release|Win32
+		{5E1D4E5F-E10C-4BA3-B663-F33014FD21D9}.Release|Win32.Build.0 = Release|Win32
+		{912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC}.Debug|Win32.ActiveCfg = Debug|Win32
+		{912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC}.Debug|Win32.Build.0 = Debug|Win32
+		{912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC}.Release|Win32.ActiveCfg = Release|Win32
+		{912A2D43-35A3-4AF2-B2EB-0D81EFFDA6DC}.Release|Win32.Build.0 = Release|Win32
+		{7DB10B50-CE00-4D7A-B322-6824F05D2FCB}.Debug|Win32.ActiveCfg = Debug|Win32
+		{7DB10B50-CE00-4D7A-B322-6824F05D2FCB}.Debug|Win32.Build.0 = Debug|Win32
+		{7DB10B50-CE00-4D7A-B322-6824F05D2FCB}.Release|Win32.ActiveCfg = Release|Win32
+		{7DB10B50-CE00-4D7A-B322-6824F05D2FCB}.Release|Win32.Build.0 = Release|Win32
+		{431E3F3F-7C4D-430A-B8F1-4F165DB64EDC}.Debug|Win32.ActiveCfg = Debug|Win32
+		{431E3F3F-7C4D-430A-B8F1-4F165DB64EDC}.Debug|Win32.Build.0 = Debug|Win32
+		{431E3F3F-7C4D-430A-B8F1-4F165DB64EDC}.Release|Win32.ActiveCfg = Release|Win32
+		{431E3F3F-7C4D-430A-B8F1-4F165DB64EDC}.Release|Win32.Build.0 = Release|Win32
+		{E3536C28-A7F1-4B53-8E52-7D2232F9E098}.Debug|Win32.ActiveCfg = Debug|Win32
+		{E3536C28-A7F1-4B53-8E52-7D2232F9E098}.Debug|Win32.Build.0 = Debug|Win32
+		{E3536C28-A7F1-4B53-8E52-7D2232F9E098}.Release|Win32.ActiveCfg = Release|Win32
+		{E3536C28-A7F1-4B53-8E52-7D2232F9E098}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal
diff --git a/FreeImage.2008.vcproj b/FreeImage.2008.vcproj
new file mode 100644
index 0000000..fc8b89d
--- /dev/null
+++ b/FreeImage.2008.vcproj
@@ -0,0 +1,628 @@
+<?xml version="1.0" encoding="Windows-1252"?>

+<VisualStudioProject

+	ProjectType="Visual C++"

+	Version="9.00"

+	Name="FreeImage"

+	ProjectGUID="{B39ED2B3-D53A-4077-B957-930979A3577D}"

+	RootNamespace="FreeImage"

+	TargetFrameworkVersion="131072"

+	>

+	<Platforms>

+		<Platform

+			Name="Win32"

+		/>

+	</Platforms>

+	<ToolFiles>

+	</ToolFiles>

+	<Configurations>

+		<Configuration

+			Name="Release|Win32"

+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="2"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="2"

+			 

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+				PreprocessorDefinitions="NDEBUG"

+				MkTypLibCompatible="true"

+				SuppressStartupBanner="true"

+				TargetEnvironment="1"

+				TypeLibraryName=".\Release/FreeImage.tlb"

+				HeaderFileName=""

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				 

+				InlineFunctionExpansion="2"

+				EnableIntrinsicFunctions="true"

+				FavorSizeOrSpeed="1"

+				OmitFramePointers="true"

+				AdditionalIncludeDirectories="Source;Source\ZLib;Source\DeprecationManager;Source\OpenEXR\Half;Source\OpenEXR\Iex;Source\OpenEXR\IlmImf;Source\OpenEXR\Imath;Source\OpenEXR\IlmThread"

+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;OPJ_STATIC;FREEIMAGE_EXPORTS;_CRT_SECURE_NO_DEPRECATE"

+				StringPooling="true"

+				 

+				BufferSecurityCheck="false"

+				 

+				 

+				PrecompiledHeaderFile=".\Release/FreeImage.pch"

+				 

+				 

+				CompileAs="0"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="NDEBUG"

+				Culture="1033"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				OutputFile=".\Release/FreeImage.dll"

+				 

+				SuppressStartupBanner="true"

+				ProgramDatabaseFile=".\Release/FreeImage.pdb"

+				

+				

+				ImportLibrary=".\Release/FreeImage.lib"

+				TargetMachine="1"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+				CommandLine="copy Release\FreeImage.dll Dist&#x0D;&#x0A;copy Release\FreeImage.lib Dist&#x0D;&#x0A;copy Source\FreeImage.h Dist&#x0D;&#x0A;"

+			/>

+		</Configuration>

+		<Configuration

+			Name="Debug|Win32"

+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"

+			IntermediateDirectory="$(ConfigurationName)"

+			ConfigurationType="2"

+			UseOfMFC="0"

+			ATLMinimizesCRunTimeLibraryUsage="false"

+			CharacterSet="2"

+			>

+			<Tool

+				Name="VCPreBuildEventTool"

+			/>

+			<Tool

+				Name="VCCustomBuildTool"

+			/>

+			<Tool

+				Name="VCXMLDataGeneratorTool"

+			/>

+			<Tool

+				Name="VCWebServiceProxyGeneratorTool"

+			/>

+			<Tool

+				Name="VCMIDLTool"

+				PreprocessorDefinitions="_DEBUG"

+				MkTypLibCompatible="true"

+				SuppressStartupBanner="true"

+				TargetEnvironment="1"

+				TypeLibraryName=".\Debug/FreeImage.tlb"

+				HeaderFileName=""

+			/>

+			<Tool

+				Name="VCCLCompilerTool"

+				 

+				AdditionalIncludeDirectories="Source;Source\ZLib;Source\DeprecationManager;Source\OpenEXR\Half;Source\OpenEXR\Iex;Source\OpenEXR\IlmImf;Source\OpenEXR\Imath;Source\OpenEXR\IlmThread"

+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;OPJ_STATIC;FREEIMAGE_EXPORTS;_CRT_SECURE_NO_DEPRECATE"

+				StringPooling="true"

+				 

+				 

+				 

+				PrecompiledHeaderFile=".\Debug/FreeImage.pch"

+				 

+				 

+				CompileAs="0"

+			/>

+			<Tool

+				Name="VCManagedResourceCompilerTool"

+			/>

+			<Tool

+				Name="VCResourceCompilerTool"

+				PreprocessorDefinitions="_DEBUG"

+				Culture="1033"

+			/>

+			<Tool

+				Name="VCPreLinkEventTool"

+			/>

+			<Tool

+				Name="VCLinkerTool"

+				OutputFile="Debug/FreeImaged.dll"

+				 

+				SuppressStartupBanner="true"

+				

+				ProgramDatabaseFile=".\Debug/FreeImaged.pdb"

+				

+				

+				ImportLibrary=".\Debug/FreeImaged.lib"

+				TargetMachine="1"

+			/>

+			<Tool

+				Name="VCALinkTool"

+			/>

+			<Tool

+				Name="VCManifestTool"

+			/>

+			<Tool

+				Name="VCXDCMakeTool"

+			/>

+			<Tool

+				Name="VCBscMakeTool"

+			/>

+			<Tool

+				Name="VCFxCopTool"

+			/>

+			<Tool

+				Name="VCAppVerifierTool"

+			/>

+			<Tool

+				Name="VCPostBuildEventTool"

+				CommandLine="copy Debug\FreeImaged.dll Dist&#x0D;&#x0A;copy Debug\FreeImaged.lib Dist&#x0D;&#x0A;copy Source\FreeImage.h Dist&#x0D;&#x0A;"

+			/>

+		</Configuration>

+	</Configurations>

+	<References>

+	</References>

+	<Files>

+		<Filter

+			Name="Source Files"

+			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"

+			>

+			<File

+				RelativePath="Source\FreeImage\BitmapAccess.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImage\ColorLookup.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImage\FreeImage.cpp"

+				>

+			</File>

+			<File

+				RelativePath="FreeImage.rc"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImage\FreeImageC.c"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImage\FreeImageIO.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImage\GetType.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImage\MemoryIO.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImage\PixelAccess.cpp"

+				>

+			</File>

+			<Filter

+				Name="Plugins"

+				>

+				<File

+					RelativePath=".\source\FreeImage\J2KHelper.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Plugin.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginBMP.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginCUT.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginDDS.cpp"

+					>

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\PluginEXR.cpp"

+					>

+					<FileConfiguration

+						Name="Release|Win32"

+						ExcludedFromBuild="true"

+						>

+						<Tool

+							Name="VCCLCompilerTool"

+						/>

+					</FileConfiguration>

+					<FileConfiguration

+						Name="Debug|Win32"

+						ExcludedFromBuild="true"

+						>

+						<Tool

+							Name="VCCLCompilerTool"

+						/>

+					</FileConfiguration>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginG3.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginGIF.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginHDR.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginICO.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginIFF.cpp"

+					>

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\PluginJ2K.cpp"

+					>

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\PluginJP2.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginJPEG.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginKOALA.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginMNG.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginPCD.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginPCX.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginPNG.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginPNM.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginPSD.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginRAS.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginSGI.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginTARGA.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginTIFF.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginWBMP.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginXBM.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\PluginXPM.cpp"

+					>

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\TIFFLogLuv.cpp"

+					>

+				</File>

+			</Filter>

+			<Filter

+				Name="Conversion"

+				>

+				<File

+					RelativePath="Source\FreeImage\Conversion.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Conversion16_555.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Conversion16_565.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Conversion24.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Conversion32.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Conversion4.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Conversion8.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\ConversionRGBF.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\ConversionType.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\Halftoning.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\tmoColorConvert.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\tmoDrago03.cpp"

+					>

+				</File>

+				<File

+					RelativePath=".\source\FreeImage\tmoFattal02.cpp"

+					>

+					<FileConfiguration

+						Name="Debug|Win32"

+						>

+						<Tool

+							Name="VCCLCompilerTool"

+							 

+						/>

+					</FileConfiguration>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\tmoReinhard05.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\ToneMapping.cpp"

+					>

+				</File>

+			</Filter>

+			<Filter

+				Name="Quantizers"

+				>

+				<File

+					RelativePath="Source\FreeImage\NNQuantizer.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\WuQuantizer.cpp"

+					>

+				</File>

+			</Filter>

+			<Filter

+				Name="DeprecationMgr"

+				>

+				<File

+					RelativePath="Source\DeprecationManager\DeprecationMgr.cpp"

+					>

+				</File>

+			</Filter>

+			<Filter

+				Name="MultiPaging"

+				>

+				<File

+					RelativePath="Source\FreeImage\CacheFile.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\MultiPage.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\FreeImage\ZLibInterface.cpp"

+					>

+				</File>

+			</Filter>

+			<Filter

+				Name="Metadata"

+				>

+				<File

+					RelativePath="Source\Metadata\Exif.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\Metadata\FIRational.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\Metadata\FreeImageTag.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\Metadata\IPTC.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\Metadata\TagConversion.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\Metadata\TagLib.cpp"

+					>

+				</File>

+				<File

+					RelativePath="Source\Metadata\XTIFF.cpp"

+					>

+				</File>

+			</Filter>

+		</Filter>

+		<Filter

+			Name="Header Files"

+			Filter="h;hpp;hxx;hm;inl"

+			>

+			<File

+				RelativePath="Source\CacheFile.h"

+				>

+			</File>

+			<File

+				RelativePath="Source\DeprecationManager\DeprecationMgr.h"

+				>

+			</File>

+			<File

+				RelativePath="Source\Metadata\FIRational.h"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImage.h"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageIO.h"

+				>

+			</File>

+			<File

+				RelativePath="Source\Metadata\FreeImageTag.h"

+				>

+			</File>

+			<File

+				RelativePath="Source\Plugin.h"

+				>

+			</File>

+			<File

+				RelativePath="Source\Quantizers.h"

+				>

+			</File>

+			<File

+				RelativePath="Source\ToneMapping.h"

+				>

+			</File>

+			<File

+				RelativePath="Source\Utilities.h"

+				>

+			</File>

+		</Filter>

+		<Filter

+			Name="Toolkit Files"

+			>

+			<File

+				RelativePath="Source\FreeImageToolkit\BSplineRotate.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\Channels.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\ClassicRotate.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\Colors.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\CopyPaste.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\Display.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\Flip.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\JPEGTransform.cpp"

+				>

+			</File>

+			<File

+				RelativePath=".\source\FreeImageToolkit\MultigridPoissonSolver.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\Rescale.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\Resize.cpp"

+				>

+			</File>

+			<File

+				RelativePath="Source\FreeImageToolkit\Resize.h"

+				>

+			</File>

+		</Filter>

+		<File

+			RelativePath="Whatsnew.txt"

+			>

+		</File>

+	</Files>

+	<Globals>

+	</Globals>

+</VisualStudioProject>

diff --git a/FreeImage.rc b/FreeImage.rc
new file mode 100644
index 0000000..a2b15ee
--- /dev/null
+++ b/FreeImage.rc
@@ -0,0 +1,95 @@
+//Microsoft Developer Studio generated resource script.

+//

+

+#define APSTUDIO_READONLY_SYMBOLS

+/////////////////////////////////////////////////////////////////////////////

+//

+// Generated from the TEXTINCLUDE 2 resource.

+//

+#include "afxres.h"

+

+/////////////////////////////////////////////////////////////////////////////

+#undef APSTUDIO_READONLY_SYMBOLS

+

+/////////////////////////////////////////////////////////////////////////////

+// English (U.S.) resources

+

+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)

+#ifdef _WIN32

+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US

+#pragma code_page(1252)

+#endif //_WIN32

+

+#ifndef _MAC

+/////////////////////////////////////////////////////////////////////////////

+//

+// Version

+//

+

+VS_VERSION_INFO VERSIONINFO

+ FILEVERSION 3,13,0,0

+ PRODUCTVERSION 3,13,0,0

+ FILEFLAGSMASK 0x3fL

+#ifdef _DEBUG

+ FILEFLAGS 0x1L

+#else

+ FILEFLAGS 0x0L

+#endif

+ FILEOS 0x40004L

+ FILETYPE 0x2L

+ FILESUBTYPE 0x0L

+BEGIN

+    BLOCK "StringFileInfo"

+    BEGIN

+        BLOCK "040904e2"

+        BEGIN

+            VALUE "Comments", "FreeImage is an Open Source library project for developers who would like to support popular graphics image formats like PNG, BMP, JPEG, TIFF and others as needed by today's multimedia applications.\0"

+            VALUE "CompanyName", "FreeImage\0"

+            VALUE "FileDescription", "FreeImage library\0"

+            VALUE "FileVersion", "3, 13, 0, 0\0"

+            VALUE "InternalName", "FreeImage\0"

+            VALUE "LegalCopyright", "Copyright © 2003-2009 by FreeImage\0"

+            VALUE "LegalTrademarks", "See http://freeimage.sourceforge.net\0"

+            VALUE "OriginalFilename", "FreeImage.dll\0"

+            VALUE "PrivateBuild", "\0"

+            VALUE "ProductName", "FreeImage\0"

+            VALUE "ProductVersion", "3, 13, 0, 0\0"

+            VALUE "SpecialBuild", "\0"

+        END

+    END

+    BLOCK "VarFileInfo"

+    BEGIN

+        VALUE "Translation", 0x409, 1250

+    END

+END

+

+#endif    // !_MAC

+

+#endif    // English (U.S.) resources

+/////////////////////////////////////////////////////////////////////////////

+

+#ifdef APSTUDIO_INVOKED

+/////////////////////////////////////////////////////////////////////////////

+//

+// TEXTINCLUDE

+//

+

+1 TEXTINCLUDE DISCARDABLE 

+BEGIN

+    "#include ""afxres.h""\r\n"

+    "\0"

+END

+

+2 TEXTINCLUDE DISCARDABLE 

+BEGIN

+    "\r\n"

+    "\0"

+END

+

+#endif    // APSTUDIO_INVOKED

+

+

+/////////////////////////////////////////////////////////////////////////////

+

+

+

diff --git a/FreeImage.xcodeproj/project.pbxproj b/FreeImage.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..1757875
--- /dev/null
+++ b/FreeImage.xcodeproj/project.pbxproj
@@ -0,0 +1,1016 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 45;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		D7066BBC0E2BD03600ED8BBE /* BitmapAccess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B840E2BD03600ED8BBE /* BitmapAccess.cpp */; };
+		D7066BBD0E2BD03600ED8BBE /* CacheFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B850E2BD03600ED8BBE /* CacheFile.cpp */; };
+		D7066BBE0E2BD03600ED8BBE /* ColorLookup.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B860E2BD03600ED8BBE /* ColorLookup.cpp */; };
+		D7066BBF0E2BD03600ED8BBE /* Conversion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B870E2BD03600ED8BBE /* Conversion.cpp */; };
+		D7066BC00E2BD03600ED8BBE /* Conversion4.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B880E2BD03600ED8BBE /* Conversion4.cpp */; };
+		D7066BC10E2BD03600ED8BBE /* Conversion8.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B890E2BD03600ED8BBE /* Conversion8.cpp */; };
+		D7066BC20E2BD03600ED8BBE /* Conversion16_555.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B8A0E2BD03600ED8BBE /* Conversion16_555.cpp */; };
+		D7066BC30E2BD03600ED8BBE /* Conversion16_565.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B8B0E2BD03600ED8BBE /* Conversion16_565.cpp */; };
+		D7066BC40E2BD03600ED8BBE /* Conversion24.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B8C0E2BD03600ED8BBE /* Conversion24.cpp */; };
+		D7066BC50E2BD03600ED8BBE /* Conversion32.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B8D0E2BD03600ED8BBE /* Conversion32.cpp */; };
+		D7066BC60E2BD03600ED8BBE /* ConversionRGBF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B8E0E2BD03600ED8BBE /* ConversionRGBF.cpp */; };
+		D7066BC70E2BD03600ED8BBE /* ConversionType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B8F0E2BD03600ED8BBE /* ConversionType.cpp */; };
+		D7066BC80E2BD03600ED8BBE /* FreeImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B900E2BD03600ED8BBE /* FreeImage.cpp */; };
+		D7066BC90E2BD03600ED8BBE /* FreeImageC.c in Sources */ = {isa = PBXBuildFile; fileRef = D7066B910E2BD03600ED8BBE /* FreeImageC.c */; };
+		D7066BCA0E2BD03600ED8BBE /* FreeImageIO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B920E2BD03600ED8BBE /* FreeImageIO.cpp */; };
+		D7066BCB0E2BD03600ED8BBE /* GetType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B930E2BD03600ED8BBE /* GetType.cpp */; };
+		D7066BCC0E2BD03600ED8BBE /* Halftoning.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B940E2BD03600ED8BBE /* Halftoning.cpp */; };
+		D7066BCD0E2BD03600ED8BBE /* J2KHelper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B950E2BD03600ED8BBE /* J2KHelper.cpp */; };
+		D7066BCE0E2BD03600ED8BBE /* MemoryIO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B960E2BD03600ED8BBE /* MemoryIO.cpp */; };
+		D7066BCF0E2BD03600ED8BBE /* MultiPage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B970E2BD03600ED8BBE /* MultiPage.cpp */; };
+		D7066BD00E2BD03600ED8BBE /* NNQuantizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B980E2BD03600ED8BBE /* NNQuantizer.cpp */; };
+		D7066BD10E2BD03600ED8BBE /* PixelAccess.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B990E2BD03600ED8BBE /* PixelAccess.cpp */; };
+		D7066BD20E2BD03600ED8BBE /* Plugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B9A0E2BD03600ED8BBE /* Plugin.cpp */; };
+		D7066BD30E2BD03600ED8BBE /* PluginBMP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B9B0E2BD03600ED8BBE /* PluginBMP.cpp */; };
+		D7066BD40E2BD03600ED8BBE /* PluginCUT.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B9C0E2BD03600ED8BBE /* PluginCUT.cpp */; };
+		D7066BD50E2BD03600ED8BBE /* PluginDDS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B9D0E2BD03600ED8BBE /* PluginDDS.cpp */; };
+		D7066BD70E2BD03600ED8BBE /* PluginG3.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066B9F0E2BD03600ED8BBE /* PluginG3.cpp */; };
+		D7066BD80E2BD03600ED8BBE /* PluginGIF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BA00E2BD03600ED8BBE /* PluginGIF.cpp */; };
+		D7066BD90E2BD03600ED8BBE /* PluginHDR.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BA10E2BD03600ED8BBE /* PluginHDR.cpp */; };
+		D7066BDA0E2BD03600ED8BBE /* PluginICO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BA20E2BD03600ED8BBE /* PluginICO.cpp */; };
+		D7066BDB0E2BD03600ED8BBE /* PluginIFF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BA30E2BD03600ED8BBE /* PluginIFF.cpp */; };
+		D7066BDC0E2BD03600ED8BBE /* PluginJ2K.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BA40E2BD03600ED8BBE /* PluginJ2K.cpp */; };
+		D7066BDD0E2BD03600ED8BBE /* PluginJP2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BA50E2BD03600ED8BBE /* PluginJP2.cpp */; };
+		D7066BDE0E2BD03600ED8BBE /* PluginJPEG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BA60E2BD03600ED8BBE /* PluginJPEG.cpp */; };
+		D7066BDF0E2BD03600ED8BBE /* PluginKOALA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BA70E2BD03600ED8BBE /* PluginKOALA.cpp */; };
+		D7066BE00E2BD03600ED8BBE /* PluginMNG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BA80E2BD03600ED8BBE /* PluginMNG.cpp */; };
+		D7066BE10E2BD03600ED8BBE /* PluginPCD.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BA90E2BD03600ED8BBE /* PluginPCD.cpp */; };
+		D7066BE20E2BD03600ED8BBE /* PluginPCX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BAA0E2BD03600ED8BBE /* PluginPCX.cpp */; };
+		D7066BE30E2BD03600ED8BBE /* PluginPNG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BAB0E2BD03600ED8BBE /* PluginPNG.cpp */; };
+		D7066BE40E2BD03600ED8BBE /* PluginPNM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BAC0E2BD03600ED8BBE /* PluginPNM.cpp */; };
+		D7066BE50E2BD03600ED8BBE /* PluginPSD.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BAD0E2BD03600ED8BBE /* PluginPSD.cpp */; };
+		D7066BE60E2BD03600ED8BBE /* PluginRAS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BAE0E2BD03600ED8BBE /* PluginRAS.cpp */; };
+		D7066BE70E2BD03600ED8BBE /* PluginSGI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BAF0E2BD03600ED8BBE /* PluginSGI.cpp */; };
+		D7066BE80E2BD03600ED8BBE /* PluginTARGA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BB00E2BD03600ED8BBE /* PluginTARGA.cpp */; };
+		D7066BE90E2BD03600ED8BBE /* PluginTIFF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BB10E2BD03600ED8BBE /* PluginTIFF.cpp */; };
+		D7066BEA0E2BD03600ED8BBE /* PluginWBMP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BB20E2BD03600ED8BBE /* PluginWBMP.cpp */; };
+		D7066BEB0E2BD03600ED8BBE /* PluginXBM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BB30E2BD03600ED8BBE /* PluginXBM.cpp */; };
+		D7066BEC0E2BD03600ED8BBE /* PluginXPM.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BB40E2BD03600ED8BBE /* PluginXPM.cpp */; };
+		D7066BED0E2BD03600ED8BBE /* tmoColorConvert.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BB50E2BD03600ED8BBE /* tmoColorConvert.cpp */; };
+		D7066BEE0E2BD03600ED8BBE /* tmoDrago03.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BB60E2BD03600ED8BBE /* tmoDrago03.cpp */; };
+		D7066BEF0E2BD03600ED8BBE /* tmoFattal02.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BB70E2BD03600ED8BBE /* tmoFattal02.cpp */; };
+		D7066BF00E2BD03600ED8BBE /* tmoReinhard05.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BB80E2BD03600ED8BBE /* tmoReinhard05.cpp */; };
+		D7066BF10E2BD03600ED8BBE /* ToneMapping.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BB90E2BD03600ED8BBE /* ToneMapping.cpp */; };
+		D7066BF20E2BD03600ED8BBE /* WuQuantizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BBA0E2BD03600ED8BBE /* WuQuantizer.cpp */; };
+		D7066BF30E2BD03600ED8BBE /* ZLibInterface.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BBB0E2BD03600ED8BBE /* ZLibInterface.cpp */; };
+		D7066BF70E2BD04E00ED8BBE /* DeprecationMgr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BF50E2BD04E00ED8BBE /* DeprecationMgr.cpp */; };
+		D7066BF80E2BD04E00ED8BBE /* DeprecationMgr.h in Headers */ = {isa = PBXBuildFile; fileRef = D7066BF60E2BD04E00ED8BBE /* DeprecationMgr.h */; };
+		D7066C110E2BD07800ED8BBE /* BSplineRotate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BFA0E2BD07800ED8BBE /* BSplineRotate.cpp */; };
+		D7066C120E2BD07800ED8BBE /* Channels.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BFB0E2BD07800ED8BBE /* Channels.cpp */; };
+		D7066C130E2BD07800ED8BBE /* ClassicRotate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BFC0E2BD07800ED8BBE /* ClassicRotate.cpp */; };
+		D7066C140E2BD07800ED8BBE /* Colors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BFD0E2BD07800ED8BBE /* Colors.cpp */; };
+		D7066C150E2BD07800ED8BBE /* CopyPaste.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BFE0E2BD07800ED8BBE /* CopyPaste.cpp */; };
+		D7066C160E2BD07800ED8BBE /* Display.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066BFF0E2BD07800ED8BBE /* Display.cpp */; };
+		D7066C170E2BD07800ED8BBE /* Filters.h in Headers */ = {isa = PBXBuildFile; fileRef = D7066C000E2BD07800ED8BBE /* Filters.h */; };
+		D7066C180E2BD07800ED8BBE /* Flip.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066C010E2BD07800ED8BBE /* Flip.cpp */; };
+		D7066C190E2BD07800ED8BBE /* JPEGTransform.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066C020E2BD07800ED8BBE /* JPEGTransform.cpp */; };
+		D7066C1A0E2BD07800ED8BBE /* MultigridPoissonSolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066C030E2BD07800ED8BBE /* MultigridPoissonSolver.cpp */; };
+		D7066C1B0E2BD07800ED8BBE /* Rescale.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066C040E2BD07800ED8BBE /* Rescale.cpp */; };
+		D7066C1C0E2BD07800ED8BBE /* Resize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066C050E2BD07800ED8BBE /* Resize.cpp */; };
+		D7066C1D0E2BD07800ED8BBE /* Resize.h in Headers */ = {isa = PBXBuildFile; fileRef = D7066C060E2BD07800ED8BBE /* Resize.h */; };
+		D7066C1E0E2BD07800ED8BBE /* Exif.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066C080E2BD07800ED8BBE /* Exif.cpp */; };
+		D7066C1F0E2BD07800ED8BBE /* FIRational.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066C090E2BD07800ED8BBE /* FIRational.cpp */; };
+		D7066C200E2BD07800ED8BBE /* FIRational.h in Headers */ = {isa = PBXBuildFile; fileRef = D7066C0A0E2BD07800ED8BBE /* FIRational.h */; };
+		D7066C210E2BD07800ED8BBE /* FreeImageTag.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066C0B0E2BD07800ED8BBE /* FreeImageTag.cpp */; };
+		D7066C220E2BD07800ED8BBE /* FreeImageTag.h in Headers */ = {isa = PBXBuildFile; fileRef = D7066C0C0E2BD07800ED8BBE /* FreeImageTag.h */; };
+		D7066C230E2BD07800ED8BBE /* IPTC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066C0D0E2BD07800ED8BBE /* IPTC.cpp */; };
+		D7066C240E2BD07800ED8BBE /* TagConversion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066C0E0E2BD07800ED8BBE /* TagConversion.cpp */; };
+		D7066C250E2BD07800ED8BBE /* TagLib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066C0F0E2BD07800ED8BBE /* TagLib.cpp */; };
+		D7066C260E2BD07800ED8BBE /* XTIFF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7066C100E2BD07800ED8BBE /* XTIFF.cpp */; };
+		D706FA2C0EA41A3F00F3F6B1 /* TIFFLogLuv.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D706FA2B0EA41A3F00F3F6B1 /* TIFFLogLuv.cpp */; };
+		D76E028F10D06BA500F2706E /* PSDParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D76E028D10D06BA500F2706E /* PSDParser.cpp */; };
+		D76E029010D06BA500F2706E /* PSDParser.h in Headers */ = {isa = PBXBuildFile; fileRef = D76E028E10D06BA500F2706E /* PSDParser.h */; };
+		D7A1E5980E2BD25800010CB8 /* CacheFile.h in Headers */ = {isa = PBXBuildFile; fileRef = D7A1E5910E2BD25800010CB8 /* CacheFile.h */; };
+		D7A1E5990E2BD25800010CB8 /* FreeImage.h in Headers */ = {isa = PBXBuildFile; fileRef = D7A1E5920E2BD25800010CB8 /* FreeImage.h */; };
+		D7A1E59A0E2BD25800010CB8 /* FreeImageIO.h in Headers */ = {isa = PBXBuildFile; fileRef = D7A1E5930E2BD25800010CB8 /* FreeImageIO.h */; };
+		D7A1E59B0E2BD25800010CB8 /* Plugin.h in Headers */ = {isa = PBXBuildFile; fileRef = D7A1E5940E2BD25800010CB8 /* Plugin.h */; };
+		D7A1E59C0E2BD25800010CB8 /* Quantizers.h in Headers */ = {isa = PBXBuildFile; fileRef = D7A1E5950E2BD25800010CB8 /* Quantizers.h */; };
+		D7A1E59D0E2BD25800010CB8 /* ToneMapping.h in Headers */ = {isa = PBXBuildFile; fileRef = D7A1E5960E2BD25800010CB8 /* ToneMapping.h */; };
+		D7A1E59E0E2BD25800010CB8 /* Utilities.h in Headers */ = {isa = PBXBuildFile; fileRef = D7A1E5970E2BD25800010CB8 /* Utilities.h */; };
+		D7A1E5AD0E2BD38A00010CB8 /* zutil.h in Headers */ = {isa = PBXBuildFile; fileRef = D7A1E5AC0E2BD38A00010CB8 /* zutil.h */; };
+		D7A5F2960E2BD46200DA164A /* libjpeg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D7A5F25D0E2BD40100DA164A /* libjpeg.a */; };
+		D7A5F2970E2BD46300DA164A /* libmng.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D7A5F2700E2BD41300DA164A /* libmng.a */; };
+		D7A5F2980E2BD46300DA164A /* libopenjpeg.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D7A5F27B0E2BD43200DA164A /* libopenjpeg.a */; };
+		D7A5F29A0E2BD46400DA164A /* libtiff.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D7A5F2950E2BD44F00DA164A /* libtiff.a */; };
+		D7F881390E2BD55D007CA12F /* testMemIO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7F881310E2BD55D007CA12F /* testMemIO.cpp */; };
+		D7F8813A0E2BD55D007CA12F /* testJPEG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7F881320E2BD55D007CA12F /* testJPEG.cpp */; };
+		D7F8813B0E2BD55D007CA12F /* testMPage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7F881330E2BD55D007CA12F /* testMPage.cpp */; };
+		D7F8813C0E2BD55D007CA12F /* MainTestSuite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7F881340E2BD55D007CA12F /* MainTestSuite.cpp */; };
+		D7F8813D0E2BD55D007CA12F /* testPlugins.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7F881360E2BD55D007CA12F /* testPlugins.cpp */; };
+		D7F8813E0E2BD55D007CA12F /* testImageType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7F881370E2BD55D007CA12F /* testImageType.cpp */; };
+		D7F8813F0E2BD55D007CA12F /* testTools.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D7F881380E2BD55D007CA12F /* testTools.cpp */; };
+		D7F8815C0E2BD677007CA12F /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D7F8815B0E2BD677007CA12F /* Carbon.framework */; };
+		D7F8822A0E2BD7BE007CA12F /* libFreeImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D2AAC046055464E500DB518D /* libFreeImage.a */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+		D7A5F25C0E2BD40100DA164A /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = D7A5F24B0E2BD40100DA164A /* libjpeg.xcodeproj */;
+			proxyType = 2;
+			remoteGlobalIDString = D2AAC046055464E500DB518D;
+			remoteInfo = libjpeg;
+		};
+		D7A5F25E0E2BD40100DA164A /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = D7A5F24B0E2BD40100DA164A /* libjpeg.xcodeproj */;
+			proxyType = 2;
+			remoteGlobalIDString = D76557550E0AE4150038F973;
+			remoteInfo = cjpeg;
+		};
+		D7A5F2600E2BD40100DA164A /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = D7A5F24B0E2BD40100DA164A /* libjpeg.xcodeproj */;
+			proxyType = 2;
+			remoteGlobalIDString = D725A6F70E0AFB5F008C767D;
+			remoteInfo = djpeg;
+		};
+		D7A5F2620E2BD40100DA164A /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = D7A5F24B0E2BD40100DA164A /* libjpeg.xcodeproj */;
+			proxyType = 2;
+			remoteGlobalIDString = D7EFF6010E0AFC7D0025E981;
+			remoteInfo = jpegtran;
+		};
+		D7A5F2640E2BD40100DA164A /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = D7A5F24B0E2BD40100DA164A /* libjpeg.xcodeproj */;
+			proxyType = 2;
+			remoteGlobalIDString = D778786D0E0AFF7B00C99215;
+			remoteInfo = tests;
+		};
+		D7A5F26F0E2BD41300DA164A /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = D7A5F2660E2BD41300DA164A /* libmng.xcodeproj */;
+			proxyType = 2;
+			remoteGlobalIDString = D2AAC046055464E500DB518D;
+			remoteInfo = libmng;
+		};
+		D7A5F27A0E2BD43200DA164A /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = D7A5F2710E2BD43200DA164A /* libopenjpeg.xcodeproj */;
+			proxyType = 2;
+			remoteGlobalIDString = D2AAC046055464E500DB518D;
+			remoteInfo = libopenjpeg;
+		};
+		D7A5F2870E2BD44100DA164A /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = D7A5F27C0E2BD44100DA164A /* libpng.xcodeproj */;
+			proxyType = 2;
+			remoteGlobalIDString = D2AAC046055464E500DB518D;
+			remoteInfo = libpng;
+		};
+		D7A5F2890E2BD44100DA164A /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = D7A5F27C0E2BD44100DA164A /* libpng.xcodeproj */;
+			proxyType = 2;
+			remoteGlobalIDString = D74E47BA0E0AD22000402A94;
+			remoteInfo = pngtest;
+		};
+		D7A5F2940E2BD44F00DA164A /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = D7A5F28B0E2BD44F00DA164A /* libtiff.xcodeproj */;
+			proxyType = 2;
+			remoteGlobalIDString = D2AAC046055464E500DB518D;
+			remoteInfo = libtiff;
+		};
+		D7A5F29B0E2BD47200DA164A /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = D7A5F24B0E2BD40100DA164A /* libjpeg.xcodeproj */;
+			proxyType = 1;
+			remoteGlobalIDString = D2AAC045055464E500DB518D;
+			remoteInfo = libjpeg;
+		};
+		D7A5F29D0E2BD47200DA164A /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = D7A5F27C0E2BD44100DA164A /* libpng.xcodeproj */;
+			proxyType = 1;
+			remoteGlobalIDString = D2AAC045055464E500DB518D;
+			remoteInfo = libpng;
+		};
+		D7A5F29F0E2BD47200DA164A /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = D7A5F2710E2BD43200DA164A /* libopenjpeg.xcodeproj */;
+			proxyType = 1;
+			remoteGlobalIDString = D2AAC045055464E500DB518D;
+			remoteInfo = libopenjpeg;
+		};
+		D7A5F2A10E2BD47200DA164A /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = D7A5F2660E2BD41300DA164A /* libmng.xcodeproj */;
+			proxyType = 1;
+			remoteGlobalIDString = D2AAC045055464E500DB518D;
+			remoteInfo = libmng;
+		};
+		D7A5F2A30E2BD47200DA164A /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = D7A5F28B0E2BD44F00DA164A /* libtiff.xcodeproj */;
+			proxyType = 1;
+			remoteGlobalIDString = D2AAC045055464E500DB518D;
+			remoteInfo = libtiff;
+		};
+		D7F881410E2BD57F007CA12F /* PBXContainerItemProxy */ = {
+			isa = PBXContainerItemProxy;
+			containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+			proxyType = 1;
+			remoteGlobalIDString = D2AAC045055464E500DB518D;
+			remoteInfo = FreeImage;
+		};
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+		D2AAC046055464E500DB518D /* libFreeImage.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libFreeImage.a; sourceTree = BUILT_PRODUCTS_DIR; };
+		D7066B840E2BD03600ED8BBE /* BitmapAccess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BitmapAccess.cpp; path = Source/FreeImage/BitmapAccess.cpp; sourceTree = SOURCE_ROOT; };
+		D7066B850E2BD03600ED8BBE /* CacheFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CacheFile.cpp; path = Source/FreeImage/CacheFile.cpp; sourceTree = "<group>"; };
+		D7066B860E2BD03600ED8BBE /* ColorLookup.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ColorLookup.cpp; path = Source/FreeImage/ColorLookup.cpp; sourceTree = SOURCE_ROOT; };
+		D7066B870E2BD03600ED8BBE /* Conversion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Conversion.cpp; path = Source/FreeImage/Conversion.cpp; sourceTree = "<group>"; };
+		D7066B880E2BD03600ED8BBE /* Conversion4.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Conversion4.cpp; path = Source/FreeImage/Conversion4.cpp; sourceTree = "<group>"; };
+		D7066B890E2BD03600ED8BBE /* Conversion8.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Conversion8.cpp; path = Source/FreeImage/Conversion8.cpp; sourceTree = "<group>"; };
+		D7066B8A0E2BD03600ED8BBE /* Conversion16_555.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Conversion16_555.cpp; path = Source/FreeImage/Conversion16_555.cpp; sourceTree = "<group>"; };
+		D7066B8B0E2BD03600ED8BBE /* Conversion16_565.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Conversion16_565.cpp; path = Source/FreeImage/Conversion16_565.cpp; sourceTree = "<group>"; };
+		D7066B8C0E2BD03600ED8BBE /* Conversion24.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Conversion24.cpp; path = Source/FreeImage/Conversion24.cpp; sourceTree = "<group>"; };
+		D7066B8D0E2BD03600ED8BBE /* Conversion32.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Conversion32.cpp; path = Source/FreeImage/Conversion32.cpp; sourceTree = "<group>"; };
+		D7066B8E0E2BD03600ED8BBE /* ConversionRGBF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ConversionRGBF.cpp; path = Source/FreeImage/ConversionRGBF.cpp; sourceTree = "<group>"; };
+		D7066B8F0E2BD03600ED8BBE /* ConversionType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ConversionType.cpp; path = Source/FreeImage/ConversionType.cpp; sourceTree = "<group>"; };
+		D7066B900E2BD03600ED8BBE /* FreeImage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FreeImage.cpp; path = Source/FreeImage/FreeImage.cpp; sourceTree = SOURCE_ROOT; };
+		D7066B910E2BD03600ED8BBE /* FreeImageC.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = FreeImageC.c; path = Source/FreeImage/FreeImageC.c; sourceTree = SOURCE_ROOT; };
+		D7066B920E2BD03600ED8BBE /* FreeImageIO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FreeImageIO.cpp; path = Source/FreeImage/FreeImageIO.cpp; sourceTree = SOURCE_ROOT; };
+		D7066B930E2BD03600ED8BBE /* GetType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = GetType.cpp; path = Source/FreeImage/GetType.cpp; sourceTree = SOURCE_ROOT; };
+		D7066B940E2BD03600ED8BBE /* Halftoning.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Halftoning.cpp; path = Source/FreeImage/Halftoning.cpp; sourceTree = "<group>"; };
+		D7066B950E2BD03600ED8BBE /* J2KHelper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = J2KHelper.cpp; path = Source/FreeImage/J2KHelper.cpp; sourceTree = "<group>"; };
+		D7066B960E2BD03600ED8BBE /* MemoryIO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MemoryIO.cpp; path = Source/FreeImage/MemoryIO.cpp; sourceTree = SOURCE_ROOT; };
+		D7066B970E2BD03600ED8BBE /* MultiPage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MultiPage.cpp; path = Source/FreeImage/MultiPage.cpp; sourceTree = "<group>"; };
+		D7066B980E2BD03600ED8BBE /* NNQuantizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NNQuantizer.cpp; path = Source/FreeImage/NNQuantizer.cpp; sourceTree = "<group>"; };
+		D7066B990E2BD03600ED8BBE /* PixelAccess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PixelAccess.cpp; path = Source/FreeImage/PixelAccess.cpp; sourceTree = SOURCE_ROOT; };
+		D7066B9A0E2BD03600ED8BBE /* Plugin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Plugin.cpp; path = Source/FreeImage/Plugin.cpp; sourceTree = "<group>"; };
+		D7066B9B0E2BD03600ED8BBE /* PluginBMP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginBMP.cpp; path = Source/FreeImage/PluginBMP.cpp; sourceTree = "<group>"; };
+		D7066B9C0E2BD03600ED8BBE /* PluginCUT.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginCUT.cpp; path = Source/FreeImage/PluginCUT.cpp; sourceTree = "<group>"; };
+		D7066B9D0E2BD03600ED8BBE /* PluginDDS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginDDS.cpp; path = Source/FreeImage/PluginDDS.cpp; sourceTree = "<group>"; };
+		D7066B9F0E2BD03600ED8BBE /* PluginG3.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginG3.cpp; path = Source/FreeImage/PluginG3.cpp; sourceTree = "<group>"; };
+		D7066BA00E2BD03600ED8BBE /* PluginGIF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginGIF.cpp; path = Source/FreeImage/PluginGIF.cpp; sourceTree = "<group>"; };
+		D7066BA10E2BD03600ED8BBE /* PluginHDR.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginHDR.cpp; path = Source/FreeImage/PluginHDR.cpp; sourceTree = "<group>"; };
+		D7066BA20E2BD03600ED8BBE /* PluginICO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginICO.cpp; path = Source/FreeImage/PluginICO.cpp; sourceTree = "<group>"; };
+		D7066BA30E2BD03600ED8BBE /* PluginIFF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginIFF.cpp; path = Source/FreeImage/PluginIFF.cpp; sourceTree = "<group>"; };
+		D7066BA40E2BD03600ED8BBE /* PluginJ2K.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginJ2K.cpp; path = Source/FreeImage/PluginJ2K.cpp; sourceTree = "<group>"; };
+		D7066BA50E2BD03600ED8BBE /* PluginJP2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginJP2.cpp; path = Source/FreeImage/PluginJP2.cpp; sourceTree = "<group>"; };
+		D7066BA60E2BD03600ED8BBE /* PluginJPEG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginJPEG.cpp; path = Source/FreeImage/PluginJPEG.cpp; sourceTree = "<group>"; };
+		D7066BA70E2BD03600ED8BBE /* PluginKOALA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginKOALA.cpp; path = Source/FreeImage/PluginKOALA.cpp; sourceTree = "<group>"; };
+		D7066BA80E2BD03600ED8BBE /* PluginMNG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginMNG.cpp; path = Source/FreeImage/PluginMNG.cpp; sourceTree = "<group>"; };
+		D7066BA90E2BD03600ED8BBE /* PluginPCD.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginPCD.cpp; path = Source/FreeImage/PluginPCD.cpp; sourceTree = "<group>"; };
+		D7066BAA0E2BD03600ED8BBE /* PluginPCX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginPCX.cpp; path = Source/FreeImage/PluginPCX.cpp; sourceTree = "<group>"; };
+		D7066BAB0E2BD03600ED8BBE /* PluginPNG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginPNG.cpp; path = Source/FreeImage/PluginPNG.cpp; sourceTree = "<group>"; };
+		D7066BAC0E2BD03600ED8BBE /* PluginPNM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginPNM.cpp; path = Source/FreeImage/PluginPNM.cpp; sourceTree = "<group>"; };
+		D7066BAD0E2BD03600ED8BBE /* PluginPSD.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginPSD.cpp; path = Source/FreeImage/PluginPSD.cpp; sourceTree = "<group>"; };
+		D7066BAE0E2BD03600ED8BBE /* PluginRAS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginRAS.cpp; path = Source/FreeImage/PluginRAS.cpp; sourceTree = "<group>"; };
+		D7066BAF0E2BD03600ED8BBE /* PluginSGI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginSGI.cpp; path = Source/FreeImage/PluginSGI.cpp; sourceTree = "<group>"; };
+		D7066BB00E2BD03600ED8BBE /* PluginTARGA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginTARGA.cpp; path = Source/FreeImage/PluginTARGA.cpp; sourceTree = "<group>"; };
+		D7066BB10E2BD03600ED8BBE /* PluginTIFF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginTIFF.cpp; path = Source/FreeImage/PluginTIFF.cpp; sourceTree = "<group>"; };
+		D7066BB20E2BD03600ED8BBE /* PluginWBMP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginWBMP.cpp; path = Source/FreeImage/PluginWBMP.cpp; sourceTree = "<group>"; };
+		D7066BB30E2BD03600ED8BBE /* PluginXBM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginXBM.cpp; path = Source/FreeImage/PluginXBM.cpp; sourceTree = "<group>"; };
+		D7066BB40E2BD03600ED8BBE /* PluginXPM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PluginXPM.cpp; path = Source/FreeImage/PluginXPM.cpp; sourceTree = "<group>"; };
+		D7066BB50E2BD03600ED8BBE /* tmoColorConvert.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = tmoColorConvert.cpp; path = Source/FreeImage/tmoColorConvert.cpp; sourceTree = "<group>"; };
+		D7066BB60E2BD03600ED8BBE /* tmoDrago03.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = tmoDrago03.cpp; path = Source/FreeImage/tmoDrago03.cpp; sourceTree = "<group>"; };
+		D7066BB70E2BD03600ED8BBE /* tmoFattal02.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = tmoFattal02.cpp; path = Source/FreeImage/tmoFattal02.cpp; sourceTree = "<group>"; };
+		D7066BB80E2BD03600ED8BBE /* tmoReinhard05.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = tmoReinhard05.cpp; path = Source/FreeImage/tmoReinhard05.cpp; sourceTree = "<group>"; };
+		D7066BB90E2BD03600ED8BBE /* ToneMapping.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ToneMapping.cpp; path = Source/FreeImage/ToneMapping.cpp; sourceTree = "<group>"; };
+		D7066BBA0E2BD03600ED8BBE /* WuQuantizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WuQuantizer.cpp; path = Source/FreeImage/WuQuantizer.cpp; sourceTree = "<group>"; };
+		D7066BBB0E2BD03600ED8BBE /* ZLibInterface.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ZLibInterface.cpp; path = Source/FreeImage/ZLibInterface.cpp; sourceTree = "<group>"; };
+		D7066BF50E2BD04E00ED8BBE /* DeprecationMgr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DeprecationMgr.cpp; path = Source/DeprecationManager/DeprecationMgr.cpp; sourceTree = SOURCE_ROOT; };
+		D7066BF60E2BD04E00ED8BBE /* DeprecationMgr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DeprecationMgr.h; path = Source/DeprecationManager/DeprecationMgr.h; sourceTree = SOURCE_ROOT; };
+		D7066BFA0E2BD07800ED8BBE /* BSplineRotate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BSplineRotate.cpp; path = Source/FreeImageToolkit/BSplineRotate.cpp; sourceTree = SOURCE_ROOT; };
+		D7066BFB0E2BD07800ED8BBE /* Channels.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Channels.cpp; path = Source/FreeImageToolkit/Channels.cpp; sourceTree = SOURCE_ROOT; };
+		D7066BFC0E2BD07800ED8BBE /* ClassicRotate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClassicRotate.cpp; path = Source/FreeImageToolkit/ClassicRotate.cpp; sourceTree = SOURCE_ROOT; };
+		D7066BFD0E2BD07800ED8BBE /* Colors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Colors.cpp; path = Source/FreeImageToolkit/Colors.cpp; sourceTree = SOURCE_ROOT; };
+		D7066BFE0E2BD07800ED8BBE /* CopyPaste.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CopyPaste.cpp; path = Source/FreeImageToolkit/CopyPaste.cpp; sourceTree = SOURCE_ROOT; };
+		D7066BFF0E2BD07800ED8BBE /* Display.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Display.cpp; path = Source/FreeImageToolkit/Display.cpp; sourceTree = SOURCE_ROOT; };
+		D7066C000E2BD07800ED8BBE /* Filters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Filters.h; path = Source/FreeImageToolkit/Filters.h; sourceTree = SOURCE_ROOT; };
+		D7066C010E2BD07800ED8BBE /* Flip.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Flip.cpp; path = Source/FreeImageToolkit/Flip.cpp; sourceTree = SOURCE_ROOT; };
+		D7066C020E2BD07800ED8BBE /* JPEGTransform.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JPEGTransform.cpp; path = Source/FreeImageToolkit/JPEGTransform.cpp; sourceTree = SOURCE_ROOT; };
+		D7066C030E2BD07800ED8BBE /* MultigridPoissonSolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MultigridPoissonSolver.cpp; path = Source/FreeImageToolkit/MultigridPoissonSolver.cpp; sourceTree = SOURCE_ROOT; };
+		D7066C040E2BD07800ED8BBE /* Rescale.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Rescale.cpp; path = Source/FreeImageToolkit/Rescale.cpp; sourceTree = SOURCE_ROOT; };
+		D7066C050E2BD07800ED8BBE /* Resize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Resize.cpp; path = Source/FreeImageToolkit/Resize.cpp; sourceTree = SOURCE_ROOT; };
+		D7066C060E2BD07800ED8BBE /* Resize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Resize.h; path = Source/FreeImageToolkit/Resize.h; sourceTree = SOURCE_ROOT; };
+		D7066C080E2BD07800ED8BBE /* Exif.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Exif.cpp; path = Source/Metadata/Exif.cpp; sourceTree = SOURCE_ROOT; };
+		D7066C090E2BD07800ED8BBE /* FIRational.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FIRational.cpp; path = Source/Metadata/FIRational.cpp; sourceTree = SOURCE_ROOT; };
+		D7066C0A0E2BD07800ED8BBE /* FIRational.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FIRational.h; path = Source/Metadata/FIRational.h; sourceTree = SOURCE_ROOT; };
+		D7066C0B0E2BD07800ED8BBE /* FreeImageTag.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FreeImageTag.cpp; path = Source/Metadata/FreeImageTag.cpp; sourceTree = SOURCE_ROOT; };
+		D7066C0C0E2BD07800ED8BBE /* FreeImageTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FreeImageTag.h; path = Source/Metadata/FreeImageTag.h; sourceTree = SOURCE_ROOT; };
+		D7066C0D0E2BD07800ED8BBE /* IPTC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = IPTC.cpp; path = Source/Metadata/IPTC.cpp; sourceTree = SOURCE_ROOT; };
+		D7066C0E0E2BD07800ED8BBE /* TagConversion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TagConversion.cpp; path = Source/Metadata/TagConversion.cpp; sourceTree = SOURCE_ROOT; };
+		D7066C0F0E2BD07800ED8BBE /* TagLib.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TagLib.cpp; path = Source/Metadata/TagLib.cpp; sourceTree = SOURCE_ROOT; };
+		D7066C100E2BD07800ED8BBE /* XTIFF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = XTIFF.cpp; path = Source/Metadata/XTIFF.cpp; sourceTree = SOURCE_ROOT; };
+		D706FA2B0EA41A3F00F3F6B1 /* TIFFLogLuv.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TIFFLogLuv.cpp; path = Source/FreeImage/TIFFLogLuv.cpp; sourceTree = SOURCE_ROOT; };
+		D76E028D10D06BA500F2706E /* PSDParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PSDParser.cpp; path = Source/FreeImage/PSDParser.cpp; sourceTree = SOURCE_ROOT; };
+		D76E028E10D06BA500F2706E /* PSDParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PSDParser.h; path = Source/FreeImage/PSDParser.h; sourceTree = SOURCE_ROOT; };
+		D7A1E5910E2BD25800010CB8 /* CacheFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CacheFile.h; path = Source/CacheFile.h; sourceTree = SOURCE_ROOT; };
+		D7A1E5920E2BD25800010CB8 /* FreeImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FreeImage.h; path = Source/FreeImage.h; sourceTree = SOURCE_ROOT; };
+		D7A1E5930E2BD25800010CB8 /* FreeImageIO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FreeImageIO.h; path = Source/FreeImageIO.h; sourceTree = SOURCE_ROOT; };
+		D7A1E5940E2BD25800010CB8 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Plugin.h; path = Source/Plugin.h; sourceTree = SOURCE_ROOT; };
+		D7A1E5950E2BD25800010CB8 /* Quantizers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Quantizers.h; path = Source/Quantizers.h; sourceTree = SOURCE_ROOT; };
+		D7A1E5960E2BD25800010CB8 /* ToneMapping.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ToneMapping.h; path = Source/ToneMapping.h; sourceTree = SOURCE_ROOT; };
+		D7A1E5970E2BD25800010CB8 /* Utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Utilities.h; path = Source/Utilities.h; sourceTree = SOURCE_ROOT; };
+		D7A1E5AC0E2BD38A00010CB8 /* zutil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zutil.h; path = "../zlib-1.2.3/zutil.h"; sourceTree = SOURCE_ROOT; };
+		D7A5F24B0E2BD40100DA164A /* libjpeg.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libjpeg.xcodeproj; path = Source/LibJPEG/libjpeg.xcodeproj; sourceTree = SOURCE_ROOT; };
+		D7A5F2660E2BD41300DA164A /* libmng.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libmng.xcodeproj; path = Source/LibMNG/libmng.xcodeproj; sourceTree = SOURCE_ROOT; };
+		D7A5F2710E2BD43200DA164A /* libopenjpeg.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libopenjpeg.xcodeproj; path = Source/LibOpenJPEG/libopenjpeg.xcodeproj; sourceTree = SOURCE_ROOT; };
+		D7A5F27C0E2BD44100DA164A /* libpng.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libpng.xcodeproj; path = Source/LibPNG/libpng.xcodeproj; sourceTree = SOURCE_ROOT; };
+		D7A5F28B0E2BD44F00DA164A /* libtiff.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libtiff.xcodeproj; path = Source/LibTIFF/libtiff.xcodeproj; sourceTree = SOURCE_ROOT; };
+		D7EFF2FE0E2BCDF800C97412 /* MacConfigExternalRelease.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = MacConfigExternalRelease.xcconfig; path = ../MacConfigExternalRelease.xcconfig; sourceTree = SOURCE_ROOT; };
+		D7EFF2FF0E2BCDF800C97412 /* MacConfigExternalDebug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = MacConfigExternalDebug.xcconfig; path = ../MacConfigExternalDebug.xcconfig; sourceTree = SOURCE_ROOT; };
+		D7F8812A0E2BD519007CA12F /* FreeImageTest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = FreeImageTest; sourceTree = BUILT_PRODUCTS_DIR; };
+		D7F881310E2BD55D007CA12F /* testMemIO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testMemIO.cpp; path = TestAPI/testMemIO.cpp; sourceTree = SOURCE_ROOT; };
+		D7F881320E2BD55D007CA12F /* testJPEG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testJPEG.cpp; path = TestAPI/testJPEG.cpp; sourceTree = SOURCE_ROOT; };
+		D7F881330E2BD55D007CA12F /* testMPage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testMPage.cpp; path = TestAPI/testMPage.cpp; sourceTree = SOURCE_ROOT; };
+		D7F881340E2BD55D007CA12F /* MainTestSuite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MainTestSuite.cpp; path = TestAPI/MainTestSuite.cpp; sourceTree = SOURCE_ROOT; };
+		D7F881350E2BD55D007CA12F /* TestSuite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestSuite.h; path = TestAPI/TestSuite.h; sourceTree = SOURCE_ROOT; };
+		D7F881360E2BD55D007CA12F /* testPlugins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testPlugins.cpp; path = TestAPI/testPlugins.cpp; sourceTree = SOURCE_ROOT; };
+		D7F881370E2BD55D007CA12F /* testImageType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testImageType.cpp; path = TestAPI/testImageType.cpp; sourceTree = SOURCE_ROOT; };
+		D7F881380E2BD55D007CA12F /* testTools.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = testTools.cpp; path = TestAPI/testTools.cpp; sourceTree = SOURCE_ROOT; };
+		D7F8815B0E2BD677007CA12F /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		D289987405E68DCB004EDB86 /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				D7A5F2970E2BD46300DA164A /* libmng.a in Frameworks */,
+				D7A5F2980E2BD46300DA164A /* libopenjpeg.a in Frameworks */,
+				D7A5F29A0E2BD46400DA164A /* libtiff.a in Frameworks */,
+				D7A5F2960E2BD46200DA164A /* libjpeg.a in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		D7F881280E2BD519007CA12F /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				D7F8822A0E2BD7BE007CA12F /* libFreeImage.a in Frameworks */,
+				D7F8815C0E2BD677007CA12F /* Carbon.framework in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		08FB7794FE84155DC02AAC07 /* FreeImage */ = {
+			isa = PBXGroup;
+			children = (
+				D7A5F24B0E2BD40100DA164A /* libjpeg.xcodeproj */,
+				D7A5F2660E2BD41300DA164A /* libmng.xcodeproj */,
+				D7A5F2710E2BD43200DA164A /* libopenjpeg.xcodeproj */,
+				D7A5F27C0E2BD44100DA164A /* libpng.xcodeproj */,
+				D7A5F28B0E2BD44F00DA164A /* libtiff.xcodeproj */,
+				D7EFF2FE0E2BCDF800C97412 /* MacConfigExternalRelease.xcconfig */,
+				D7EFF2FF0E2BCDF800C97412 /* MacConfigExternalDebug.xcconfig */,
+				08FB7795FE84155DC02AAC07 /* Source */,
+				D7F881240E2BD4E2007CA12F /* Source (test only) */,
+				1AB674ADFE9D54B511CA2CBB /* Products */,
+			);
+			name = FreeImage;
+			sourceTree = "<group>";
+		};
+		08FB7795FE84155DC02AAC07 /* Source */ = {
+			isa = PBXGroup;
+			children = (
+				D7066C280E2BD0C100ED8BBE /* Conversion */,
+				D7066BF40E2BD04E00ED8BBE /* DeprecationManager */,
+				D7066C070E2BD07800ED8BBE /* Metadata */,
+				D7066C290E2BD0FE00ED8BBE /* MultiPaging */,
+				D7066C270E2BD08A00ED8BBE /* Plugins */,
+				D7066C2A0E2BD16600ED8BBE /* Quantizers */,
+				D7066BF90E2BD07800ED8BBE /* Toolkit */,
+				D7A1E5910E2BD25800010CB8 /* CacheFile.h */,
+				D7A1E5920E2BD25800010CB8 /* FreeImage.h */,
+				D7A1E5930E2BD25800010CB8 /* FreeImageIO.h */,
+				D7A1E5940E2BD25800010CB8 /* Plugin.h */,
+				D7A1E5950E2BD25800010CB8 /* Quantizers.h */,
+				D7A1E5960E2BD25800010CB8 /* ToneMapping.h */,
+				D7A1E5970E2BD25800010CB8 /* Utilities.h */,
+				D7A1E5AC0E2BD38A00010CB8 /* zutil.h */,
+				D7066B840E2BD03600ED8BBE /* BitmapAccess.cpp */,
+				D7066B860E2BD03600ED8BBE /* ColorLookup.cpp */,
+				D7066B900E2BD03600ED8BBE /* FreeImage.cpp */,
+				D7066B910E2BD03600ED8BBE /* FreeImageC.c */,
+				D7066B920E2BD03600ED8BBE /* FreeImageIO.cpp */,
+				D7066B930E2BD03600ED8BBE /* GetType.cpp */,
+				D7066B960E2BD03600ED8BBE /* MemoryIO.cpp */,
+				D7066B990E2BD03600ED8BBE /* PixelAccess.cpp */,
+			);
+			name = Source;
+			sourceTree = "<group>";
+		};
+		1AB674ADFE9D54B511CA2CBB /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				D2AAC046055464E500DB518D /* libFreeImage.a */,
+				D7F8812A0E2BD519007CA12F /* FreeImageTest */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		D7066BF40E2BD04E00ED8BBE /* DeprecationManager */ = {
+			isa = PBXGroup;
+			children = (
+				D7066BF50E2BD04E00ED8BBE /* DeprecationMgr.cpp */,
+				D7066BF60E2BD04E00ED8BBE /* DeprecationMgr.h */,
+			);
+			name = DeprecationManager;
+			path = Source/DeprecationManager;
+			sourceTree = SOURCE_ROOT;
+		};
+		D7066BF90E2BD07800ED8BBE /* Toolkit */ = {
+			isa = PBXGroup;
+			children = (
+				D7066BFA0E2BD07800ED8BBE /* BSplineRotate.cpp */,
+				D7066BFB0E2BD07800ED8BBE /* Channels.cpp */,
+				D7066BFC0E2BD07800ED8BBE /* ClassicRotate.cpp */,
+				D7066BFD0E2BD07800ED8BBE /* Colors.cpp */,
+				D7066BFE0E2BD07800ED8BBE /* CopyPaste.cpp */,
+				D7066BFF0E2BD07800ED8BBE /* Display.cpp */,
+				D7066C000E2BD07800ED8BBE /* Filters.h */,
+				D7066C010E2BD07800ED8BBE /* Flip.cpp */,
+				D7066C020E2BD07800ED8BBE /* JPEGTransform.cpp */,
+				D7066C030E2BD07800ED8BBE /* MultigridPoissonSolver.cpp */,
+				D7066C040E2BD07800ED8BBE /* Rescale.cpp */,
+				D7066C050E2BD07800ED8BBE /* Resize.cpp */,
+				D7066C060E2BD07800ED8BBE /* Resize.h */,
+			);
+			name = Toolkit;
+			path = Source/FreeImageToolkit;
+			sourceTree = SOURCE_ROOT;
+		};
+		D7066C070E2BD07800ED8BBE /* Metadata */ = {
+			isa = PBXGroup;
+			children = (
+				D7066C080E2BD07800ED8BBE /* Exif.cpp */,
+				D7066C090E2BD07800ED8BBE /* FIRational.cpp */,
+				D7066C0A0E2BD07800ED8BBE /* FIRational.h */,
+				D7066C0B0E2BD07800ED8BBE /* FreeImageTag.cpp */,
+				D7066C0C0E2BD07800ED8BBE /* FreeImageTag.h */,
+				D7066C0D0E2BD07800ED8BBE /* IPTC.cpp */,
+				D7066C0E0E2BD07800ED8BBE /* TagConversion.cpp */,
+				D7066C0F0E2BD07800ED8BBE /* TagLib.cpp */,
+				D7066C100E2BD07800ED8BBE /* XTIFF.cpp */,
+			);
+			name = Metadata;
+			path = Source/Metadata;
+			sourceTree = SOURCE_ROOT;
+		};
+		D7066C270E2BD08A00ED8BBE /* Plugins */ = {
+			isa = PBXGroup;
+			children = (
+				D76E028D10D06BA500F2706E /* PSDParser.cpp */,
+				D76E028E10D06BA500F2706E /* PSDParser.h */,
+				D706FA2B0EA41A3F00F3F6B1 /* TIFFLogLuv.cpp */,
+				D7066B950E2BD03600ED8BBE /* J2KHelper.cpp */,
+				D7066B9A0E2BD03600ED8BBE /* Plugin.cpp */,
+				D7066B9B0E2BD03600ED8BBE /* PluginBMP.cpp */,
+				D7066B9C0E2BD03600ED8BBE /* PluginCUT.cpp */,
+				D7066B9D0E2BD03600ED8BBE /* PluginDDS.cpp */,
+				D7066B9F0E2BD03600ED8BBE /* PluginG3.cpp */,
+				D7066BA00E2BD03600ED8BBE /* PluginGIF.cpp */,
+				D7066BA10E2BD03600ED8BBE /* PluginHDR.cpp */,
+				D7066BA20E2BD03600ED8BBE /* PluginICO.cpp */,
+				D7066BA30E2BD03600ED8BBE /* PluginIFF.cpp */,
+				D7066BA40E2BD03600ED8BBE /* PluginJ2K.cpp */,
+				D7066BA50E2BD03600ED8BBE /* PluginJP2.cpp */,
+				D7066BA60E2BD03600ED8BBE /* PluginJPEG.cpp */,
+				D7066BA70E2BD03600ED8BBE /* PluginKOALA.cpp */,
+				D7066BA80E2BD03600ED8BBE /* PluginMNG.cpp */,
+				D7066BA90E2BD03600ED8BBE /* PluginPCD.cpp */,
+				D7066BAA0E2BD03600ED8BBE /* PluginPCX.cpp */,
+				D7066BAB0E2BD03600ED8BBE /* PluginPNG.cpp */,
+				D7066BAC0E2BD03600ED8BBE /* PluginPNM.cpp */,
+				D7066BAD0E2BD03600ED8BBE /* PluginPSD.cpp */,
+				D7066BAE0E2BD03600ED8BBE /* PluginRAS.cpp */,
+				D7066BAF0E2BD03600ED8BBE /* PluginSGI.cpp */,
+				D7066BB00E2BD03600ED8BBE /* PluginTARGA.cpp */,
+				D7066BB10E2BD03600ED8BBE /* PluginTIFF.cpp */,
+				D7066BB20E2BD03600ED8BBE /* PluginWBMP.cpp */,
+				D7066BB30E2BD03600ED8BBE /* PluginXBM.cpp */,
+				D7066BB40E2BD03600ED8BBE /* PluginXPM.cpp */,
+			);
+			name = Plugins;
+			sourceTree = "<group>";
+		};
+		D7066C280E2BD0C100ED8BBE /* Conversion */ = {
+			isa = PBXGroup;
+			children = (
+				D7066B870E2BD03600ED8BBE /* Conversion.cpp */,
+				D7066B880E2BD03600ED8BBE /* Conversion4.cpp */,
+				D7066B890E2BD03600ED8BBE /* Conversion8.cpp */,
+				D7066B8A0E2BD03600ED8BBE /* Conversion16_555.cpp */,
+				D7066B8B0E2BD03600ED8BBE /* Conversion16_565.cpp */,
+				D7066B8C0E2BD03600ED8BBE /* Conversion24.cpp */,
+				D7066B8D0E2BD03600ED8BBE /* Conversion32.cpp */,
+				D7066B8E0E2BD03600ED8BBE /* ConversionRGBF.cpp */,
+				D7066B8F0E2BD03600ED8BBE /* ConversionType.cpp */,
+				D7066B940E2BD03600ED8BBE /* Halftoning.cpp */,
+				D7066BB50E2BD03600ED8BBE /* tmoColorConvert.cpp */,
+				D7066BB60E2BD03600ED8BBE /* tmoDrago03.cpp */,
+				D7066BB70E2BD03600ED8BBE /* tmoFattal02.cpp */,
+				D7066BB80E2BD03600ED8BBE /* tmoReinhard05.cpp */,
+				D7066BB90E2BD03600ED8BBE /* ToneMapping.cpp */,
+			);
+			name = Conversion;
+			sourceTree = "<group>";
+		};
+		D7066C290E2BD0FE00ED8BBE /* MultiPaging */ = {
+			isa = PBXGroup;
+			children = (
+				D7066B850E2BD03600ED8BBE /* CacheFile.cpp */,
+				D7066B970E2BD03600ED8BBE /* MultiPage.cpp */,
+				D7066BBB0E2BD03600ED8BBE /* ZLibInterface.cpp */,
+			);
+			name = MultiPaging;
+			sourceTree = "<group>";
+		};
+		D7066C2A0E2BD16600ED8BBE /* Quantizers */ = {
+			isa = PBXGroup;
+			children = (
+				D7066B980E2BD03600ED8BBE /* NNQuantizer.cpp */,
+				D7066BBA0E2BD03600ED8BBE /* WuQuantizer.cpp */,
+			);
+			name = Quantizers;
+			sourceTree = "<group>";
+		};
+		D7A5F2550E2BD40100DA164A /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				D7A5F25D0E2BD40100DA164A /* libjpeg.a */,
+				D7A5F25F0E2BD40100DA164A /* cjpeg */,
+				D7A5F2610E2BD40100DA164A /* djpeg */,
+				D7A5F2630E2BD40100DA164A /* jpegtran */,
+				D7A5F2650E2BD40100DA164A /* tests */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		D7A5F26C0E2BD41300DA164A /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				D7A5F2700E2BD41300DA164A /* libmng.a */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		D7A5F2770E2BD43200DA164A /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				D7A5F27B0E2BD43200DA164A /* libopenjpeg.a */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		D7A5F2830E2BD44100DA164A /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				D7A5F2880E2BD44100DA164A /* libpng.a */,
+				D7A5F28A0E2BD44100DA164A /* pngtest */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		D7A5F2910E2BD44F00DA164A /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				D7A5F2950E2BD44F00DA164A /* libtiff.a */,
+			);
+			name = Products;
+			sourceTree = "<group>";
+		};
+		D7F881240E2BD4E2007CA12F /* Source (test only) */ = {
+			isa = PBXGroup;
+			children = (
+				D7F8815B0E2BD677007CA12F /* Carbon.framework */,
+				D7F881310E2BD55D007CA12F /* testMemIO.cpp */,
+				D7F881320E2BD55D007CA12F /* testJPEG.cpp */,
+				D7F881330E2BD55D007CA12F /* testMPage.cpp */,
+				D7F881340E2BD55D007CA12F /* MainTestSuite.cpp */,
+				D7F881350E2BD55D007CA12F /* TestSuite.h */,
+				D7F881360E2BD55D007CA12F /* testPlugins.cpp */,
+				D7F881370E2BD55D007CA12F /* testImageType.cpp */,
+				D7F881380E2BD55D007CA12F /* testTools.cpp */,
+			);
+			name = "Source (test only)";
+			sourceTree = "<group>";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+		D2AAC043055464E500DB518D /* Headers */ = {
+			isa = PBXHeadersBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				D7066BF80E2BD04E00ED8BBE /* DeprecationMgr.h in Headers */,
+				D7066C170E2BD07800ED8BBE /* Filters.h in Headers */,
+				D7066C1D0E2BD07800ED8BBE /* Resize.h in Headers */,
+				D7066C200E2BD07800ED8BBE /* FIRational.h in Headers */,
+				D7066C220E2BD07800ED8BBE /* FreeImageTag.h in Headers */,
+				D7A1E5980E2BD25800010CB8 /* CacheFile.h in Headers */,
+				D7A1E5990E2BD25800010CB8 /* FreeImage.h in Headers */,
+				D7A1E59A0E2BD25800010CB8 /* FreeImageIO.h in Headers */,
+				D7A1E59B0E2BD25800010CB8 /* Plugin.h in Headers */,
+				D7A1E59C0E2BD25800010CB8 /* Quantizers.h in Headers */,
+				D7A1E59D0E2BD25800010CB8 /* ToneMapping.h in Headers */,
+				D7A1E59E0E2BD25800010CB8 /* Utilities.h in Headers */,
+				D7A1E5AD0E2BD38A00010CB8 /* zutil.h in Headers */,
+				D76E029010D06BA500F2706E /* PSDParser.h in Headers */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+		D2AAC045055464E500DB518D /* FreeImage */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = 1DEB91EB08733DB70010E9CD /* Build configuration list for PBXNativeTarget "FreeImage" */;
+			buildPhases = (
+				D2AAC043055464E500DB518D /* Headers */,
+				D2AAC044055464E500DB518D /* Sources */,
+				D289987405E68DCB004EDB86 /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				D7A5F29C0E2BD47200DA164A /* PBXTargetDependency */,
+				D7A5F29E0E2BD47200DA164A /* PBXTargetDependency */,
+				D7A5F2A00E2BD47200DA164A /* PBXTargetDependency */,
+				D7A5F2A20E2BD47200DA164A /* PBXTargetDependency */,
+				D7A5F2A40E2BD47200DA164A /* PBXTargetDependency */,
+			);
+			name = FreeImage;
+			productName = FreeImage;
+			productReference = D2AAC046055464E500DB518D /* libFreeImage.a */;
+			productType = "com.apple.product-type.library.static";
+		};
+		D7F881290E2BD519007CA12F /* FreeImageTest */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = D7F881300E2BD527007CA12F /* Build configuration list for PBXNativeTarget "FreeImageTest" */;
+			buildPhases = (
+				D7F881270E2BD519007CA12F /* Sources */,
+				D7F881280E2BD519007CA12F /* Frameworks */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+				D7F881420E2BD57F007CA12F /* PBXTargetDependency */,
+			);
+			name = FreeImageTest;
+			productName = FreeImageTest;
+			productReference = D7F8812A0E2BD519007CA12F /* FreeImageTest */;
+			productType = "com.apple.product-type.tool";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		08FB7793FE84155DC02AAC07 /* Project object */ = {
+			isa = PBXProject;
+			buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "FreeImage" */;
+			compatibilityVersion = "Xcode 3.1";
+			developmentRegion = English;
+			hasScannedForEncodings = 1;
+			knownRegions = (
+				English,
+				Japanese,
+				French,
+				German,
+			);
+			mainGroup = 08FB7794FE84155DC02AAC07 /* FreeImage */;
+			projectDirPath = "";
+			projectReferences = (
+				{
+					ProductGroup = D7A5F2550E2BD40100DA164A /* Products */;
+					ProjectRef = D7A5F24B0E2BD40100DA164A /* libjpeg.xcodeproj */;
+				},
+				{
+					ProductGroup = D7A5F26C0E2BD41300DA164A /* Products */;
+					ProjectRef = D7A5F2660E2BD41300DA164A /* libmng.xcodeproj */;
+				},
+				{
+					ProductGroup = D7A5F2770E2BD43200DA164A /* Products */;
+					ProjectRef = D7A5F2710E2BD43200DA164A /* libopenjpeg.xcodeproj */;
+				},
+				{
+					ProductGroup = D7A5F2830E2BD44100DA164A /* Products */;
+					ProjectRef = D7A5F27C0E2BD44100DA164A /* libpng.xcodeproj */;
+				},
+				{
+					ProductGroup = D7A5F2910E2BD44F00DA164A /* Products */;
+					ProjectRef = D7A5F28B0E2BD44F00DA164A /* libtiff.xcodeproj */;
+				},
+			);
+			projectRoot = "";
+			targets = (
+				D2AAC045055464E500DB518D /* FreeImage */,
+				D7F881290E2BD519007CA12F /* FreeImageTest */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXReferenceProxy section */
+		D7A5F25D0E2BD40100DA164A /* libjpeg.a */ = {
+			isa = PBXReferenceProxy;
+			fileType = archive.ar;
+			path = libjpeg.a;
+			remoteRef = D7A5F25C0E2BD40100DA164A /* PBXContainerItemProxy */;
+			sourceTree = BUILT_PRODUCTS_DIR;
+		};
+		D7A5F25F0E2BD40100DA164A /* cjpeg */ = {
+			isa = PBXReferenceProxy;
+			fileType = "compiled.mach-o.executable";
+			path = cjpeg;
+			remoteRef = D7A5F25E0E2BD40100DA164A /* PBXContainerItemProxy */;
+			sourceTree = BUILT_PRODUCTS_DIR;
+		};
+		D7A5F2610E2BD40100DA164A /* djpeg */ = {
+			isa = PBXReferenceProxy;
+			fileType = "compiled.mach-o.executable";
+			path = djpeg;
+			remoteRef = D7A5F2600E2BD40100DA164A /* PBXContainerItemProxy */;
+			sourceTree = BUILT_PRODUCTS_DIR;
+		};
+		D7A5F2630E2BD40100DA164A /* jpegtran */ = {
+			isa = PBXReferenceProxy;
+			fileType = "compiled.mach-o.executable";
+			path = jpegtran;
+			remoteRef = D7A5F2620E2BD40100DA164A /* PBXContainerItemProxy */;
+			sourceTree = BUILT_PRODUCTS_DIR;
+		};
+		D7A5F2650E2BD40100DA164A /* tests */ = {
+			isa = PBXReferenceProxy;
+			fileType = "compiled.mach-o.executable";
+			path = tests;
+			remoteRef = D7A5F2640E2BD40100DA164A /* PBXContainerItemProxy */;
+			sourceTree = BUILT_PRODUCTS_DIR;
+		};
+		D7A5F2700E2BD41300DA164A /* libmng.a */ = {
+			isa = PBXReferenceProxy;
+			fileType = archive.ar;
+			path = libmng.a;
+			remoteRef = D7A5F26F0E2BD41300DA164A /* PBXContainerItemProxy */;
+			sourceTree = BUILT_PRODUCTS_DIR;
+		};
+		D7A5F27B0E2BD43200DA164A /* libopenjpeg.a */ = {
+			isa = PBXReferenceProxy;
+			fileType = archive.ar;
+			path = libopenjpeg.a;
+			remoteRef = D7A5F27A0E2BD43200DA164A /* PBXContainerItemProxy */;
+			sourceTree = BUILT_PRODUCTS_DIR;
+		};
+		D7A5F2880E2BD44100DA164A /* libpng.a */ = {
+			isa = PBXReferenceProxy;
+			fileType = archive.ar;
+			path = libpng.a;
+			remoteRef = D7A5F2870E2BD44100DA164A /* PBXContainerItemProxy */;
+			sourceTree = BUILT_PRODUCTS_DIR;
+		};
+		D7A5F28A0E2BD44100DA164A /* pngtest */ = {
+			isa = PBXReferenceProxy;
+			fileType = "compiled.mach-o.executable";
+			path = pngtest;
+			remoteRef = D7A5F2890E2BD44100DA164A /* PBXContainerItemProxy */;
+			sourceTree = BUILT_PRODUCTS_DIR;
+		};
+		D7A5F2950E2BD44F00DA164A /* libtiff.a */ = {
+			isa = PBXReferenceProxy;
+			fileType = archive.ar;
+			path = libtiff.a;
+			remoteRef = D7A5F2940E2BD44F00DA164A /* PBXContainerItemProxy */;
+			sourceTree = BUILT_PRODUCTS_DIR;
+		};
+/* End PBXReferenceProxy section */
+
+/* Begin PBXSourcesBuildPhase section */
+		D2AAC044055464E500DB518D /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				D7066BBC0E2BD03600ED8BBE /* BitmapAccess.cpp in Sources */,
+				D7066BBD0E2BD03600ED8BBE /* CacheFile.cpp in Sources */,
+				D7066BBE0E2BD03600ED8BBE /* ColorLookup.cpp in Sources */,
+				D7066BBF0E2BD03600ED8BBE /* Conversion.cpp in Sources */,
+				D7066BC00E2BD03600ED8BBE /* Conversion4.cpp in Sources */,
+				D7066BC10E2BD03600ED8BBE /* Conversion8.cpp in Sources */,
+				D7066BC20E2BD03600ED8BBE /* Conversion16_555.cpp in Sources */,
+				D7066BC30E2BD03600ED8BBE /* Conversion16_565.cpp in Sources */,
+				D7066BC40E2BD03600ED8BBE /* Conversion24.cpp in Sources */,
+				D7066BC50E2BD03600ED8BBE /* Conversion32.cpp in Sources */,
+				D7066BC60E2BD03600ED8BBE /* ConversionRGBF.cpp in Sources */,
+				D7066BC70E2BD03600ED8BBE /* ConversionType.cpp in Sources */,
+				D7066BC80E2BD03600ED8BBE /* FreeImage.cpp in Sources */,
+				D7066BC90E2BD03600ED8BBE /* FreeImageC.c in Sources */,
+				D7066BCA0E2BD03600ED8BBE /* FreeImageIO.cpp in Sources */,
+				D7066BCB0E2BD03600ED8BBE /* GetType.cpp in Sources */,
+				D7066BCC0E2BD03600ED8BBE /* Halftoning.cpp in Sources */,
+				D7066BCD0E2BD03600ED8BBE /* J2KHelper.cpp in Sources */,
+				D7066BCE0E2BD03600ED8BBE /* MemoryIO.cpp in Sources */,
+				D7066BCF0E2BD03600ED8BBE /* MultiPage.cpp in Sources */,
+				D7066BD00E2BD03600ED8BBE /* NNQuantizer.cpp in Sources */,
+				D7066BD10E2BD03600ED8BBE /* PixelAccess.cpp in Sources */,
+				D7066BD20E2BD03600ED8BBE /* Plugin.cpp in Sources */,
+				D7066BD30E2BD03600ED8BBE /* PluginBMP.cpp in Sources */,
+				D7066BD40E2BD03600ED8BBE /* PluginCUT.cpp in Sources */,
+				D7066BD50E2BD03600ED8BBE /* PluginDDS.cpp in Sources */,
+				D7066BD70E2BD03600ED8BBE /* PluginG3.cpp in Sources */,
+				D7066BD80E2BD03600ED8BBE /* PluginGIF.cpp in Sources */,
+				D7066BD90E2BD03600ED8BBE /* PluginHDR.cpp in Sources */,
+				D7066BDA0E2BD03600ED8BBE /* PluginICO.cpp in Sources */,
+				D7066BDB0E2BD03600ED8BBE /* PluginIFF.cpp in Sources */,
+				D7066BDC0E2BD03600ED8BBE /* PluginJ2K.cpp in Sources */,
+				D7066BDD0E2BD03600ED8BBE /* PluginJP2.cpp in Sources */,
+				D7066BDE0E2BD03600ED8BBE /* PluginJPEG.cpp in Sources */,
+				D7066BDF0E2BD03600ED8BBE /* PluginKOALA.cpp in Sources */,
+				D7066BE00E2BD03600ED8BBE /* PluginMNG.cpp in Sources */,
+				D7066BE10E2BD03600ED8BBE /* PluginPCD.cpp in Sources */,
+				D7066BE20E2BD03600ED8BBE /* PluginPCX.cpp in Sources */,
+				D7066BE30E2BD03600ED8BBE /* PluginPNG.cpp in Sources */,
+				D7066BE40E2BD03600ED8BBE /* PluginPNM.cpp in Sources */,
+				D7066BE50E2BD03600ED8BBE /* PluginPSD.cpp in Sources */,
+				D7066BE60E2BD03600ED8BBE /* PluginRAS.cpp in Sources */,
+				D7066BE70E2BD03600ED8BBE /* PluginSGI.cpp in Sources */,
+				D7066BE80E2BD03600ED8BBE /* PluginTARGA.cpp in Sources */,
+				D7066BE90E2BD03600ED8BBE /* PluginTIFF.cpp in Sources */,
+				D7066BEA0E2BD03600ED8BBE /* PluginWBMP.cpp in Sources */,
+				D7066BEB0E2BD03600ED8BBE /* PluginXBM.cpp in Sources */,
+				D7066BEC0E2BD03600ED8BBE /* PluginXPM.cpp in Sources */,
+				D7066BED0E2BD03600ED8BBE /* tmoColorConvert.cpp in Sources */,
+				D7066BEE0E2BD03600ED8BBE /* tmoDrago03.cpp in Sources */,
+				D7066BEF0E2BD03600ED8BBE /* tmoFattal02.cpp in Sources */,
+				D7066BF00E2BD03600ED8BBE /* tmoReinhard05.cpp in Sources */,
+				D7066BF10E2BD03600ED8BBE /* ToneMapping.cpp in Sources */,
+				D7066BF20E2BD03600ED8BBE /* WuQuantizer.cpp in Sources */,
+				D7066BF30E2BD03600ED8BBE /* ZLibInterface.cpp in Sources */,
+				D7066BF70E2BD04E00ED8BBE /* DeprecationMgr.cpp in Sources */,
+				D7066C110E2BD07800ED8BBE /* BSplineRotate.cpp in Sources */,
+				D7066C120E2BD07800ED8BBE /* Channels.cpp in Sources */,
+				D7066C130E2BD07800ED8BBE /* ClassicRotate.cpp in Sources */,
+				D7066C140E2BD07800ED8BBE /* Colors.cpp in Sources */,
+				D7066C150E2BD07800ED8BBE /* CopyPaste.cpp in Sources */,
+				D7066C160E2BD07800ED8BBE /* Display.cpp in Sources */,
+				D7066C180E2BD07800ED8BBE /* Flip.cpp in Sources */,
+				D7066C190E2BD07800ED8BBE /* JPEGTransform.cpp in Sources */,
+				D7066C1A0E2BD07800ED8BBE /* MultigridPoissonSolver.cpp in Sources */,
+				D7066C1B0E2BD07800ED8BBE /* Rescale.cpp in Sources */,
+				D7066C1C0E2BD07800ED8BBE /* Resize.cpp in Sources */,
+				D7066C1E0E2BD07800ED8BBE /* Exif.cpp in Sources */,
+				D7066C1F0E2BD07800ED8BBE /* FIRational.cpp in Sources */,
+				D7066C210E2BD07800ED8BBE /* FreeImageTag.cpp in Sources */,
+				D7066C230E2BD07800ED8BBE /* IPTC.cpp in Sources */,
+				D7066C240E2BD07800ED8BBE /* TagConversion.cpp in Sources */,
+				D7066C250E2BD07800ED8BBE /* TagLib.cpp in Sources */,
+				D7066C260E2BD07800ED8BBE /* XTIFF.cpp in Sources */,
+				D706FA2C0EA41A3F00F3F6B1 /* TIFFLogLuv.cpp in Sources */,
+				D76E028F10D06BA500F2706E /* PSDParser.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		D7F881270E2BD519007CA12F /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				D7F881390E2BD55D007CA12F /* testMemIO.cpp in Sources */,
+				D7F8813A0E2BD55D007CA12F /* testJPEG.cpp in Sources */,
+				D7F8813B0E2BD55D007CA12F /* testMPage.cpp in Sources */,
+				D7F8813C0E2BD55D007CA12F /* MainTestSuite.cpp in Sources */,
+				D7F8813D0E2BD55D007CA12F /* testPlugins.cpp in Sources */,
+				D7F8813E0E2BD55D007CA12F /* testImageType.cpp in Sources */,
+				D7F8813F0E2BD55D007CA12F /* testTools.cpp in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+		D7A5F29C0E2BD47200DA164A /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			name = libjpeg;
+			targetProxy = D7A5F29B0E2BD47200DA164A /* PBXContainerItemProxy */;
+		};
+		D7A5F29E0E2BD47200DA164A /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			name = libpng;
+			targetProxy = D7A5F29D0E2BD47200DA164A /* PBXContainerItemProxy */;
+		};
+		D7A5F2A00E2BD47200DA164A /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			name = libopenjpeg;
+			targetProxy = D7A5F29F0E2BD47200DA164A /* PBXContainerItemProxy */;
+		};
+		D7A5F2A20E2BD47200DA164A /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			name = libmng;
+			targetProxy = D7A5F2A10E2BD47200DA164A /* PBXContainerItemProxy */;
+		};
+		D7A5F2A40E2BD47200DA164A /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			name = libtiff;
+			targetProxy = D7A5F2A30E2BD47200DA164A /* PBXContainerItemProxy */;
+		};
+		D7F881420E2BD57F007CA12F /* PBXTargetDependency */ = {
+			isa = PBXTargetDependency;
+			target = D2AAC045055464E500DB518D /* FreeImage */;
+			targetProxy = D7F881410E2BD57F007CA12F /* PBXContainerItemProxy */;
+		};
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+		1DEB91EC08733DB70010E9CD /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				PRODUCT_NAME = FreeImage;
+			};
+			name = Debug;
+		};
+		1DEB91ED08733DB70010E9CD /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				PRODUCT_NAME = FreeImage;
+			};
+			name = Release;
+		};
+		1DEB91F008733DB70010E9CD /* Debug */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = D7EFF2FF0E2BCDF800C97412 /* MacConfigExternalDebug.xcconfig */;
+			buildSettings = {
+			};
+			name = Debug;
+		};
+		1DEB91F108733DB70010E9CD /* Release */ = {
+			isa = XCBuildConfiguration;
+			baseConfigurationReference = D7EFF2FE0E2BCDF800C97412 /* MacConfigExternalRelease.xcconfig */;
+			buildSettings = {
+			};
+			name = Release;
+		};
+		D7F8812C0E2BD51A007CA12F /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = NO;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_ENABLE_FIX_AND_CONTINUE = YES;
+				GCC_MODEL_TUNING = G5;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				INSTALL_PATH = /usr/local/bin;
+				PREBINDING = NO;
+				PRODUCT_NAME = FreeImageTest;
+			};
+			name = Debug;
+		};
+		D7F8812D0E2BD51A007CA12F /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				COPY_PHASE_STRIP = YES;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				GCC_ENABLE_FIX_AND_CONTINUE = NO;
+				GCC_MODEL_TUNING = G5;
+				INSTALL_PATH = /usr/local/bin;
+				PREBINDING = NO;
+				PRODUCT_NAME = FreeImageTest;
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		1DEB91EB08733DB70010E9CD /* Build configuration list for PBXNativeTarget "FreeImage" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				1DEB91EC08733DB70010E9CD /* Debug */,
+				1DEB91ED08733DB70010E9CD /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "FreeImage" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				1DEB91F008733DB70010E9CD /* Debug */,
+				1DEB91F108733DB70010E9CD /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		D7F881300E2BD527007CA12F /* Build configuration list for PBXNativeTarget "FreeImageTest" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				D7F8812C0E2BD51A007CA12F /* Debug */,
+				D7F8812D0E2BD51A007CA12F /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
+}
diff --git a/FreeImage3130.pdf b/FreeImage3130.pdf
new file mode 100644
index 0000000..23657ca
--- /dev/null
+++ b/FreeImage3130.pdf
Binary files differ
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..4e11423
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,34 @@
+# Entry point for FreeImage makefiles
+# Default to 'make -f Makefile.gnu' for Linux and for unknown OS. 
+#
+OS = $(shell uname)
+MAKEFILE = gnu
+
+ifeq ($(OS), Darwin)
+    MAKEFILE = osx
+endif
+ifeq ($(OS), Cygwin)
+    MAKEFILE = cygwin
+endif
+ifeq ($(OS), Solaris)
+    MAKEFILE = solaris
+endif
+ifeq ($(OS), windows32)
+    MAKEFILE = mingw
+endif
+
+default:
+	$(MAKE) -f Makefile.$(MAKEFILE) 
+
+all:
+	$(MAKE) -f Makefile.$(MAKEFILE) all 
+
+dist:
+	$(MAKE) -f Makefile.$(MAKEFILE) dist 
+
+install:
+	$(MAKE) -f Makefile.$(MAKEFILE) install 
+
+clean:
+	$(MAKE) -f Makefile.$(MAKEFILE) clean 
+
diff --git a/Makefile.cygwin b/Makefile.cygwin
new file mode 100644
index 0000000..124f612
--- /dev/null
+++ b/Makefile.cygwin
@@ -0,0 +1,73 @@
+# Cygwin makefile for FreeImage

+

+# This file can be generated by ./gensrclist.sh

+include Makefile.srcs

+

+# General configuration variables:

+CC = gcc

+CXX = g++

+AR = ar

+

+INSTALLDIR = /usr

+

+# Converts cr/lf to just lf

+DOS2UNIX = dos2unix

+

+COMPILERFLAGS = -O3 -DNO_LCMS

+LIBRARIES = -lstdc++

+

+MODULES = $(SRCS:.c=.o)

+MODULES := $(MODULES:.cpp=.o)

+CFLAGS = $(COMPILERFLAGS) $(INCLUDE)

+CXXFLAGS = $(COMPILERFLAGS)  -Wno-ctor-dtor-privacy $(INCLUDE)

+

+TARGET  = freeimage

+STATICLIB = lib$(TARGET).a

+SHAREDLIB = cyg$(TARGET)-$(VER_MAJOR).$(VER_MINOR).dll

+LIBNAME = lib$(TARGET).dll.a

+HEADER = Source/FreeImage.h

+

+

+default: all

+

+all: dist

+

+dist: FreeImage

+	cp *.a Dist

+	cp *.dll Dist

+	cp *.dll.a Dist

+	cp $(HEADER) Dist

+

+dos2unix:

+	@$(DOS2UNIX) $(SRCS) $(INCLS)

+

+FreeImage: $(STATICLIB) $(SHAREDLIB)

+

+.c.o:

+	$(CC) $(CFLAGS) -c $< -o $@

+

+.cpp.o:

+	$(CXX) $(CXXFLAGS) -c $< -o $@

+

+$(STATICLIB): $(MODULES)

+	$(AR) r $@ $(MODULES)

+

+$(SHAREDLIB): $(MODULES)

+	$(CC) -s -shared -o $@ \

+	    -Wl,--out-implib=$(LIBNAME) \

+	    -Wl,--export-all-symbols \

+	    -Wl,--enable-auto-import \

+	    -Wl,--enable-auto-image-base \

+	    -Wl,--whole-archive $(STATICLIB) \

+	    -Wl,--no-whole-archive $(LIBRARIES)

+

+

+install:

+	install -m 644 $(STATICLIB) $(INSTALLDIR)/lib

+	install -m 644 $(LIBNAME) $(INSTALLDIR)/lib

+	install -m 755 $(SHAREDLIB) $(INSTALLDIR)/bin

+	install -m 644 $(HEADER) $(INSTALLDIR)/include

+

+clean:

+	rm -f core Dist/*.* u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)

+

diff --git a/Makefile.fip b/Makefile.fip
new file mode 100644
index 0000000..216ea55
--- /dev/null
+++ b/Makefile.fip
@@ -0,0 +1,73 @@
+# Linux makefile for FreeImagePlus

+

+# This file can be generated by ./genfipsrclist.sh

+include fipMakefile.srcs

+

+# General configuration variables:

+DESTDIR ?= /

+INCDIR ?= $(DESTDIR)/usr/include

+INSTALLDIR ?= $(DESTDIR)/usr/lib

+

+# Converts cr/lf to just lf

+DOS2UNIX = dos2unix

+

+LIBRARIES = -lstdc++

+

+MODULES = $(SRCS:.c=.o)

+MODULES := $(MODULES:.cpp=.o)

+CFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden -DNO_LCMS

+CFLAGS += $(INCLUDE)

+CXXFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden -Wno-ctor-dtor-privacy

+CXXFLAGS += $(INCLUDE)

+

+ifeq ($(shell sh -c 'uname -m 2>/dev/null || echo not'),x86_64)

+	CFLAGS += -fPIC

+	CXXFLAGS += -fPIC

+endif

+

+TARGET  = freeimageplus

+STATICLIB = lib$(TARGET).a

+SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).so

+LIBNAME	= lib$(TARGET).so

+VERLIBNAME = $(LIBNAME).$(VER_MAJOR)

+HEADER = Source/FreeImage.h

+HEADERFIP = Wrapper/FreeImagePlus/FreeImagePlus.h

+

+

+default: all

+

+all: dist

+

+dist: FreeImage

+	cp *.a Dist

+	cp *.so Dist

+	cp Source/FreeImage.h Dist

+	cp Wrapper/FreeImagePlus/FreeImagePlus.h Dist

+

+dos2unix:

+	@$(DOS2UNIX) $(SRCS)

+

+FreeImage: $(STATICLIB) $(SHAREDLIB)

+

+.c.o:

+	$(CC) $(CFLAGS) -c $< -o $@

+

+.cpp.o:

+	$(CXX) $(CXXFLAGS) -c $< -o $@

+

+$(STATICLIB): $(MODULES)

+	$(AR) r $@ $(MODULES)

+

+$(SHAREDLIB): $(MODULES)

+	$(CC) -shared -Wl,-soname,$(VERLIBNAME) $(LDFLAGS) -o $@ $(MODULES) $(LIBRARIES)

+

+install:

+	install -d $(INCDIR) $(INSTALLDIR)

+	install -m 644 -o root -g root $(HEADER) $(INCDIR)

+	install -m 644 -o root -g root $(HEADERFIP) $(INCDIR)

+	install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)

+	install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)

+

+clean:

+	rm -f core Dist/*.* u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)

+

diff --git a/Makefile.gnu b/Makefile.gnu
new file mode 100644
index 0000000..3a13339
--- /dev/null
+++ b/Makefile.gnu
@@ -0,0 +1,65 @@
+# Linux makefile for FreeImage

+

+# This file can be generated by ./gensrclist.sh

+include Makefile.srcs

+

+# General configuration variables:

+DESTDIR ?= /

+INCDIR ?= $(DESTDIR)/usr/include

+INSTALLDIR ?= $(DESTDIR)/usr/lib

+

+# Converts cr/lf to just lf

+DOS2UNIX = dos2unix

+

+LIBRARIES = -lstdc++

+

+MODULES = $(SRCS:.c=.o)

+MODULES := $(MODULES:.cpp=.o)

+CFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden -DNO_LCMS -m32

+CFLAGS += $(INCLUDE)

+CXXFLAGS ?= -O3 -fPIC -fexceptions -fvisibility=hidden -Wno-ctor-dtor-privacy -m32

+CXXFLAGS += $(INCLUDE)

+

+#ifeq ($(shell sh -c 'uname -m 2>/dev/null || echo not'),x86_64)

+	#CFLAGS += -fPIC

+	#CXXFLAGS += -fPIC

+#endif

+

+TARGET  = freeimage

+STATICLIB = lib$(TARGET).a

+VERLIBNAME = $(LIBNAME).$(VER_MAJOR)

+HEADER = Source/FreeImage.h

+

+

+

+default: all

+

+all: dist

+

+dist: FreeImage

+	cp *.a Dist

+	cp Source/FreeImage.h Dist

+

+dos2unix:

+	@$(DOS2UNIX) $(SRCS) $(INCLS)

+

+FreeImage: $(STATICLIB)

+

+.c.o:

+	$(CC) $(CFLAGS) -c $< -o $@

+

+.cpp.o:

+	$(CXX) $(CXXFLAGS) -c $< -o $@

+

+$(STATICLIB): $(MODULES)

+	$(AR) r $@ $(MODULES)

+

+install:

+	install -d $(INCDIR) $(INSTALLDIR)

+	install -m 644 -o root -g root $(HEADER) $(INCDIR)

+	install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)

+	install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)

+

+clean:

+	rm -f core Dist/*.* u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)

+

diff --git a/Makefile.mingw b/Makefile.mingw
new file mode 100644
index 0000000..576ecad
--- /dev/null
+++ b/Makefile.mingw
@@ -0,0 +1,123 @@
+# MinGW makefile for FreeImage

+

+# This file can be generated by ./gensrclist.sh

+include Makefile.srcs

+

+# General configuration variables:

+DESTDIR ?= $(SystemRoot)

+INSTALLDIR ?= $(DESTDIR)/system32

+DISTDIR ?= Dist

+SRCDIR ?= Source

+HEADER = FreeImage.h

+RCFILE = FreeImage.rc

+

+# Uncomment this variable to make a static library. This may

+# also be specified as an environment variable and can hold

+# any of STATIC and SHARED and must be in uppercase letters.

+# Default: SHARED

+#FREEIMAGE_LIBRARY_TYPE = STATIC

+

+# Redefine the compiler (CC defaults to ´cc´ for MinGW's make, however

+# there's only ´gcc´ available with MinGW)

+CC = gcc

+

+# Redefine the linker (we use ´g++´ for linking, since MinGW's ´ld´ comes with

+# wrong (Linux) standard library search paths)

+LD = g++

+

+#Define the dlltool

+DLLTOOL = dlltool

+

+#Define the resource compiler

+RC = windres

+

+# Define the copy command

+CP = cp

+

+# Define the mkdir command

+MD = mkdir

+

+# Define additional libraries needed:

+# libstdc++ is included by default with MinGW, however for

+# WIN32 based builds, LibRawLite needs the winsock libraries.

+LIBRARIES = -lwsock32 -lws2_32

+

+# Define some additional symboles only needed for WIN32 based builds:

+WIN32_CFLAGS = $(LIB_TYPE_FLAGS) -DOPJ_STATIC

+WIN32_CXXFLAGS = $(WIN32_CFLAGS) -DLIBRAW_NODLL -DLIBRAW_LIBRARY_BUILD

+

+WIN32_STATIC_FLAGS = -DFREEIMAGE_LIB

+WIN32_SHARED_FLAGS = -DFREEIMAGE_EXPORTS

+

+MODULES = $(SRCS:.c=.o)

+MODULES := $(MODULES:.cpp=.o)

+RESOURCE = $(RCFILE:.rc=.coff)

+CFLAGS ?= -O3 -fexceptions -DNDEBUG $(WIN32_CFLAGS)

+CFLAGS += $(INCLUDE)

+CXXFLAGS ?= -O3 -fexceptions -Wno-ctor-dtor-privacy -DNDEBUG $(WIN32_CXXFLAGS) -DNO_LCMS

+CXXFLAGS += $(INCLUDE)

+RCFLAGS ?= -DNDEBUG

+LDFLAGS = -s -shared -static -Wl,-soname,$(SOLIBNAME)

+DLLTOOLFLAGS = --add-stdcall-underscore

+

+TARGET = FreeImage

+STATICLIB = $(TARGET).a

+SHAREDLIB = $(TARGET).dll

+IMPORTLIB = $(TARGET).lib

+EXPORTLIB = $(TARGET).exp

+SOLIBNAME = $(SHAREDLIB).$(VER_MAJOR)

+

+DISTSHARED = $(addprefix $(DISTDIR)/, $(SHAREDLIB) $(IMPORTLIB) $(HEADER))

+DISTSTATIC = $(addprefix $(DISTDIR)/, $(STATICLIB) $(HEADER))

+

+# The FreeImage library type defaults to SHARED

+FREEIMAGE_LIBRARY_TYPE ?= SHARED

+

+TARGETLIB = $($(FREEIMAGE_LIBRARY_TYPE)LIB)

+TARGETDIST = $(DIST$(FREEIMAGE_LIBRARY_TYPE))

+LIB_TYPE_FLAGS = $(WIN32_$(FREEIMAGE_LIBRARY_TYPE)_FLAGS)

+

+default: all

+

+all: mkdist

+

+rebuild: clean all

+

+mkdist: FreeImage $(TARGETDIST)

+

+FreeImage: $(TARGETLIB)

+

+%.o: %.c

+	$(CC) $(CFLAGS) -c $< -o $@

+

+%.o: %.cpp

+	$(CXX) $(CXXFLAGS) -c $< -o $@

+

+%.coff: %.rc

+	$(RC) $(RCFLAGS) -o $@ $<

+

+$(DISTDIR)/%: %

+	$(CP) $< $@

+

+$(DISTDIR)/%: $(SRCDIR)/%

+	$(CP) $< $@

+

+$(STATICLIB): $(MODULES)

+	$(AR) rs $@ $(MODULES)

+

+$(IMPORTLIB) $(EXPORTLIB): $(MODULES) 

+	$(DLLTOOL) -e $(EXPORTLIB) -l $(IMPORTLIB) -D $(SHAREDLIB) $(DLLTOOLFLAGS) $(MODULES)

+

+$(SHAREDLIB): $(EXPORTLIB) $(RESOURCE)

+	$(LD) $(LDFLAGS) -o $@ $(EXPORTLIB) $(MODULES) $(RESOURCE) $(LIBRARIES)

+

+$(DISTDIR):

+	$(MD) $(DISTDIR)

+

+$(TARGETDIST): $(DISTDIR)

+

+install:

+	$(CP) $(SHAREDLIB) $(INSTALLDIR)

+

+clean:

+	$(RM) core $(DISTDIR)/*.* $(MODULES) $(RESOURCE) $(STATICLIB) $(SHAREDLIB) $(IMPORTLIB) $(EXPORTLIB)

diff --git a/Makefile.osx b/Makefile.osx
new file mode 100644
index 0000000..369d977
--- /dev/null
+++ b/Makefile.osx
@@ -0,0 +1,93 @@
+# -*- Makefile -*-

+# Mac OSX makefile for FreeImage

+

+# This file can be generated by ./gensrclist.sh

+include Makefile.srcs

+

+# General configuration variables:

+CC_PPC = gcc-4.0

+CC_I386 = gcc-4.0

+CPP_PPC = g++-4.0

+CPP_I386 = g++-4.0

+COMPILERFLAGS = -Os -fexceptions -fvisibility=hidden -DNO_LCMS

+COMPILERFLAGS_PPC = -arch ppc

+COMPILERFLAGS_I386 = -arch i386

+COMPILERPPFLAGS = -Wno-ctor-dtor-privacy

+INCLUDE += 

+INCLUDE_PPC = -isysroot /Developer/SDKs/MacOSX10.3.9.sdk

+INCLUDE_I386 = -isysroot /Developer/SDKs/MacOSX10.4u.sdk

+CFLAGS_PPC = $(COMPILERFLAGS) $(COMPILERFLAGS_PPC) $(INCLUDE) $(INCLUDE_PPC)

+CFLAGS_I386 = $(COMPILERFLAGS) $(COMPILERFLAGS_I386) $(INCLUDE) $(INCLUDE_I386)

+CPPFLAGS_PPC = $(COMPILERPPFLAGS) $(CFLAGS_PPC)

+CPPFLAGS_I386 = $(COMPILERPPFLAGS) $(CFLAGS_I386)

+LIBRARIES_PPC = -Wl

+LIBRARIES_I386 = -Wl

+LIBTOOL = libtool

+LIPO = lipo

+

+TARGET = freeimage

+STATICLIB = lib$(TARGET).a

+SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).dylib

+LIBNAME = lib$(TARGET).$(VER_MAJOR).dylib

+HEADER = Source/FreeImage.h

+

+.SUFFIXES: .o-ppc .o-i386

+MODULES_PPC = $(SRCS:.c=.o-ppc)

+MODULES_I386 = $(SRCS:.c=.o-i386)

+MODULES_PPC := $(MODULES_PPC:.cpp=.o-ppc)

+MODULES_I386 := $(MODULES_I386:.cpp=.o-i386)

+

+PREFIX = /usr/local

+INSTALLDIR = $(PREFIX)/lib

+INCDIR = $(PREFIX)/include

+

+default: all

+

+all: dist

+

+dist: FreeImage

+	cp *.a Dist

+	cp *.dylib Dist

+	cp Source/FreeImage.h Dist

+

+FreeImage: $(STATICLIB) $(SHAREDLIB)

+

+$(STATICLIB): $(STATICLIB)-ppc $(STATICLIB)-i386

+	$(LIPO) -create $(STATICLIB)-ppc $(STATICLIB)-i386 -output $(STATICLIB)

+

+$(STATICLIB)-ppc: $(MODULES_PPC)

+	$(LIBTOOL) -arch_only ppc -o $@ $(MODULES_PPC)

+

+$(STATICLIB)-i386: $(MODULES_I386)

+	$(LIBTOOL) -arch_only i386 -o $@ $(MODULES_I386)

+

+$(SHAREDLIB): $(SHAREDLIB)-ppc $(SHAREDLIB)-i386

+	$(LIPO) -create $(SHAREDLIB)-ppc $(SHAREDLIB)-i386 -output $(SHAREDLIB)

+

+$(SHAREDLIB)-ppc: $(MODULES_PPC)

+	$(CPP_PPC) -arch ppc -dynamiclib $(LIBRARIES_PPC) -o $@ $(MODULES_PPC)

+

+$(SHAREDLIB)-i386: $(MODULES_I386)

+	$(CPP_I386) -arch i386 -dynamiclib $(LIBRARIES_I386) -o $@ $(MODULES_I386)

+

+.c.o-ppc:

+	$(CC_PPC) $(CFLAGS_PPC) -c $< -o $@

+

+.c.o-i386:

+	$(CC_I386) $(CFLAGS_I386) -c $< -o $@

+

+.cpp.o-ppc:

+	$(CPP_PPC) $(CPPFLAGS_PPC) -c $< -o $@

+

+.cpp.o-i386:

+	$(CPP_I386) $(CPPFLAGS_I386) -c $< -o $@

+

+install:

+	install -d -m 755 -o root -g wheel $(INCDIR) $(INSTALLDIR)

+	install -m 644 -o root -g wheel $(HEADER) $(INCDIR)

+	install -m 644 -o root -g wheel $(SHAREDLIB) $(STATICLIB) $(INSTALLDIR)

+	ranlib -sf $(INSTALLDIR)/$(STATICLIB)

+	ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(LIBNAME)

+

+clean:

+	rm -f core Dist/*.* u2dtmp* $(MODULES_PPC) $(MODULES_I386) $(STATICLIB) $(STATICLIB)-ppc $(STATICLIB)-i386 $(SHAREDLIB) $(SHAREDLIB)-ppc $(SHAREDLIB)-i386

diff --git a/Makefile.solaris b/Makefile.solaris
new file mode 100644
index 0000000..a17c68e
--- /dev/null
+++ b/Makefile.solaris
@@ -0,0 +1,65 @@
+# Solaris9 makefile for FreeImage. Tested on Solaris9 with tools from

+# Sunfreeware.com.

+

+# This file can be generated by ./gensrclist.sh

+include Makefile.srcs

+

+# General configuration variables:

+CC = gcc

+CPP = g++

+AR = ar

+

+INSTALLDIR = /usr/local

+

+# Converts cr/lf to just lf

+DOS2UNIX = dos2unix

+

+COMPILERFLAGS = -O3

+LIBRARIES = -lstdc++

+

+MODULES = $(SRCS:.c=.o)

+MODULES := $(MODULES:.cpp=.o)

+CFLAGS = $(COMPILERFLAGS) $(INCLUDE)

+CPPFLAGS = $(COMPILERFLAGS)  -Wno-ctor-dtor-privacy $(INCLUDE)

+

+TARGET  = freeimage

+STATICLIB = lib$(TARGET).a

+SHAREDLIB = lib$(TARGET)-$(VER_MAJOR).$(VER_MINOR).so

+LIBNAME = lib$(TARGET).so.$(VER_MAJOR)

+

+

+

+default: all

+

+all: dist

+

+dist: FreeImage

+	cp *.a Dist

+	cp *.so Dist

+	cp Source/FreeImage.h Dist

+

+dos2unix:

+	@$(DOS2UNIX) $(SRCS) $(INCLS)

+

+FreeImage: $(STATICLIB) $(SHAREDLIB)

+

+.c.o:

+	$(CC) $(CFLAGS) -c $< -o $@

+

+.cpp.o:

+	$(CPP) $(CPPFLAGS) -c $< -o $@

+

+$(STATICLIB): $(MODULES)

+	$(AR) r $@ $(MODULES)

+

+$(SHAREDLIB): $(MODULES)

+	$(CC) -s -G -Wl,-soname=$(LIBNAME) -o $@ $(MODULES) $(LIBRARIES)

+

+install:

+	install -m 644 -o root -g root Source/FreeImage.h $(INSTALLDIR)/include

+	install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)/lib

+	install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)/lib

+	ln -sf $(SHAREDLIB) $(INSTALLDIR)/lib/$(LIBNAME)

+

+clean:

+	rm -rf core Dist/*.* u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)

diff --git a/Makefile.srcs b/Makefile.srcs
new file mode 100644
index 0000000..daaa43d
--- /dev/null
+++ b/Makefile.srcs
@@ -0,0 +1,6 @@
+VER_MAJOR = 3

+VER_MINOR = 13.0

+SRCS = ./Source/FreeImage/BitmapAccess.cpp ./Source/FreeImage/ColorLookup.cpp ./Source/FreeImage/FreeImage.cpp ./Source/FreeImage/FreeImageC.c ./Source/FreeImage/FreeImageIO.cpp ./Source/FreeImage/GetType.cpp ./Source/FreeImage/MemoryIO.cpp ./Source/FreeImage/PixelAccess.cpp ././Source/FreeImage/J2KHelper.cpp ./Source/FreeImage/Plugin.cpp ./Source/FreeImage/PluginBMP.cpp ./Source/FreeImage/PluginCUT.cpp ./Source/FreeImage/PluginDDS.cpp ././Source/FreeImage/PluginEXR.cpp ./Source/FreeImage/PluginG3.cpp ./Source/FreeImage/PluginGIF.cpp ./Source/FreeImage/PluginHDR.cpp ./Source/FreeImage/PluginICO.cpp ./Source/FreeImage/PluginIFF.cpp ././Source/FreeImage/PluginJ2K.cpp ././Source/FreeImage/PluginJP2.cpp ./Source/FreeImage/PluginJPEG.cpp ./Source/FreeImage/PluginKOALA.cpp ./Source/FreeImage/PluginMNG.cpp ./Source/FreeImage/PluginPCD.cpp ./Source/FreeImage/PluginPCX.cpp ././Source/FreeImage/PluginPFM.cpp ././Source/FreeImage/PluginPICT.cpp ./Source/FreeImage/PluginPNG.cpp ./Source/FreeImage/PluginPNM.cpp ./Source/FreeImage/PluginPSD.cpp ./Source/FreeImage/PluginRAS.cpp ././Source/FreeImage/PluginRAW.cpp ./Source/FreeImage/PluginSGI.cpp ./Source/FreeImage/PluginTARGA.cpp ./Source/FreeImage/PluginTIFF.cpp ./Source/FreeImage/PluginWBMP.cpp ./Source/FreeImage/PluginXBM.cpp ./Source/FreeImage/PluginXPM.cpp ././Source/FreeImage/PSDParser.cpp ././Source/FreeImage/TIFFLogLuv.cpp ./Source/FreeImage/Conversion.cpp ./Source/FreeImage/Conversion16_555.cpp ./Source/FreeImage/Conversion16_565.cpp ./Source/FreeImage/Conversion24.cpp ./Source/FreeImage/Conversion32.cpp ./Source/FreeImage/Conversion4.cpp ./Source/FreeImage/Conversion8.cpp ./Source/FreeImage/ConversionRGBF.cpp ./Source/FreeImage/ConversionType.cpp ./Source/FreeImage/Halftoning.cpp ./Source/FreeImage/tmoColorConvert.cpp ./Source/FreeImage/tmoDrago03.cpp ././Source/FreeImage/tmoFattal02.cpp ./Source/FreeImage/tmoReinhard05.cpp ./Source/FreeImage/ToneMapping.cpp ./Source/FreeImage/NNQuantizer.cpp ./Source/FreeImage/WuQuantizer.cpp ././Source/DeprecationManager/Deprecated.cpp ./Source/DeprecationManager/DeprecationMgr.cpp ./Source/FreeImage/CacheFile.cpp ./Source/FreeImage/MultiPage.cpp ./Source/FreeImage/ZLibInterface.cpp ./Source/Metadata/Exif.cpp ./Source/Metadata/FIRational.cpp ./Source/Metadata/FreeImageTag.cpp ./Source/Metadata/IPTC.cpp ./Source/Metadata/TagConversion.cpp ./Source/Metadata/TagLib.cpp ./Source/Metadata/XTIFF.cpp ././Source/FreeImageToolkit/Background.cpp ./Source/FreeImageToolkit/BSplineRotate.cpp ./Source/FreeImageToolkit/Channels.cpp ./Source/FreeImageToolkit/ClassicRotate.cpp ./Source/FreeImageToolkit/Colors.cpp ./Source/FreeImageToolkit/CopyPaste.cpp ./Source/FreeImageToolkit/Display.cpp ./Source/FreeImageToolkit/Flip.cpp ./Source/FreeImageToolkit/JPEGTransform.cpp ././Source/FreeImageToolkit/MultigridPoissonSolver.cpp ./Source/FreeImageToolkit/Rescale.cpp ./Source/FreeImageToolkit/Resize.cpp Source/LibJPEG/./jaricom.c Source/LibJPEG/jcapimin.c Source/LibJPEG/jcapistd.c Source/LibJPEG/./jcarith.c Source/LibJPEG/jccoefct.c Source/LibJPEG/jccolor.c Source/LibJPEG/jcdctmgr.c Source/LibJPEG/jchuff.c Source/LibJPEG/jcinit.c Source/LibJPEG/jcmainct.c Source/LibJPEG/jcmarker.c Source/LibJPEG/jcmaster.c Source/LibJPEG/jcomapi.c Source/LibJPEG/jcparam.c Source/LibJPEG/jcprepct.c Source/LibJPEG/jcsample.c Source/LibJPEG/jctrans.c Source/LibJPEG/jdapimin.c Source/LibJPEG/jdapistd.c Source/LibJPEG/./jdarith.c Source/LibJPEG/jdatadst.c Source/LibJPEG/jdatasrc.c Source/LibJPEG/jdcoefct.c Source/LibJPEG/jdcolor.c Source/LibJPEG/jddctmgr.c Source/LibJPEG/jdhuff.c Source/LibJPEG/jdinput.c Source/LibJPEG/jdmainct.c Source/LibJPEG/jdmarker.c Source/LibJPEG/jdmaster.c Source/LibJPEG/jdmerge.c Source/LibJPEG/jdpostct.c Source/LibJPEG/jdsample.c Source/LibJPEG/jdtrans.c Source/LibJPEG/jerror.c Source/LibJPEG/jfdctflt.c Source/LibJPEG/jfdctfst.c Source/LibJPEG/jfdctint.c Source/LibJPEG/jidctflt.c Source/LibJPEG/jidctfst.c Source/LibJPEG/jidctint.c Source/LibJPEG/jmemmgr.c Source/LibJPEG/jmemnobs.c Source/LibJPEG/jquant1.c Source/LibJPEG/jquant2.c Source/LibJPEG/jutils.c Source/LibJPEG/transupp.c Source/LibMNG/libmng_callback_xs.c Source/LibMNG/libmng_chunk_descr.c Source/LibMNG/libmng_chunk_io.c Source/LibMNG/libmng_chunk_prc.c Source/LibMNG/libmng_chunk_xs.c Source/LibMNG/libmng_cms.c Source/LibMNG/libmng_display.c Source/LibMNG/libmng_dither.c Source/LibMNG/libmng_error.c Source/LibMNG/libmng_filter.c Source/LibMNG/libmng_hlapi.c Source/LibMNG/libmng_jpeg.c Source/LibMNG/libmng_object_prc.c Source/LibMNG/libmng_pixels.c Source/LibMNG/libmng_prop_xs.c Source/LibMNG/libmng_read.c Source/LibMNG/libmng_trace.c Source/LibMNG/libmng_write.c Source/LibMNG/libmng_zlib.c Source/LibPNG/png.c Source/LibPNG/pngerror.c Source/LibPNG/pnggccrd.c Source/LibPNG/pngget.c Source/LibPNG/pngmem.c Source/LibPNG/pngpread.c Source/LibPNG/pngread.c Source/LibPNG/pngrio.c Source/LibPNG/pngrtran.c Source/LibPNG/pngrutil.c Source/LibPNG/pngset.c Source/LibPNG/pngtrans.c Source/LibPNG/pngvcrd.c Source/LibPNG/pngwio.c Source/LibPNG/pngwrite.c Source/LibPNG/pngwtran.c Source/LibPNG/pngwutil.c Source/LibTIFF/tif_aux.c Source/LibTIFF/tif_close.c Source/LibTIFF/tif_codec.c Source/LibTIFF/tif_color.c Source/LibTIFF/tif_compress.c Source/LibTIFF/tif_dir.c Source/LibTIFF/tif_dirinfo.c Source/LibTIFF/tif_dirread.c Source/LibTIFF/tif_dirwrite.c Source/LibTIFF/tif_dumpmode.c Source/LibTIFF/tif_error.c Source/LibTIFF/tif_extension.c Source/LibTIFF/tif_fax3.c Source/LibTIFF/tif_fax3sm.c Source/LibTIFF/tif_flush.c Source/LibTIFF/tif_getimage.c Source/LibTIFF/tif_jpeg.c Source/LibTIFF/tif_luv.c Source/LibTIFF/tif_lzw.c Source/LibTIFF/tif_next.c Source/LibTIFF/tif_open.c Source/LibTIFF/tif_packbits.c Source/LibTIFF/tif_pixarlog.c Source/LibTIFF/tif_predict.c Source/LibTIFF/tif_print.c Source/LibTIFF/tif_read.c Source/LibTIFF/tif_strip.c Source/LibTIFF/tif_swab.c Source/LibTIFF/tif_thunder.c Source/LibTIFF/tif_tile.c Source/LibTIFF/tif_version.c Source/LibTIFF/tif_warning.c Source/LibTIFF/tif_write.c Source/LibTIFF/tif_zip.c Source/ZLib/adler32.c Source/ZLib/compress.c Source/ZLib/crc32.c Source/ZLib/deflate.c Source/ZLib/gzio.c Source/ZLib/infback.c Source/ZLib/inffast.c Source/ZLib/inflate.c Source/ZLib/inftrees.c Source/ZLib/trees.c Source/ZLib/uncompr.c Source/ZLib/zutil.c Source/LibOpenJPEG/bio.c Source/LibOpenJPEG/cio.c Source/LibOpenJPEG/dwt.c Source/LibOpenJPEG/event.c Source/LibOpenJPEG/image.c Source/LibOpenJPEG/j2k.c Source/LibOpenJPEG/j2k_lib.c Source/LibOpenJPEG/jp2.c Source/LibOpenJPEG/jpt.c Source/LibOpenJPEG/mct.c Source/LibOpenJPEG/mqc.c Source/LibOpenJPEG/openjpeg.c Source/LibOpenJPEG/pi.c Source/LibOpenJPEG/raw.c Source/LibOpenJPEG/t1.c Source/LibOpenJPEG/t2.c Source/LibOpenJPEG/tcd.c Source/LibOpenJPEG/tgt.c Source/OpenEXR/./IlmImf/ImfAttribute.cpp Source/OpenEXR/./IlmImf/ImfB44Compressor.cpp Source/OpenEXR/./IlmImf/ImfBoxAttribute.cpp Source/OpenEXR/./IlmImf/ImfChannelList.cpp Source/OpenEXR/./IlmImf/ImfChannelListAttribute.cpp Source/OpenEXR/./IlmImf/ImfChromaticities.cpp Source/OpenEXR/./IlmImf/ImfChromaticitiesAttribute.cpp Source/OpenEXR/./IlmImf/ImfCompressionAttribute.cpp Source/OpenEXR/./IlmImf/ImfCompressor.cpp Source/OpenEXR/./IlmImf/ImfConvert.cpp Source/OpenEXR/./IlmImf/ImfCRgbaFile.cpp Source/OpenEXR/./IlmImf/ImfDoubleAttribute.cpp Source/OpenEXR/./IlmImf/ImfEnvmap.cpp Source/OpenEXR/./IlmImf/ImfEnvmapAttribute.cpp Source/OpenEXR/./IlmImf/ImfFloatAttribute.cpp Source/OpenEXR/./IlmImf/ImfFrameBuffer.cpp Source/OpenEXR/./IlmImf/ImfFramesPerSecond.cpp Source/OpenEXR/./IlmImf/ImfHeader.cpp Source/OpenEXR/./IlmImf/ImfHuf.cpp Source/OpenEXR/./IlmImf/ImfInputFile.cpp Source/OpenEXR/./IlmImf/ImfIntAttribute.cpp Source/OpenEXR/./IlmImf/ImfIO.cpp Source/OpenEXR/./IlmImf/ImfKeyCode.cpp Source/OpenEXR/./IlmImf/ImfKeyCodeAttribute.cpp Source/OpenEXR/./IlmImf/ImfLineOrderAttribute.cpp Source/OpenEXR/./IlmImf/ImfLut.cpp Source/OpenEXR/./IlmImf/ImfMatrixAttribute.cpp Source/OpenEXR/./IlmImf/ImfMisc.cpp Source/OpenEXR/./IlmImf/ImfOpaqueAttribute.cpp Source/OpenEXR/./IlmImf/ImfOutputFile.cpp Source/OpenEXR/./IlmImf/ImfPizCompressor.cpp Source/OpenEXR/./IlmImf/ImfPreviewImage.cpp Source/OpenEXR/./IlmImf/ImfPreviewImageAttribute.cpp Source/OpenEXR/./IlmImf/ImfPxr24Compressor.cpp Source/OpenEXR/./IlmImf/ImfRational.cpp Source/OpenEXR/./IlmImf/ImfRationalAttribute.cpp Source/OpenEXR/./IlmImf/ImfRgbaFile.cpp Source/OpenEXR/./IlmImf/ImfRgbaYca.cpp Source/OpenEXR/./IlmImf/ImfRleCompressor.cpp Source/OpenEXR/./IlmImf/ImfScanLineInputFile.cpp Source/OpenEXR/./IlmImf/ImfStandardAttributes.cpp Source/OpenEXR/./IlmImf/ImfStdIO.cpp Source/OpenEXR/./IlmImf/ImfStringAttribute.cpp Source/OpenEXR/./IlmImf/ImfTestFile.cpp Source/OpenEXR/./IlmImf/ImfThreading.cpp Source/OpenEXR/./IlmImf/ImfTileDescriptionAttribute.cpp Source/OpenEXR/./IlmImf/ImfTiledInputFile.cpp Source/OpenEXR/./IlmImf/ImfTiledMisc.cpp Source/OpenEXR/./IlmImf/ImfTiledOutputFile.cpp Source/OpenEXR/./IlmImf/ImfTiledRgbaFile.cpp Source/OpenEXR/./IlmImf/ImfTileOffsets.cpp Source/OpenEXR/./IlmImf/ImfTimeCode.cpp Source/OpenEXR/./IlmImf/ImfTimeCodeAttribute.cpp Source/OpenEXR/./IlmImf/ImfVecAttribute.cpp Source/OpenEXR/./IlmImf/ImfVersion.cpp Source/OpenEXR/./IlmImf/ImfWav.cpp Source/OpenEXR/./IlmImf/ImfZipCompressor.cpp Source/OpenEXR/./Imath/ImathBox.cpp Source/OpenEXR/./Imath/ImathColorAlgo.cpp Source/OpenEXR/./Imath/ImathFun.cpp Source/OpenEXR/./Imath/ImathMatrixAlgo.cpp Source/OpenEXR/./Imath/ImathRandom.cpp Source/OpenEXR/./Imath/ImathShear.cpp Source/OpenEXR/./Imath/ImathVec.cpp Source/OpenEXR/./Iex/IexBaseExc.cpp Source/OpenEXR/./Iex/IexThrowErrnoExc.cpp Source/OpenEXR/./Half/half.cpp Source/OpenEXR/./IlmThread/IlmThread.cpp Source/OpenEXR/./IlmThread/IlmThreadMutex.cpp Source/OpenEXR/./IlmThread/IlmThreadPool.cpp Source/OpenEXR/./IlmThread/IlmThreadSemaphore.cpp Source/LibRawLite/./internal/dcraw_common.cpp Source/LibRawLite/./internal/dcraw_fileio.cpp Source/LibRawLite/./src/libraw_c_api.cpp Source/LibRawLite/./src/libraw_cxx.cpp 

+INCLS = ./Source/FreeImage.h ./Source/OpenEXR/Half/halfFunction.h ./Source/OpenEXR/Half/toFloat.h ./Source/OpenEXR/Half/halfLimits.h ./Source/OpenEXR/Half/eLut.h ./Source/OpenEXR/Half/half.h ./Source/OpenEXR/IlmImf/ImfRationalAttribute.h ./Source/OpenEXR/IlmImf/b44ExpLogTable.h ./Source/OpenEXR/IlmImf/ImfTiledOutputFile.h ./Source/OpenEXR/IlmImf/ImfName.h ./Source/OpenEXR/IlmImf/ImfHeader.h ./Source/OpenEXR/IlmImf/ImfKeyCode.h ./Source/OpenEXR/IlmImf/ImfTileDescription.h ./Source/OpenEXR/IlmImf/ImfKeyCodeAttribute.h ./Source/OpenEXR/IlmImf/ImfLineOrder.h ./Source/OpenEXR/IlmImf/ImfVecAttribute.h ./Source/OpenEXR/IlmImf/ImfPxr24Compressor.h ./Source/OpenEXR/IlmImf/ImfStdIO.h ./Source/OpenEXR/IlmImf/ImfTestFile.h ./Source/OpenEXR/IlmImf/ImfScanLineInputFile.h ./Source/OpenEXR/IlmImf/ImfRleCompressor.h ./Source/OpenEXR/IlmImf/ImfPixelType.h ./Source/OpenEXR/IlmImf/ImfRgbaYca.h ./Source/OpenEXR/IlmImf/ImfTileOffsets.h ./Source/OpenEXR/IlmImf/ImfLut.h ./Source/OpenEXR/IlmImf/ImfCompressionAttribute.h ./Source/OpenEXR/IlmImf/ImfStringAttribute.h ./Source/OpenEXR/IlmImf/ImfTiledMisc.h ./Source/OpenEXR/IlmImf/ImfPreviewImage.h ./Source/OpenEXR/IlmImf/ImfCompression.h ./Source/OpenEXR/IlmImf/ImfOutputFile.h ./Source/OpenEXR/IlmImf/ImfStandardAttributes.h ./Source/OpenEXR/IlmImf/ImfVersion.h ./Source/OpenEXR/IlmImf/ImfTimeCodeAttribute.h ./Source/OpenEXR/IlmImf/ImfTiledInputFile.h ./Source/OpenEXR/IlmImf/ImfLineOrderAttribute.h ./Source/OpenEXR/IlmImf/ImfBoxAttribute.h ./Source/OpenEXR/IlmImf/ImfEnvmapAttribute.h ./Source/OpenEXR/IlmImf/ImfRgbaFile.h ./Source/OpenEXR/IlmImf/ImfMatrixAttribute.h ./Source/OpenEXR/IlmImf/ImfEnvmap.h ./Source/OpenEXR/IlmImf/ImfChannelList.h ./Source/OpenEXR/IlmImf/ImfInputFile.h ./Source/OpenEXR/IlmImf/ImfFramesPerSecond.h ./Source/OpenEXR/IlmImf/ImfAttribute.h ./Source/OpenEXR/IlmImf/ImfTiledRgbaFile.h ./Source/OpenEXR/IlmImf/ImfFrameBuffer.h ./Source/OpenEXR/IlmImf/ImfChromaticities.h ./Source/OpenEXR/IlmImf/ImfCompressor.h ./Source/OpenEXR/IlmImf/ImfMisc.h ./Source/OpenEXR/IlmImf/ImfOpaqueAttribute.h ./Source/OpenEXR/IlmImf/ImfIO.h ./Source/OpenEXR/IlmImf/ImfThreading.h ./Source/OpenEXR/IlmImf/ImfInt64.h ./Source/OpenEXR/IlmImf/ImfIntAttribute.h ./Source/OpenEXR/IlmImf/ImfPizCompressor.h ./Source/OpenEXR/IlmImf/ImfWav.h ./Source/OpenEXR/IlmImf/ImfFloatAttribute.h ./Source/OpenEXR/IlmImf/ImfAutoArray.h ./Source/OpenEXR/IlmImf/ImfRgba.h ./Source/OpenEXR/IlmImf/ImfPreviewImageAttribute.h ./Source/OpenEXR/IlmImf/ImfXdr.h ./Source/OpenEXR/IlmImf/ImfArray.h ./Source/OpenEXR/IlmImf/ImfChannelListAttribute.h ./Source/OpenEXR/IlmImf/ImfConvert.h ./Source/OpenEXR/IlmImf/ImfTileDescriptionAttribute.h ./Source/OpenEXR/IlmImf/ImfZipCompressor.h ./Source/OpenEXR/IlmImf/ImfB44Compressor.h ./Source/OpenEXR/IlmImf/ImfRational.h ./Source/OpenEXR/IlmImf/ImfDoubleAttribute.h ./Source/OpenEXR/IlmImf/ImfTimeCode.h ./Source/OpenEXR/IlmImf/ImfChromaticitiesAttribute.h ./Source/OpenEXR/IlmImf/ImfHuf.h ./Source/OpenEXR/IlmImf/ImfCRgbaFile.h ./Source/OpenEXR/OpenEXRConfig.h ./Source/OpenEXR/Iex/IexMacros.h ./Source/OpenEXR/Iex/IexMathExc.h ./Source/OpenEXR/Iex/Iex.h ./Source/OpenEXR/Iex/IexThrowErrnoExc.h ./Source/OpenEXR/Iex/IexErrnoExc.h ./Source/OpenEXR/Iex/IexBaseExc.h ./Source/OpenEXR/Imath/ImathBoxAlgo.h ./Source/OpenEXR/Imath/ImathMath.h ./Source/OpenEXR/Imath/ImathPlane.h ./Source/OpenEXR/Imath/ImathRandom.h ./Source/OpenEXR/Imath/ImathInterval.h ./Source/OpenEXR/Imath/ImathLine.h ./Source/OpenEXR/Imath/ImathLimits.h ./Source/OpenEXR/Imath/ImathShear.h ./Source/OpenEXR/Imath/ImathPlatform.h ./Source/OpenEXR/Imath/ImathBox.h ./Source/OpenEXR/Imath/ImathFrustum.h ./Source/OpenEXR/Imath/ImathGL.h ./Source/OpenEXR/Imath/ImathRoots.h ./Source/OpenEXR/Imath/ImathLineAlgo.h ./Source/OpenEXR/Imath/ImathMatrixAlgo.h ./Source/OpenEXR/Imath/ImathVec.h ./Source/OpenEXR/Imath/ImathVecAlgo.h ./Source/OpenEXR/Imath/ImathSphere.h ./Source/OpenEXR/Imath/ImathGLU.h ./Source/OpenEXR/Imath/ImathFun.h ./Source/OpenEXR/Imath/ImathMatrix.h ./Source/OpenEXR/Imath/ImathExc.h ./Source/OpenEXR/Imath/ImathHalfLimits.h ./Source/OpenEXR/Imath/ImathColor.h ./Source/OpenEXR/Imath/ImathInt64.h ./Source/OpenEXR/Imath/ImathFrame.h ./Source/OpenEXR/Imath/ImathQuat.h ./Source/OpenEXR/Imath/ImathColorAlgo.h ./Source/OpenEXR/Imath/ImathEuler.h ./Source/OpenEXR/IlmThread/IlmThread.h ./Source/OpenEXR/IlmThread/IlmThreadMutex.h ./Source/OpenEXR/IlmThread/IlmThreadSemaphore.h ./Source/OpenEXR/IlmThread/IlmThreadPool.h ./Source/OpenEXR/IlmBaseConfig.h ./Source/CacheFile.h ./Source/LibOpenJPEG/bio.h ./Source/LibOpenJPEG/tgt.h ./Source/LibOpenJPEG/t1.h ./Source/LibOpenJPEG/fix.h ./Source/LibOpenJPEG/j2k.h ./Source/LibOpenJPEG/t1_luts.h ./Source/LibOpenJPEG/j2k_lib.h ./Source/LibOpenJPEG/cio.h ./Source/LibOpenJPEG/pi.h ./Source/LibOpenJPEG/event.h ./Source/LibOpenJPEG/opj_includes.h ./Source/LibOpenJPEG/int.h ./Source/LibOpenJPEG/opj_malloc.h ./Source/LibOpenJPEG/image.h ./Source/LibOpenJPEG/jpt.h ./Source/LibOpenJPEG/raw.h ./Source/LibOpenJPEG/mct.h ./Source/LibOpenJPEG/jp2.h ./Source/LibOpenJPEG/t2.h ./Source/LibOpenJPEG/mqc.h ./Source/LibOpenJPEG/tcd.h ./Source/LibOpenJPEG/openjpeg.h ./Source/LibOpenJPEG/dwt.h ./Source/FreeImageToolkit/Filters.h ./Source/FreeImageToolkit/Resize.h ./Source/Utilities.h ./Source/LibRawLite/libraw/libraw_types.h ./Source/LibRawLite/libraw/libraw_version.h ./Source/LibRawLite/libraw/libraw_const.h ./Source/LibRawLite/libraw/libraw_alloc.h ./Source/LibRawLite/libraw/libraw_datastream.h ./Source/LibRawLite/libraw/libraw_internal.h ./Source/LibRawLite/libraw/libraw.h ./Source/LibRawLite/internal/defines.h ./Source/LibRawLite/internal/var_defines.h ./Source/LibRawLite/internal/libraw_internal_funcs.h ./Source/LibJPEG/jversion.h ./Source/LibJPEG/jmorecfg.h ./Source/LibJPEG/transupp.h ./Source/LibJPEG/jmemsys.h ./Source/LibJPEG/jdct.h ./Source/LibJPEG/jconfig.h ./Source/LibJPEG/jinclude.h ./Source/LibJPEG/jpeglib.h ./Source/LibJPEG/cderror.h ./Source/LibJPEG/jpegint.h ./Source/LibJPEG/cdjpeg.h ./Source/LibJPEG/jerror.h ./Source/LibMNG/libmng_display.h ./Source/LibMNG/libmng_dither.h ./Source/LibMNG/libmng_trace.h ./Source/LibMNG/libmng_chunks.h ./Source/LibMNG/libmng_filter.h ./Source/LibMNG/libmng_read.h ./Source/LibMNG/libmng_objects.h ./Source/LibMNG/libmng_cms.h ./Source/LibMNG/libmng_chunk_io.h ./Source/LibMNG/libmng_jpeg.h ./Source/LibMNG/libmng_memory.h ./Source/LibMNG/libmng_zlib.h ./Source/LibMNG/libmng_object_prc.h ./Source/LibMNG/libmng_write.h ./Source/LibMNG/libmng_data.h ./Source/LibMNG/libmng_conf.h ./Source/LibMNG/libmng_types.h ./Source/LibMNG/libmng_chunk_descr.h ./Source/LibMNG/libmng_pixels.h ./Source/LibMNG/libmng_chunk_prc.h ./Source/LibMNG/libmng_error.h ./Source/LibMNG/libmng.h ./Source/LibPNG/png.h ./Source/LibPNG/pngconf.h ./Source/Plugin.h ./Source/Quantizers.h ./Source/FreeImageIO.h ./Source/LibTIFF/tiff.h ./Source/LibTIFF/tif_config.vc.h ./Source/LibTIFF/tiffvers.h ./Source/LibTIFF/tif_dir.h ./Source/LibTIFF/tif_predict.h ./Source/LibTIFF/tif_config.wince.h ./Source/LibTIFF/tiffconf.vc.h ./Source/LibTIFF/tiffconf.wince.h ./Source/LibTIFF/t4.h ./Source/LibTIFF/tiffiop.h ./Source/LibTIFF/uvcode.h ./Source/LibTIFF/tiffio.h ./Source/LibTIFF/tif_config.h ./Source/LibTIFF/tif_fax3.h ./Source/ZLib/inflate.h ./Source/ZLib/trees.h ./Source/ZLib/zconf.h ./Source/ZLib/zlib.h ./Source/ZLib/crc32.h ./Source/ZLib/inftrees.h ./Source/ZLib/zutil.h ./Source/ZLib/inffixed.h ./Source/ZLib/inffast.h ./Source/ZLib/zconf.in.h ./Source/ZLib/deflate.h ./Source/FreeImage/PSDParser.h ./Source/ToneMapping.h ./Source/DeprecationManager/DeprecationMgr.h ./Source/Metadata/FIRational.h ./Source/Metadata/FreeImageTag.h ./Wrapper/FreeImage.NET/cpp/FreeImageIO/resource.h ./Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.Net.h ./Wrapper/FreeImage.NET/cpp/FreeImageIO/Stdafx.h ./Wrapper/FreeImagePlus/test/fipTest.h ./Wrapper/FreeImagePlus/FreeImagePlus.h ./Examples/Generic/FIIO_Mem.h ./Examples/OpenGL/TextureManager/TextureManager.h ./Examples/Plugin/PluginCradle.h ./TestAPI/TestSuite.h

+

+INCLUDE = -I. -ISource -ISource/Metadata -ISource/FreeImageToolkit -ISource/LibJPEG -ISource/LibMNG -ISource/LibPNG -ISource/LibTIFF -ISource/ZLib -ISource/LibOpenJPEG -ISource/OpenEXR -ISource/OpenEXR/Half -ISource/OpenEXR/Iex -ISource/OpenEXR/IlmImf -ISource/OpenEXR/IlmThread -ISource/OpenEXR/Imath -ISource/LibRawLite -ISource/LibRawLite/dcraw -ISource/LibRawLite/internal -ISource/LibRawLite/libraw -ISource/LibRawLite/src

diff --git a/README.linux b/README.linux
new file mode 100644
index 0000000..0e8659e
--- /dev/null
+++ b/README.linux
@@ -0,0 +1,50 @@
+Release Notes

+--------------

+This version of the library has been tested under the following OS:

+- RedHat Linux 7.3, 8.0 and 9.0

+- Fedora Core 2

+- SuSE Linux Enterprise 8 and SuSE 9.0.

+- Debian 4

+

+You *do not* need to have any other third party library (libjpeg, libpng, libtiff, libmng and zlib) 

+installed on your /usr/lib directory in order to compile and use the library. 

+FreeImage uses its own versions of these libraries. This way, you can be sure that FreeImage will 

+always use the latest version of each third party library.

+

+The FreeImage makefile makes use of the gcc "-fvisibility=hidden" in order to avoid incompatibilities between 

+internal third party libraries and the OS libraries. You may have to remove this option if you're running an 

+old version of gcc. See also http://gcc.gnu.org/wiki/Visibility

+

+You should be able to link progams with the -lfreeimage option after the library is compiled and installed. 

+You can also statically link with libfreeimage.a.

+If you use a really old version of gcc and it chokes on the CRs in the file, you can type 'make dos2unix'

+to run all of the files through dos2unix which converts CRLF to LF.  This no longer appears to be required

+for RedHat 7.3 or 9.

+

+Please let me know how this works for you under other Linux distributions or any other *nix.

+

+Herve Drolon

+FreeImage Project Manager

+

+Installation

+------------

+Note: You will need to have root privileges in order to install the library in the /usr/lib directory.

+The installation process is as simple as this : 

+1) Enter the FreeImage directory

+2) Build the distribution : 

+make

+make install

+3) Clean all files produced during the build process

+make clean

+

+Compiling FreeImagePlus

+-----------------------

+FreeImagePlus is a C++ wrapper for FreeImage. 

+To compile FreeImage as a C++ library, follow these steps : 

+1) Enter the FreeImage directory

+2) Build the distribution : 

+make -f Makefile.fip

+make -f Makefile.fip install

+3) Clean all files produced during the build process

+make -f Makefile.fip clean

+

diff --git a/README.minGW b/README.minGW
new file mode 100644
index 0000000..30195c3
--- /dev/null
+++ b/README.minGW
@@ -0,0 +1,236 @@
+=====================================================================

+Using the FreeImage library with the MinGW Compiler Suite

+=====================================================================

+

+This file describes how to use the precompiled FreeImage library

+FreeImage.dll with the MinGW port of the GNU Compiler Collection

+(GCC), how to build this library from source using MinGW and how

+to use this MinGW-built library with Microsoft Visual Studio.

+

+Contents:

+

+I. Prerequisites

+

+1. Using the precompiled FreeImage library with MinGW

+

+2. Building the FreeImage library with MinGW

+

+3. Using the MinGW FreeImage library with Microsoft Visual Studio

+

+4. Useful links

+

+

+---------------------------------------------------------------------

+I. Prerequisites

+=====================================================================

+

+The procedures described in this document have been developed and

+tested using the following free tools:

+

+1. MinGW GCC Version 4.4.0 (Core and C++ including required libs)

+2. MinGW GNU Binutils Version 2.19.1

+3. MinGW GNU Make Version 3.81-20080326-3

+4. MinGW Runtime Version 3.15.2

+5. MinGW API for MS-Windows Version 3.13

+6. GnuWin32 Package CoreUtils Version 5.3.0 (only for building)

+7. GnuWin32 Package Sed Version 4.2 (only for creating the GCC

+   import library)*

+

+* Sed is only needed to create a GCC-native import library from

+  the MSVC import library FreeImage.lib. However, since MinGW now

+  supports linking against MSVC lib files, this process seems to

+  be obsolete. See section 1.

+

+Basically, no version dependent capabilities are used so, this

+should also work with older versions of the tools mentioned above.

+Similarly, the GnuWin32 packages (which I just prefer over MSYS)

+could likely be replaced by a properly installed MSYS environment.

+

+Furthermore, the following preconditions should be met:

+

+1. The folders 'bin' under both the MinGW and the GnuWin32

+   installation directory should have been added to the PATH

+   environment variable. Likely it is best adding these

+   directories permanently to PATH through the System

+   Properties dialog on the Control Panel.

+

+2. The MinGW Make package only provides a 'mingw32-make.exe'

+   executable. There is no alias 'make.exe'. However, make is

+   preconfigured to use 'make' as the default $(MAKE) command.

+   This seems to be a bug in the MinGW GNU Make distribution.

+   Thus, a copy of 'mingw32-make.exe' named 'make.exe' should

+   be placed into MinGW's 'bin' directory.

+

+

+

+---------------------------------------------------------------------

+1. Using the precompiled FreeImage library with MinGW

+=====================================================================

+

+When using functions from C/C++, that reside in a DLL, the linker

+needs a so called import library, which specifies, how to

+dynamically link these external functions during runtime. However,

+different linkers use different types or formats of these import

+libraries.

+

+Since the precompiled FreeImage library was build with Microsoft

+Visual Studio, in the past, some extra work was required to use it

+from MinGW. An import library, that was compatible with GNU ld,

+must have been created first.

+

+However, for several MinGW versions, the GNU linker ld also

+supports linking against Microsoft Visual C++ import libraries

+directly. So, this effectively makes any circulating HOWTO's on

+how to create a GCC-compatible import library from a MSVC lib file

+more or less obsolete. Additionally, MinGW does not require the

+GCC/Linux usual lib prefix for libraries, so linking with MinGW

+against the precompiled FreeImage DLL is as easy as with MSVC:

+

+1.) Open a DOS shell (run application cmd.exe)

+

+2.) Ensure, that the 'bin' folder of MinGW is added to the PATH

+    environment variable (see Prerequisites).

+

+3.) Link directly against the supplied lib file:

+

+    C:\>gcc -oFreeImageTest.exe FreeImageTest.c -lFreeImage

+

+Nonetheless, for the sake of completeness, the following steps

+describe how to create a native GCC import library:

+

+1.) Open a DOS shell (run application cmd.exe)

+

+2.) Ensure, that the 'bin' folders of both MinGW and GnuWin32 are

+    added to the PATH environment variable (see Prerequisites).

+

+3.) Create a .def file 'libfreeimage.def', that contains all symbols

+    exported by the FreeImage library:

+

+    C:\>pexports FreeImage.dll | sed "s/^_//" > libfreeimage.def

+

+4.) Create the GCC compatible import library 'libfreeimage.a':

+

+    C:\>dlltool --add-underscore -d libfreeimage.def -l libfreeimage.a

+

+5.) Use this library to link against with GCC:

+

+    C:\>gcc -oFreeImageTest.exe FreeImageTest.c -lfreeimage

+

+

+

+---------------------------------------------------------------------

+2. Building the FreeImage library with MinGW

+=====================================================================

+

+You *do not* need to have any other third party library (like

+libjpeg, libpng, libtiff, libmng and zlib and others) installed on

+your system in order to compile and use the library. FreeImage uses

+its own versions of these libraries. This way, you can be sure that

+FreeImage will always use the latest and properly tested versions

+of of these third party libraries.

+

+In order to build the FreeImage library under Windows with MinGW

+(GCC), ensure that all the prerequisites mentioned above are met.

+The MinGW makefile aims to build a Windows DLL, that differs as

+least as possible from the precompiled library that comes with the

+FreeImage distribution. Thus, the build process also includes the

+DLL version resource as well as the __stdcall attribute for all the

+exported functions, including the MSVC-like function decorations

+_FuncName@nn.

+

+When building the FreeImage DLL, of course, an import library is

+generated, too. However, this input library is not in GCC's native

+format, but in MSVC lib format, which makes it usable from both

+MinGW and Microsoft Visual Studio with no further processing.

+

+The MinGW makefile can also be used to build a static library.

+However, due to the different function export attributes needed

+for both the dynamic and the shared library (DLL), this requires

+a separate invocation of make, which in turn needs to rebuild every

+source file after switching from dynamic to static and vice versa.

+So, a 'make clean' is required each time, the library type is

+changed.

+

+The type of library to build is specified by a variable named

+FREEIMAGE_LIBRARY_TYPE, which may either be set directly in the

+Makefile.mingw near line 18 or may be specified as an environment

+variable. This variable may either take SHARED or STATIC to build

+a dynamic link library (DLL) or a static library respectively.

+Since this value is used to dynamically form the actual make target

+internally, only uppercase values are valid. Defaults to SHARED.

+

+The MinGW makefile also supports the 'install' target. However,

+this only copies the FreeImage dynamic link library (DLL) from the

+Dist folder into the %SystemRoot%\system32 folder. So, invoking this

+target only makes sense, if the DLL has been built before.

+

+Since there is neither a common system wide 'include' nor a 'lib'

+directory available under Windows, the FreeImage header file

+FreeImage.h as well as both the static library and the DLL import

+library FreeImage.lib just remain in the 'Dist' folder.

+

+The following procedure creates the FreeImage dynamic link library

+(DLL) from the sources, installs it and also creates a static

+FreeImage library:

+

+1.) Open a DOS shell (run application cmd.exe)

+

+2.) Ensure, that the 'bin' folders of both MinGW and GnuWin32 are

+    added to the PATH environment variable (see Prerequisites).

+

+3.) Create the FreeImage dynamic link library (DLL):

+

+    C:\>make

+

+4.) Install the FreeImage dynamic link library (DLL):

+

+    C:\>make install

+

+5.) Clean all files produced by the recent build process:

+

+    C:\>make clean

+

+6.) Create a static FreeImage library:

+

+    C:\>set FREEIMAGE_LIBRARY_TYPE=STATIC

+    C:\>make

+

+You should be able to link progams with the -lFreeImage option

+after the shared library is compiled and installed. You can also

+link statically against FreeImage.a from MinGW.

+

+

+

+---------------------------------------------------------------------

+3. Using the MinGW FreeImage library with Microsoft Visual Studio

+=====================================================================

+

+Since the MinGW makefile creates an import library in MSVC's lib

+format, the produced shared library (DLL) can be used from both

+MinGW and Microsoft Visual Studio with no further adaption. Just

+link to the import library FreeImage.lib from either MinGW or

+Microsoft Visual Studio.

+

+

+

+---------------------------------------------------------------------

+4. Useful links

+=====================================================================

+

+- The MinGW homepage:

+     http://www.mingw.org/

+

+- The GnuWin32 homepage:

+     http://gnuwin32.sourceforge.net/

+

+- The GCC homepage and online documentation:

+     http://gcc.gnu.org/

+     http://gcc.gnu.org/onlinedocs/

+

+- The GNU Binutils homepage and online documentation:

+     http://www.gnu.org/software/binutils/

+     http://sourceware.org/binutils/docs-2.19/

+

+- The GNU Make homepage and online documentation:

+     http://www.gnu.org/software/make/

+     http://www.gnu.org/software/make/manual/make.html

diff --git a/README.osx b/README.osx
new file mode 100644
index 0000000..16aba34
--- /dev/null
+++ b/README.osx
@@ -0,0 +1,44 @@
+Release Notes

+--------------

+This version of the library has been tested under OSX 10.3.9 PPC and OSX 10.4.8 Intel.

+

+While the makefiles will make a .dylib and a .a, it is recommended to simply staticly link with the .a file.

+

+FreeImage is now built as a Universal Binary and targets the 10.3.9 SDK for PPC and the 10.4u SDK for i386.

+This means that you must have both of these SDKs installed and that you must be running on OSX 10.4+ to build FreeImage.

+The library will run on 10.3 PPC, but probably not 10.2 or below anymore. wchar.h did not exist on 10.2.

+

+FreeImage is now built with gcc 4.0 and will thus only run on 10.3.9 or above (some libraries may not exist on 10.3.8 and below).

+

+The FreeImage makefile makes use of the gcc "-fvisibility=hidden" in order to avoid incompatibilities between 

+internal third party libraries and the OS libraries. This feature is available with gcc 4 or greater. 

+

+

+Ryan Rubley

+

+Building the Library

+--------------------

+Makefile detects the environment by calling 'uname'. Assuming this reports 'Darwin' on your system, Makefile will automatically

+defer commands to Makefile.osx. If this doesn't work, type 'make -f Makefile.osx' in place of just 'make'

+

+The build process is as simple as this: 

+1) Enter the FreeImage directory

+2) Build the distribution: 

+make

+3) The libraries and header will be in the Dist directory when the build is finished

+

+To install FreeImage in the /usr/local/lib and /usr/local/include directories (not recommended):

+make install

+

+To clean all files produced during the build process:

+make clean

+

+

+Additional notes

+----------------

+

+Building on Mac OS X Leopard : 

+

+Install the xcode dev tools from the Leopard disk. 

+When installing the dev tools make sure to have installed 10.3.9 SDK (it's not selected by default). 

+

diff --git a/README.solaris b/README.solaris
new file mode 100644
index 0000000..bf6431c
--- /dev/null
+++ b/README.solaris
@@ -0,0 +1,67 @@
+Release Notes

+--------------

+Hey folks, 

+

+I just went through the process of building and using the freeimage library

+on Solaris 9.  Things don't work out of the box so I thought I would share my

+experiences in case someone else wants to do the same.

+

+I'm using Solaris 9, and I have installed all the development libraries, make,

+and the gcc 3.3.2 found on sunfreeware.com.

+

+You have to use the make from sunfreeware because the Solaris 9 make program

+chokes hard on FreeImages makefiles.

+

+First thing I had to do was modify the main FreeImage makefile:

+

+1. go to the $(SHAREDLIB): line and replace the $(CC) line with the following.

+(there are 2 corrections)

+

+$(CC) -s -G -Wl,-soname=$(LIBNAME) -o $@ $(MODULES) $(LIBRARIES)

+

+The two changes are -G instead of -shared, and the = sign instead of a comma

+after the -soname.

+

+2. change INSTALLDIR = /usr/lib to INSTALLDIR = /usr/local/lib

+

+This is because the sunfreeware tools assume the libs being built will reside

+in /usr/local/lib and thus set the default linker search paths to that.  Another

+solution for this would be to use the -R and -L linker options, but I chose

+the easy way :)

+

+That's it!  You can now use freeimage.   

+

+Also, if you have an autoconf/automake project that links against FreeImage,

+you can use the following in your configure.in, it works rather well for me:

+

+AC_CHECK_LIB(freeimage-3.5.0, FreeImage_Initialise, [],

+                                 [AC_MSG_ERROR([libfreeimage-3.5.0.so required and missing. See

+http://freeimage.sourceforge.net.]) ])

+

+the AC_CHECK_LIB macro will not only find the library, it will automatically

+link against it as well so you dont have to add it to your Makefile.am.

+

+I hope this helps someone!

+

+---

+ogtharox at users.sourceforge.net

+

+

+Installation

+------------

+Note: You will need to have root privileges in order to install the library in the /usr/local/lib directory.

+The installation process is as simple as this : 

+1) Enter the FreeImage directory

+2) Build the distribution : 

+make -f Makefile.solaris

+make -f Makefile.solaris install

+3) Clean all files produced during the build process

+make -f Makefile.solaris clean

+

+Release Notes for Solaris/Sparc

+--------------------------------

+Under Solaris/Sparc, you will need to modify the following line : 

+COMPILERFLAGS = -O3

+modified into

+COMPILERFLAGS = -O3 -DBYTE_ORDER=BIG_ENDIAN -D__BIG_ENDIAN__

+

diff --git a/Source/CacheFile.h b/Source/CacheFile.h
new file mode 100644
index 0000000..eaf82d8
--- /dev/null
+++ b/Source/CacheFile.h
@@ -0,0 +1,92 @@
+// ==========================================================
+// Multi-Page functions
+//
+// Design and implementation by
+// - Floris van den Berg (flvdberg@wxs.nl)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#ifndef CACHEFILE_H
+#define CACHEFILE_H
+
+// ----------------------------------------------------------
+
+#include "FreeImage.h"
+#include "Utilities.h"
+
+// ----------------------------------------------------------
+
+static const int CACHE_SIZE = 32;
+static const int BLOCK_SIZE = (64 * 1024) - 8;
+
+// ----------------------------------------------------------
+
+#ifdef _WIN32
+#pragma pack(push, 1)
+#else
+#pragma pack(1)
+#endif // _WIN32
+
+struct Block {
+     unsigned nr;
+     unsigned next;
+     BYTE *data;
+};
+
+#ifdef _WIN32
+#pragma pack(pop)
+#else
+#pragma pack()
+#endif // _WIN32
+
+// ----------------------------------------------------------
+
+class CacheFile {
+	typedef std::list<Block *> PageCache;
+	typedef std::list<Block *>::iterator PageCacheIt;
+	typedef std::map<int, PageCacheIt> PageMap;
+	typedef std::map<int, PageCacheIt>::iterator PageMapIt;
+
+public :
+	CacheFile(const char *filename, BOOL keep_in_memory);
+	~CacheFile();
+
+	BOOL open();
+	void close();
+	BOOL readFile(BYTE *data, int nr, int size);
+	int writeFile(BYTE *data, int size);
+	void deleteFile(int nr);
+
+private :
+	void cleanupMemCache();
+	int allocateBlock();
+	Block *lockBlock(int nr);
+	BOOL unlockBlock(int nr);
+	BOOL deleteBlock(int nr);
+
+private :
+	FILE *m_file;
+	std::string m_filename;
+	std::list<int> m_free_pages;
+	PageCache m_page_cache_mem;
+	PageCache m_page_cache_disk;
+	PageMap m_page_map;
+	int m_page_count;
+	Block *m_current_block;
+	BOOL m_keep_in_memory;
+};
+
+#endif // CACHEFILE_H
diff --git a/Source/DeprecationManager/Deprecated.cpp b/Source/DeprecationManager/Deprecated.cpp
new file mode 100644
index 0000000..8ca5e71
--- /dev/null
+++ b/Source/DeprecationManager/Deprecated.cpp
@@ -0,0 +1,36 @@
+// ==========================================================
+// Deprecated functions
+//
+// Design and implementation by
+// - Floris van den Berg (flvdberg@wxs.nl)
+// - Hervé Drolon (drolon@infonie.fr)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#include "FreeImage.h"
+
+#include "../DeprecationManager/DeprecationMgr.h"
+
+// ----------------------------------------------------------
+
+FIBITMAP *DLL_CALLCONV 
+FreeImage_RotateClassic(FIBITMAP *dib, double angle) {
+#ifdef _WIN32
+	DEPRECATE("FreeImage_RotateClassic()", "FreeImage_Rotate()")
+#endif // _WIN32
+	return FreeImage_Rotate(dib, angle, NULL);
+}
+
diff --git a/Source/DeprecationManager/DeprecationMgr.cpp b/Source/DeprecationManager/DeprecationMgr.cpp
new file mode 100644
index 0000000..bf82dfa
--- /dev/null
+++ b/Source/DeprecationManager/DeprecationMgr.cpp
@@ -0,0 +1,103 @@
+// ==========================================================
+// Deprecation Manager
+//
+// Design and implementation by
+// - Noel Llopis (Game Programming Gems II)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#ifdef _MSC_VER 
+#pragma warning (disable : 4786) // identifier was truncated to 'number' characters
+#endif 
+
+#ifdef _WIN32
+#include <windows.h>
+#endif // _WIN32
+#include "FreeImage.h"
+#include "Utilities.h"
+#include "DeprecationMgr.h"
+
+// ==========================================================
+
+DeprecationMgr::DeprecationMgr() {
+}
+
+DeprecationMgr::~DeprecationMgr() {
+#ifdef _WIN32
+	if (!m_functions.empty()) {
+		OutputDebugString( "*************************************************************************************\n" );
+		OutputDebugString( "This is a warning, because you use one or more deprecated functions.\nContinuing to use these functions might eventually render your program uncompilable.\nThe following functions are deprecated:\n\n" );
+
+		for (std::map<const char *, DeprecatedFunction>::iterator i = m_functions.begin(); i != m_functions.end(); ++i) {
+			DeprecatedFunction *function = &((*i).second);
+
+			char txt[255];
+
+			sprintf(txt, " * %s called from %i different places. Instead use %s.\n", function->old_function_name,  function->called_from.size(), function->new_function_name);
+
+			OutputDebugString(txt);
+		}
+
+		OutputDebugString( "*************************************************************************************\n" );
+
+		m_functions.clear();
+	}
+#endif // _WIN32
+}
+
+// ==========================================================
+
+DeprecationMgr *
+DeprecationMgr::GetInstance() {
+	static DeprecationMgr Instance;
+	return &Instance;
+}
+
+// ==========================================================
+
+void
+DeprecationMgr::AddDeprecatedFunction(const char *old_function_name, const char *new_function_name, const void *frame_ptr) {
+#ifdef _WIN32
+	int *preturn = (int *)frame_ptr + 1; // usual return address @ [ebp+4]
+	int called_from = IsBadReadPtr(preturn, 4) ? 0 : *preturn;
+
+	// check if this function was already listed as deprecated
+	// if it wasn't, make a new entry for it
+	// if it was, keep track of where it's called from.
+
+	std::map<const char *, DeprecatedFunction>::iterator existing_function = m_functions.find(old_function_name);
+
+	if (existing_function == m_functions.end()) {
+		DeprecatedFunction function;
+
+		function.old_function_name = old_function_name;
+		function.new_function_name = new_function_name;
+		function.called_from.insert(called_from);
+
+		m_functions[old_function_name] = function;
+	} else {
+		// since we're keeping track of the addresses this function
+		// was called from in a set, we don't need to check whether we've
+		// already added the address.
+
+		DeprecatedFunction *function = &((*existing_function).second);
+
+		function->called_from.insert(called_from);
+	}
+#endif // _WIN32
+}
+
+
diff --git a/Source/DeprecationManager/DeprecationMgr.h b/Source/DeprecationManager/DeprecationMgr.h
new file mode 100644
index 0000000..9141f23
--- /dev/null
+++ b/Source/DeprecationManager/DeprecationMgr.h
@@ -0,0 +1,83 @@
+// ==========================================================
+// Deprecation Manager
+//
+// Design and implementation by
+// - Noel Llopis (Game Programming Gems II)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#ifndef DEPRECATIONMGR_H
+#define DEPRECATIONMGR_H
+
+#ifdef _MSC_VER 
+#pragma warning(disable : 4786 )  // identifier was truncated to 'number' characters
+#endif 
+
+#include "Utilities.h"
+
+// ==========================================================
+
+#if !defined(_M_X64) && defined(_MSC_VER)
+	#define DEPRECATE(a,b) \
+	{ \
+		void *fptr;	\
+		_asm { mov fptr, ebp }	\
+		DeprecationMgr::GetInstance()->AddDeprecatedFunction(a, b, fptr); \
+	}
+
+#elif defined(__i386__) && defined(__GNUC__)
+	#define DEPRECATE(a,b) \
+	{ \
+		void *fptr;	\
+		__asm__("movl %%ebp, %0" : "=m" (fptr));	\
+		DeprecationMgr::GetInstance()->AddDeprecatedFunction(a, b, fptr); \
+	}
+
+#else
+	// default fallback case, which does not use the ebp register's content
+	#define DEPRECATE(a,b) \
+	{ \
+		void *fptr = NULL;	\
+		DeprecationMgr::GetInstance()->AddDeprecatedFunction(a, b, fptr); \
+	}
+#endif
+
+// ==========================================================
+
+class DeprecationMgr {
+#if (_MSC_VER == 1100) // VC 5.0 need to look into the docs for the compiler for the value of each version
+public:
+#else
+private:
+#endif
+
+	struct DeprecatedFunction {
+		const char *old_function_name;
+		const char *new_function_name;
+		std::set<int> called_from;
+	};
+
+	std::map<const char *, DeprecatedFunction> m_functions;
+
+public:
+	DeprecationMgr();
+	~DeprecationMgr();
+
+	static DeprecationMgr * GetInstance ( void );
+	void AddDeprecatedFunction(const char *old_function_name, const char *new_function_name, const void *frame_ptr);
+};
+
+#endif //DEPRECATIONMGR_H
diff --git a/Source/FreeImage.h b/Source/FreeImage.h
new file mode 100644
index 0000000..c9f643a
--- /dev/null
+++ b/Source/FreeImage.h
@@ -0,0 +1,1090 @@
+// ==========================================================
+// FreeImage 3
+//
+// Design and implementation by
+// - Floris van den Berg (flvdberg@wxs.nl)
+// - Hervé Drolon (drolon@infonie.fr)
+//
+// Contributors:
+// - Adam Gates (radad@xoasis.com)
+// - Alex Kwak
+// - Alexander Dymerets (sashad@te.net.ua)
+// - Detlev Vendt (detlev.vendt@brillit.de)
+// - Jan L. Nauta (jln@magentammt.com)
+// - Jani Kajala (janik@remedy.fi)
+// - Juergen Riecker (j.riecker@gmx.de)
+// - Karl-Heinz Bussian (khbussian@moss.de)
+// - Laurent Rocher (rocherl@club-internet.fr)
+// - Luca Piergentili (l.pierge@terra.es)
+// - Machiel ten Brinke (brinkem@uni-one.nl)
+// - Markus Loibl (markus.loibl@epost.de)
+// - Martin Weber (martweb@gmx.net)
+// - Matthias Wandel (mwandel@rim.net)
+// - Michal Novotny (michal@etc.cz)
+// - Petr Pytelka (pyta@lightcomp.com)
+// - Riley McNiff (rmcniff@marexgroup.com)
+// - Ryan Rubley (ryan@lostreality.org)
+// - Volker Gärtner (volkerg@gmx.at)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#ifndef FREEIMAGE_H
+#define FREEIMAGE_H
+
+// Version information ------------------------------------------------------
+
+#define FREEIMAGE_MAJOR_VERSION   3
+#define FREEIMAGE_MINOR_VERSION   13
+#define FREEIMAGE_RELEASE_SERIAL  0
+
+// Compiler options ---------------------------------------------------------
+
+#include <wchar.h>	// needed for UNICODE functions
+
+#if defined(FREEIMAGE_LIB)
+	#define DLL_API
+	#define DLL_CALLCONV
+#else
+	#if defined(_WIN32) || defined(__WIN32__)
+		#define DLL_CALLCONV __stdcall
+		// The following ifdef block is the standard way of creating macros which make exporting 
+		// from a DLL simpler. All files within this DLL are compiled with the FREEIMAGE_EXPORTS
+		// symbol defined on the command line. this symbol should not be defined on any project
+		// that uses this DLL. This way any other project whose source files include this file see 
+		// DLL_API functions as being imported from a DLL, wheras this DLL sees symbols
+		// defined with this macro as being exported.
+		#ifdef FREEIMAGE_EXPORTS
+			#define DLL_API __declspec(dllexport)
+		#else
+			#define DLL_API __declspec(dllimport)
+		#endif // FREEIMAGE_EXPORTS
+	#else 
+		// try the gcc visibility support (see http://gcc.gnu.org/wiki/Visibility)
+		#if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+			#ifndef GCC_HASCLASSVISIBILITY
+				#define GCC_HASCLASSVISIBILITY
+			#endif
+		#endif // __GNUC__
+		#define DLL_CALLCONV
+		#if defined(GCC_HASCLASSVISIBILITY)
+			#define DLL_API __attribute__ ((visibility("default")))
+		#else
+			#define DLL_API
+		#endif		
+	#endif // WIN32 / !WIN32
+#endif // FREEIMAGE_LIB
+
+// Some versions of gcc may have BYTE_ORDER or __BYTE_ORDER defined
+// If your big endian system isn't being detected, add an OS specific check
+#if (defined(BYTE_ORDER) && BYTE_ORDER==BIG_ENDIAN) || \
+	(defined(__BYTE_ORDER) && __BYTE_ORDER==__BIG_ENDIAN) || \
+	defined(__BIG_ENDIAN__)
+#define FREEIMAGE_BIGENDIAN
+#endif // BYTE_ORDER
+
+// This really only affects 24 and 32 bit formats, the rest are always RGB order.
+#define FREEIMAGE_COLORORDER_BGR	0
+#define FREEIMAGE_COLORORDER_RGB	1
+#if defined(FREEIMAGE_BIGENDIAN)
+#define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_RGB
+#else
+#define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_BGR
+#endif
+
+// Ensure 4-byte enums if we're using Borland C++ compilers
+#if defined(__BORLANDC__)
+#pragma option push -b
+#endif
+
+// For C compatibility --------------------------------------------------------
+
+#ifdef __cplusplus
+#define FI_DEFAULT(x)	= x
+#define FI_ENUM(x)      enum x
+#define FI_STRUCT(x)	struct x
+#else
+#define FI_DEFAULT(x)
+#define FI_ENUM(x)      typedef int x; enum x
+#define FI_STRUCT(x)	typedef struct x x; struct x
+#endif
+
+// Bitmap types -------------------------------------------------------------
+
+FI_STRUCT (FIBITMAP) { void *data; };
+FI_STRUCT (FIMULTIBITMAP) { void *data; };
+
+// Types used in the library (directly copied from Windows) -----------------
+
+#if defined(__MINGW32__) && defined(_WINDOWS_H)
+#define _WINDOWS_	// prevent a bug in MinGW32
+#endif // __MINGW32__
+
+#ifndef _WINDOWS_
+#define _WINDOWS_
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+#ifndef TRUE
+#define TRUE 1
+#endif
+#ifndef NULL
+#define NULL 0
+#endif
+
+#ifndef SEEK_SET
+#define SEEK_SET  0
+#define SEEK_CUR  1
+#define SEEK_END  2
+#endif
+
+#ifndef _MSC_VER
+// define portable types for 32-bit / 64-bit OS
+#include <inttypes.h>
+typedef int32_t BOOL;
+typedef uint8_t BYTE;
+typedef uint16_t WORD;
+typedef uint32_t DWORD;
+typedef int32_t LONG;
+#else
+// MS is not C99 ISO compliant
+typedef long BOOL;
+typedef unsigned char BYTE;
+typedef unsigned short WORD;
+typedef unsigned long DWORD;
+typedef long LONG;
+#endif // _MSC_VER
+
+#if (defined(_WIN32) || defined(__WIN32__))
+#pragma pack(push, 1)
+#else
+#pragma pack(1)
+#endif // WIN32
+
+typedef struct tagRGBQUAD {
+#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
+  BYTE rgbBlue;
+  BYTE rgbGreen;
+  BYTE rgbRed;
+#else
+  BYTE rgbRed;
+  BYTE rgbGreen;
+  BYTE rgbBlue;
+#endif // FREEIMAGE_COLORORDER
+  BYTE rgbReserved;
+} RGBQUAD;
+
+typedef struct tagRGBTRIPLE {
+#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
+  BYTE rgbtBlue;
+  BYTE rgbtGreen;
+  BYTE rgbtRed;
+#else
+  BYTE rgbtRed;
+  BYTE rgbtGreen;
+  BYTE rgbtBlue;
+#endif // FREEIMAGE_COLORORDER
+} RGBTRIPLE;
+
+#if (defined(_WIN32) || defined(__WIN32__))
+#pragma pack(pop)
+#else
+#pragma pack()
+#endif // WIN32
+
+typedef struct tagBITMAPINFOHEADER{
+  DWORD biSize;
+  LONG  biWidth; 
+  LONG  biHeight; 
+  WORD  biPlanes; 
+  WORD  biBitCount;
+  DWORD biCompression; 
+  DWORD biSizeImage; 
+  LONG  biXPelsPerMeter; 
+  LONG  biYPelsPerMeter; 
+  DWORD biClrUsed; 
+  DWORD biClrImportant;
+} BITMAPINFOHEADER, *PBITMAPINFOHEADER; 
+
+typedef struct tagBITMAPINFO { 
+  BITMAPINFOHEADER bmiHeader; 
+  RGBQUAD          bmiColors[1];
+} BITMAPINFO, *PBITMAPINFO;
+
+#endif // _WINDOWS_
+
+// Types used in the library (specific to FreeImage) ------------------------
+
+#if (defined(_WIN32) || defined(__WIN32__))
+#pragma pack(push, 1)
+#else
+#pragma pack(1)
+#endif // WIN32
+
+/** 48-bit RGB 
+*/
+typedef struct tagFIRGB16 {
+	WORD red;
+	WORD green;
+	WORD blue;
+} FIRGB16;
+
+/** 64-bit RGBA
+*/
+typedef struct tagFIRGBA16 {
+	WORD red;
+	WORD green;
+	WORD blue;
+	WORD alpha;
+} FIRGBA16;
+
+/** 96-bit RGB Float
+*/
+typedef struct tagFIRGBF {
+	float red;
+	float green;
+	float blue;
+} FIRGBF;
+
+/** 128-bit RGBA Float
+*/
+typedef struct tagFIRGBAF {
+	float red;
+	float green;
+	float blue;
+	float alpha;
+} FIRGBAF;
+
+/** Data structure for COMPLEX type (complex number)
+*/
+typedef struct tagFICOMPLEX {
+    /// real part
+	double r;
+	/// imaginary part
+    double i;
+} FICOMPLEX;
+
+#if (defined(_WIN32) || defined(__WIN32__))
+#pragma pack(pop)
+#else
+#pragma pack()
+#endif // WIN32
+
+// Indexes for byte arrays, masks and shifts for treating pixels as words ---
+// These coincide with the order of RGBQUAD and RGBTRIPLE -------------------
+
+#ifndef FREEIMAGE_BIGENDIAN
+#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
+// Little Endian (x86 / MS Windows, Linux) : BGR(A) order
+#define FI_RGBA_RED				2
+#define FI_RGBA_GREEN			1
+#define FI_RGBA_BLUE			0
+#define FI_RGBA_ALPHA			3
+#define FI_RGBA_RED_MASK		0x00FF0000
+#define FI_RGBA_GREEN_MASK		0x0000FF00
+#define FI_RGBA_BLUE_MASK		0x000000FF
+#define FI_RGBA_ALPHA_MASK		0xFF000000
+#define FI_RGBA_RED_SHIFT		16
+#define FI_RGBA_GREEN_SHIFT		8
+#define FI_RGBA_BLUE_SHIFT		0
+#define FI_RGBA_ALPHA_SHIFT		24
+#else
+// Little Endian (x86 / MaxOSX) : RGB(A) order
+#define FI_RGBA_RED				0
+#define FI_RGBA_GREEN			1
+#define FI_RGBA_BLUE			2
+#define FI_RGBA_ALPHA			3
+#define FI_RGBA_RED_MASK		0x000000FF
+#define FI_RGBA_GREEN_MASK		0x0000FF00
+#define FI_RGBA_BLUE_MASK		0x00FF0000
+#define FI_RGBA_ALPHA_MASK		0xFF000000
+#define FI_RGBA_RED_SHIFT		0
+#define FI_RGBA_GREEN_SHIFT		8
+#define FI_RGBA_BLUE_SHIFT		16
+#define FI_RGBA_ALPHA_SHIFT		24
+#endif // FREEIMAGE_COLORORDER
+#else
+#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
+// Big Endian (PPC / none) : BGR(A) order
+#define FI_RGBA_RED				2
+#define FI_RGBA_GREEN			1
+#define FI_RGBA_BLUE			0
+#define FI_RGBA_ALPHA			3
+#define FI_RGBA_RED_MASK		0x0000FF00
+#define FI_RGBA_GREEN_MASK		0x00FF0000
+#define FI_RGBA_BLUE_MASK		0xFF000000
+#define FI_RGBA_ALPHA_MASK		0x000000FF
+#define FI_RGBA_RED_SHIFT		8
+#define FI_RGBA_GREEN_SHIFT		16
+#define FI_RGBA_BLUE_SHIFT		24
+#define FI_RGBA_ALPHA_SHIFT		0
+#else
+// Big Endian (PPC / Linux, MaxOSX) : RGB(A) order
+#define FI_RGBA_RED				0
+#define FI_RGBA_GREEN			1
+#define FI_RGBA_BLUE			2
+#define FI_RGBA_ALPHA			3
+#define FI_RGBA_RED_MASK		0xFF000000
+#define FI_RGBA_GREEN_MASK		0x00FF0000
+#define FI_RGBA_BLUE_MASK		0x0000FF00
+#define FI_RGBA_ALPHA_MASK		0x000000FF
+#define FI_RGBA_RED_SHIFT		24
+#define FI_RGBA_GREEN_SHIFT		16
+#define FI_RGBA_BLUE_SHIFT		8
+#define FI_RGBA_ALPHA_SHIFT		0
+#endif // FREEIMAGE_COLORORDER
+#endif // FREEIMAGE_BIGENDIAN
+
+#define FI_RGBA_RGB_MASK		(FI_RGBA_RED_MASK|FI_RGBA_GREEN_MASK|FI_RGBA_BLUE_MASK)
+
+// The 16bit macros only include masks and shifts, since each color element is not byte aligned
+
+#define FI16_555_RED_MASK		0x7C00
+#define FI16_555_GREEN_MASK		0x03E0
+#define FI16_555_BLUE_MASK		0x001F
+#define FI16_555_RED_SHIFT		10
+#define FI16_555_GREEN_SHIFT	5
+#define FI16_555_BLUE_SHIFT		0
+#define FI16_565_RED_MASK		0xF800
+#define FI16_565_GREEN_MASK		0x07E0
+#define FI16_565_BLUE_MASK		0x001F
+#define FI16_565_RED_SHIFT		11
+#define FI16_565_GREEN_SHIFT	5
+#define FI16_565_BLUE_SHIFT		0
+
+// ICC profile support ------------------------------------------------------
+
+#define FIICC_DEFAULT			0x00
+#define FIICC_COLOR_IS_CMYK		0x01
+
+FI_STRUCT (FIICCPROFILE) { 
+	WORD    flags;	// info flag
+	DWORD	size;	// profile's size measured in bytes
+	void   *data;	// points to a block of contiguous memory containing the profile
+};
+
+// Important enums ----------------------------------------------------------
+
+/** I/O image format identifiers.
+*/
+FI_ENUM(FREE_IMAGE_FORMAT) {
+	FIF_UNKNOWN = -1,
+	FIF_BMP		= 0,
+	FIF_ICO		= 1,
+	FIF_JPEG	= 2,
+	FIF_JNG		= 3,
+	FIF_KOALA	= 4,
+	FIF_LBM		= 5,
+	FIF_IFF = FIF_LBM,
+	FIF_MNG		= 6,
+	FIF_PBM		= 7,
+	FIF_PBMRAW	= 8,
+	FIF_PCD		= 9,
+	FIF_PCX		= 10,
+	FIF_PGM		= 11,
+	FIF_PGMRAW	= 12,
+	FIF_PNG		= 13,
+	FIF_PPM		= 14,
+	FIF_PPMRAW	= 15,
+	FIF_RAS		= 16,
+	FIF_TARGA	= 17,
+	FIF_TIFF	= 18,
+	FIF_WBMP	= 19,
+	FIF_PSD		= 20,
+	FIF_CUT		= 21,
+	FIF_XBM		= 22,
+	FIF_XPM		= 23,
+	FIF_DDS		= 24,
+	FIF_GIF     = 25,
+	FIF_HDR		= 26,
+	FIF_FAXG3	= 27,
+	FIF_SGI		= 28,
+	FIF_EXR		= 29,
+	FIF_J2K		= 30,
+	FIF_JP2		= 31,
+	FIF_PFM		= 32,
+	FIF_PICT	= 33,
+	FIF_RAW		= 34
+};
+
+/** Image type used in FreeImage.
+*/
+FI_ENUM(FREE_IMAGE_TYPE) {
+	FIT_UNKNOWN = 0,	// unknown type
+	FIT_BITMAP  = 1,	// standard image			: 1-, 4-, 8-, 16-, 24-, 32-bit
+	FIT_UINT16	= 2,	// array of unsigned short	: unsigned 16-bit
+	FIT_INT16	= 3,	// array of short			: signed 16-bit
+	FIT_UINT32	= 4,	// array of unsigned long	: unsigned 32-bit
+	FIT_INT32	= 5,	// array of long			: signed 32-bit
+	FIT_FLOAT	= 6,	// array of float			: 32-bit IEEE floating point
+	FIT_DOUBLE	= 7,	// array of double			: 64-bit IEEE floating point
+	FIT_COMPLEX	= 8,	// array of FICOMPLEX		: 2 x 64-bit IEEE floating point
+	FIT_RGB16	= 9,	// 48-bit RGB image			: 3 x 16-bit
+	FIT_RGBA16	= 10,	// 64-bit RGBA image		: 4 x 16-bit
+	FIT_RGBF	= 11,	// 96-bit RGB float image	: 3 x 32-bit IEEE floating point
+	FIT_RGBAF	= 12	// 128-bit RGBA float image	: 4 x 32-bit IEEE floating point
+};
+
+/** Image color type used in FreeImage.
+*/
+FI_ENUM(FREE_IMAGE_COLOR_TYPE) {
+	FIC_MINISWHITE = 0,		// min value is white
+    FIC_MINISBLACK = 1,		// min value is black
+    FIC_RGB        = 2,		// RGB color model
+    FIC_PALETTE    = 3,		// color map indexed
+	FIC_RGBALPHA   = 4,		// RGB color model with alpha channel
+	FIC_CMYK       = 5		// CMYK color model
+};
+
+/** Color quantization algorithms.
+Constants used in FreeImage_ColorQuantize.
+*/
+FI_ENUM(FREE_IMAGE_QUANTIZE) {
+    FIQ_WUQUANT = 0,		// Xiaolin Wu color quantization algorithm
+    FIQ_NNQUANT = 1			// NeuQuant neural-net quantization algorithm by Anthony Dekker
+};
+
+/** Dithering algorithms.
+Constants used in FreeImage_Dither.
+*/
+FI_ENUM(FREE_IMAGE_DITHER) {
+    FID_FS			= 0,	// Floyd & Steinberg error diffusion
+	FID_BAYER4x4	= 1,	// Bayer ordered dispersed dot dithering (order 2 dithering matrix)
+	FID_BAYER8x8	= 2,	// Bayer ordered dispersed dot dithering (order 3 dithering matrix)
+	FID_CLUSTER6x6	= 3,	// Ordered clustered dot dithering (order 3 - 6x6 matrix)
+	FID_CLUSTER8x8	= 4,	// Ordered clustered dot dithering (order 4 - 8x8 matrix)
+	FID_CLUSTER16x16= 5,	// Ordered clustered dot dithering (order 8 - 16x16 matrix)
+	FID_BAYER16x16	= 6		// Bayer ordered dispersed dot dithering (order 4 dithering matrix)
+};
+
+/** Lossless JPEG transformations
+Constants used in FreeImage_JPEGTransform
+*/
+FI_ENUM(FREE_IMAGE_JPEG_OPERATION) {
+	FIJPEG_OP_NONE			= 0,	// no transformation
+	FIJPEG_OP_FLIP_H		= 1,	// horizontal flip
+	FIJPEG_OP_FLIP_V		= 2,	// vertical flip
+	FIJPEG_OP_TRANSPOSE		= 3,	// transpose across UL-to-LR axis
+	FIJPEG_OP_TRANSVERSE	= 4,	// transpose across UR-to-LL axis
+	FIJPEG_OP_ROTATE_90		= 5,	// 90-degree clockwise rotation
+	FIJPEG_OP_ROTATE_180	= 6,	// 180-degree rotation
+	FIJPEG_OP_ROTATE_270	= 7		// 270-degree clockwise (or 90 ccw)
+};
+
+/** Tone mapping operators.
+Constants used in FreeImage_ToneMapping.
+*/
+FI_ENUM(FREE_IMAGE_TMO) {
+    FITMO_DRAGO03	 = 0,	// Adaptive logarithmic mapping (F. Drago, 2003)
+	FITMO_REINHARD05 = 1,	// Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005)
+	FITMO_FATTAL02	 = 2	// Gradient domain high dynamic range compression (R. Fattal, 2002)
+};
+
+/** Upsampling / downsampling filters. 
+Constants used in FreeImage_Rescale.
+*/
+FI_ENUM(FREE_IMAGE_FILTER) {
+	FILTER_BOX		  = 0,	// Box, pulse, Fourier window, 1st order (constant) b-spline
+	FILTER_BICUBIC	  = 1,	// Mitchell & Netravali's two-param cubic filter
+	FILTER_BILINEAR   = 2,	// Bilinear filter
+	FILTER_BSPLINE	  = 3,	// 4th order (cubic) b-spline
+	FILTER_CATMULLROM = 4,	// Catmull-Rom spline, Overhauser spline
+	FILTER_LANCZOS3	  = 5	// Lanczos3 filter
+};
+
+/** Color channels.
+Constants used in color manipulation routines.
+*/
+FI_ENUM(FREE_IMAGE_COLOR_CHANNEL) {
+	FICC_RGB	= 0,	// Use red, green and blue channels
+	FICC_RED	= 1,	// Use red channel
+	FICC_GREEN	= 2,	// Use green channel
+	FICC_BLUE	= 3,	// Use blue channel
+	FICC_ALPHA	= 4,	// Use alpha channel
+	FICC_BLACK	= 5,	// Use black channel
+	FICC_REAL	= 6,	// Complex images: use real part
+	FICC_IMAG	= 7,	// Complex images: use imaginary part
+	FICC_MAG	= 8,	// Complex images: use magnitude
+	FICC_PHASE	= 9		// Complex images: use phase
+};
+
+// Metadata support ---------------------------------------------------------
+
+/**
+  Tag data type information (based on TIFF specifications)
+
+  Note: RATIONALs are the ratio of two 32-bit integer values.
+*/
+FI_ENUM(FREE_IMAGE_MDTYPE) {
+	FIDT_NOTYPE		= 0,	// placeholder 
+	FIDT_BYTE		= 1,	// 8-bit unsigned integer 
+	FIDT_ASCII		= 2,	// 8-bit bytes w/ last byte null 
+	FIDT_SHORT		= 3,	// 16-bit unsigned integer 
+	FIDT_LONG		= 4,	// 32-bit unsigned integer 
+	FIDT_RATIONAL	= 5,	// 64-bit unsigned fraction 
+	FIDT_SBYTE		= 6,	// 8-bit signed integer 
+	FIDT_UNDEFINED	= 7,	// 8-bit untyped data 
+	FIDT_SSHORT		= 8,	// 16-bit signed integer 
+	FIDT_SLONG		= 9,	// 32-bit signed integer 
+	FIDT_SRATIONAL	= 10,	// 64-bit signed fraction 
+	FIDT_FLOAT		= 11,	// 32-bit IEEE floating point 
+	FIDT_DOUBLE		= 12,	// 64-bit IEEE floating point 
+	FIDT_IFD		= 13,	// 32-bit unsigned integer (offset) 
+	FIDT_PALETTE	= 14	// 32-bit RGBQUAD 
+};
+
+/**
+  Metadata models supported by FreeImage
+*/
+FI_ENUM(FREE_IMAGE_MDMODEL) {
+	FIMD_NODATA			= -1,
+	FIMD_COMMENTS		= 0,	// single comment or keywords
+	FIMD_EXIF_MAIN		= 1,	// Exif-TIFF metadata
+	FIMD_EXIF_EXIF		= 2,	// Exif-specific metadata
+	FIMD_EXIF_GPS		= 3,	// Exif GPS metadata
+	FIMD_EXIF_MAKERNOTE = 4,	// Exif maker note metadata
+	FIMD_EXIF_INTEROP	= 5,	// Exif interoperability metadata
+	FIMD_IPTC			= 6,	// IPTC/NAA metadata
+	FIMD_XMP			= 7,	// Abobe XMP metadata
+	FIMD_GEOTIFF		= 8,	// GeoTIFF metadata
+	FIMD_ANIMATION		= 9,	// Animation metadata
+	FIMD_CUSTOM			= 10	// Used to attach other metadata types to a dib
+};
+
+/**
+  Handle to a metadata model
+*/
+FI_STRUCT (FIMETADATA) { void *data; };
+
+/**
+  Handle to a FreeImage tag
+*/
+FI_STRUCT (FITAG) { void *data; };
+
+// File IO routines ---------------------------------------------------------
+
+#ifndef FREEIMAGE_IO
+#define FREEIMAGE_IO
+
+typedef void* fi_handle;
+typedef unsigned (DLL_CALLCONV *FI_ReadProc) (void *buffer, unsigned size, unsigned count, fi_handle handle);
+typedef unsigned (DLL_CALLCONV *FI_WriteProc) (void *buffer, unsigned size, unsigned count, fi_handle handle);
+typedef int (DLL_CALLCONV *FI_SeekProc) (fi_handle handle, long offset, int origin);
+typedef long (DLL_CALLCONV *FI_TellProc) (fi_handle handle);
+
+#if (defined(_WIN32) || defined(__WIN32__))
+#pragma pack(push, 1)
+#else
+#pragma pack(1)
+#endif // WIN32
+
+FI_STRUCT(FreeImageIO) {
+	FI_ReadProc  read_proc;     // pointer to the function used to read data
+    FI_WriteProc write_proc;    // pointer to the function used to write data
+    FI_SeekProc  seek_proc;     // pointer to the function used to seek
+    FI_TellProc  tell_proc;     // pointer to the function used to aquire the current position
+};
+
+#if (defined(_WIN32) || defined(__WIN32__))
+#pragma pack(pop)
+#else
+#pragma pack()
+#endif // WIN32
+
+/**
+Handle to a memory I/O stream
+*/
+FI_STRUCT (FIMEMORY) { void *data; };
+
+#endif // FREEIMAGE_IO
+
+// Plugin routines ----------------------------------------------------------
+
+#ifndef PLUGINS
+#define PLUGINS
+
+typedef const char *(DLL_CALLCONV *FI_FormatProc)(void);
+typedef const char *(DLL_CALLCONV *FI_DescriptionProc)(void);
+typedef const char *(DLL_CALLCONV *FI_ExtensionListProc)(void);
+typedef const char *(DLL_CALLCONV *FI_RegExprProc)(void);
+typedef void *(DLL_CALLCONV *FI_OpenProc)(FreeImageIO *io, fi_handle handle, BOOL read);
+typedef void (DLL_CALLCONV *FI_CloseProc)(FreeImageIO *io, fi_handle handle, void *data);
+typedef int (DLL_CALLCONV *FI_PageCountProc)(FreeImageIO *io, fi_handle handle, void *data);
+typedef int (DLL_CALLCONV *FI_PageCapabilityProc)(FreeImageIO *io, fi_handle handle, void *data);
+typedef FIBITMAP *(DLL_CALLCONV *FI_LoadProc)(FreeImageIO *io, fi_handle handle, int page, int flags, void *data);
+typedef BOOL (DLL_CALLCONV *FI_SaveProc)(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data);
+typedef BOOL (DLL_CALLCONV *FI_ValidateProc)(FreeImageIO *io, fi_handle handle);
+typedef const char *(DLL_CALLCONV *FI_MimeProc)(void);
+typedef BOOL (DLL_CALLCONV *FI_SupportsExportBPPProc)(int bpp);
+typedef BOOL (DLL_CALLCONV *FI_SupportsExportTypeProc)(FREE_IMAGE_TYPE type);
+typedef BOOL (DLL_CALLCONV *FI_SupportsICCProfilesProc)(void);
+
+FI_STRUCT (Plugin) {
+	FI_FormatProc format_proc;
+	FI_DescriptionProc description_proc;
+	FI_ExtensionListProc extension_proc;
+	FI_RegExprProc regexpr_proc;
+	FI_OpenProc open_proc;
+	FI_CloseProc close_proc;
+	FI_PageCountProc pagecount_proc;
+	FI_PageCapabilityProc pagecapability_proc;
+	FI_LoadProc load_proc;
+	FI_SaveProc save_proc;
+	FI_ValidateProc validate_proc;
+	FI_MimeProc mime_proc;
+	FI_SupportsExportBPPProc supports_export_bpp_proc;
+	FI_SupportsExportTypeProc supports_export_type_proc;
+	FI_SupportsICCProfilesProc supports_icc_profiles_proc;
+};
+
+typedef void (DLL_CALLCONV *FI_InitProc)(Plugin *plugin, int format_id);
+
+#endif // PLUGINS
+
+
+// Load / Save flag constants -----------------------------------------------
+
+#define BMP_DEFAULT         0
+#define BMP_SAVE_RLE        1
+#define CUT_DEFAULT         0
+#define DDS_DEFAULT			0
+#define EXR_DEFAULT			0		// save data as half with piz-based wavelet compression
+#define EXR_FLOAT			0x0001	// save data as float instead of as half (not recommended)
+#define EXR_NONE			0x0002	// save with no compression
+#define EXR_ZIP				0x0004	// save with zlib compression, in blocks of 16 scan lines
+#define EXR_PIZ				0x0008	// save with piz-based wavelet compression
+#define EXR_PXR24			0x0010	// save with lossy 24-bit float compression
+#define EXR_B44				0x0020	// save with lossy 44% float compression - goes to 22% when combined with EXR_LC
+#define EXR_LC				0x0040	// save images with one luminance and two chroma channels, rather than as RGB (lossy compression)
+#define FAXG3_DEFAULT		0
+#define GIF_DEFAULT			0
+#define GIF_LOAD256			1		// Load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color
+#define GIF_PLAYBACK		2		// 'Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading
+#define HDR_DEFAULT			0
+#define ICO_DEFAULT         0
+#define ICO_MAKEALPHA		1		// convert to 32bpp and create an alpha channel from the AND-mask when loading
+#define IFF_DEFAULT         0
+#define J2K_DEFAULT			0		// save with a 16:1 rate
+#define JP2_DEFAULT			0		// save with a 16:1 rate
+#define JPEG_DEFAULT        0		// loading (see JPEG_FAST); saving (see JPEG_QUALITYGOOD|JPEG_SUBSAMPLING_420)
+#define JPEG_FAST           0x0001	// load the file as fast as possible, sacrificing some quality
+#define JPEG_ACCURATE       0x0002	// load the file with the best quality, sacrificing some speed
+#define JPEG_CMYK			0x0004	// load separated CMYK "as is" (use | to combine with other load flags)
+#define JPEG_EXIFROTATE		0x0008	// load and rotate according to Exif 'Orientation' tag if available
+#define JPEG_QUALITYSUPERB  0x80	// save with superb quality (100:1)
+#define JPEG_QUALITYGOOD    0x0100	// save with good quality (75:1)
+#define JPEG_QUALITYNORMAL  0x0200	// save with normal quality (50:1)
+#define JPEG_QUALITYAVERAGE 0x0400	// save with average quality (25:1)
+#define JPEG_QUALITYBAD     0x0800	// save with bad quality (10:1)
+#define JPEG_PROGRESSIVE	0x2000	// save as a progressive-JPEG (use | to combine with other save flags)
+#define JPEG_SUBSAMPLING_411 0x1000		// save with high 4x1 chroma subsampling (4:1:1) 
+#define JPEG_SUBSAMPLING_420 0x4000		// save with medium 2x2 medium chroma subsampling (4:2:0) - default value
+#define JPEG_SUBSAMPLING_422 0x8000		// save with low 2x1 chroma subsampling (4:2:2) 
+#define JPEG_SUBSAMPLING_444 0x10000	// save with no chroma subsampling (4:4:4)
+#define KOALA_DEFAULT       0
+#define LBM_DEFAULT         0
+#define MNG_DEFAULT         0
+#define PCD_DEFAULT         0
+#define PCD_BASE            1		// load the bitmap sized 768 x 512
+#define PCD_BASEDIV4        2		// load the bitmap sized 384 x 256
+#define PCD_BASEDIV16       3		// load the bitmap sized 192 x 128
+#define PCX_DEFAULT         0
+#define PFM_DEFAULT         0
+#define PICT_DEFAULT        0
+#define PNG_DEFAULT         0
+#define PNG_IGNOREGAMMA		1		// loading: avoid gamma correction
+#define PNG_Z_BEST_SPEED			0x0001	// save using ZLib level 1 compression flag (default value is 6)
+#define PNG_Z_DEFAULT_COMPRESSION	0x0006	// save using ZLib level 6 compression flag (default recommended value)
+#define PNG_Z_BEST_COMPRESSION		0x0009	// save using ZLib level 9 compression flag (default value is 6)
+#define PNG_Z_NO_COMPRESSION		0x0100	// save without ZLib compression
+#define PNG_INTERLACED				0x0200	// save using Adam7 interlacing (use | to combine with other save flags)
+#define PNM_DEFAULT         0
+#define PNM_SAVE_RAW        0       // If set the writer saves in RAW format (i.e. P4, P5 or P6)
+#define PNM_SAVE_ASCII      1       // If set the writer saves in ASCII format (i.e. P1, P2 or P3)
+#define PSD_DEFAULT         0
+#define RAS_DEFAULT         0
+#define RAW_DEFAULT         0		// load the file as linear RGB 48-bit
+#define RAW_PREVIEW			1		// try to load the embedded JPEG preview with included Exif Data or default to RGB 24-bit
+#define RAW_DISPLAY			2		// load the file as RGB 24-bit
+#define SGI_DEFAULT			0
+#define TARGA_DEFAULT       0
+#define TARGA_LOAD_RGB888   1       // If set the loader converts RGB555 and ARGB8888 -> RGB888.
+#define TIFF_DEFAULT        0
+#define TIFF_CMYK			0x0001	// reads/stores tags for separated CMYK (use | to combine with compression flags)
+#define TIFF_PACKBITS       0x0100  // save using PACKBITS compression
+#define TIFF_DEFLATE        0x0200  // save using DEFLATE compression (a.k.a. ZLIB compression)
+#define TIFF_ADOBE_DEFLATE  0x0400  // save using ADOBE DEFLATE compression
+#define TIFF_NONE           0x0800  // save without any compression
+#define TIFF_CCITTFAX3		0x1000  // save using CCITT Group 3 fax encoding
+#define TIFF_CCITTFAX4		0x2000  // save using CCITT Group 4 fax encoding
+#define TIFF_LZW			0x4000	// save using LZW compression
+#define TIFF_JPEG			0x8000	// save using JPEG compression
+#define WBMP_DEFAULT        0
+#define XBM_DEFAULT			0
+#define XPM_DEFAULT			0
+
+// Background filling options ---------------------------------------------------------
+// Constants used in FreeImage_FillBackground and FreeImage_EnlargeCanvas
+
+#define FI_COLOR_IS_RGB_COLOR			0x00	// RGBQUAD color is a RGB color (contains no valid alpha channel)
+#define FI_COLOR_IS_RGBA_COLOR			0x01	// RGBQUAD color is a RGBA color (contains a valid alpha channel)
+#define FI_COLOR_FIND_EQUAL_COLOR		0x02	// For palettized images: lookup equal RGB color from palette
+#define FI_COLOR_ALPHA_IS_INDEX			0x04	// The color's rgbReserved member (alpha) contains the palette index to be used
+#define FI_COLOR_PALETTE_SEARCH_MASK	(FI_COLOR_FIND_EQUAL_COLOR | FI_COLOR_ALPHA_IS_INDEX)	// No color lookup is performed
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// Init / Error routines ----------------------------------------------------
+
+DLL_API void DLL_CALLCONV FreeImage_Initialise(BOOL load_local_plugins_only FI_DEFAULT(FALSE));
+DLL_API void DLL_CALLCONV FreeImage_DeInitialise(void);
+
+// Version routines ---------------------------------------------------------
+
+DLL_API const char *DLL_CALLCONV FreeImage_GetVersion(void);
+DLL_API const char *DLL_CALLCONV FreeImage_GetCopyrightMessage(void);
+
+// Message output functions -------------------------------------------------
+
+typedef void (*FreeImage_OutputMessageFunction)(FREE_IMAGE_FORMAT fif, const char *msg);
+typedef void (DLL_CALLCONV *FreeImage_OutputMessageFunctionStdCall)(FREE_IMAGE_FORMAT fif, const char *msg); 
+
+DLL_API void DLL_CALLCONV FreeImage_SetOutputMessageStdCall(FreeImage_OutputMessageFunctionStdCall omf); 
+DLL_API void DLL_CALLCONV FreeImage_SetOutputMessage(FreeImage_OutputMessageFunction omf);
+DLL_API void DLL_CALLCONV FreeImage_OutputMessageProc(int fif, const char *fmt, ...);
+
+// Allocate / Clone / Unload routines ---------------------------------------
+
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Allocate(int width, int height, int bpp, unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateT(FREE_IMAGE_TYPE type, int width, int height, int bpp FI_DEFAULT(8), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0));
+DLL_API FIBITMAP * DLL_CALLCONV FreeImage_Clone(FIBITMAP *dib);
+DLL_API void DLL_CALLCONV FreeImage_Unload(FIBITMAP *dib);
+
+// Load / Save routines -----------------------------------------------------
+
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Load(FREE_IMAGE_FORMAT fif, const char *filename, int flags FI_DEFAULT(0));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadU(FREE_IMAGE_FORMAT fif, const wchar_t *filename, int flags FI_DEFAULT(0));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
+DLL_API BOOL DLL_CALLCONV FreeImage_Save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const char *filename, int flags FI_DEFAULT(0));
+DLL_API BOOL DLL_CALLCONV FreeImage_SaveU(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const wchar_t *filename, int flags FI_DEFAULT(0));
+DLL_API BOOL DLL_CALLCONV FreeImage_SaveToHandle(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
+
+// Memory I/O stream routines -----------------------------------------------
+
+DLL_API FIMEMORY *DLL_CALLCONV FreeImage_OpenMemory(BYTE *data FI_DEFAULT(0), DWORD size_in_bytes FI_DEFAULT(0));
+DLL_API void DLL_CALLCONV FreeImage_CloseMemory(FIMEMORY *stream);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0));
+DLL_API BOOL DLL_CALLCONV FreeImage_SaveToMemory(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FIMEMORY *stream, int flags FI_DEFAULT(0));
+DLL_API long DLL_CALLCONV FreeImage_TellMemory(FIMEMORY *stream);
+DLL_API BOOL DLL_CALLCONV FreeImage_SeekMemory(FIMEMORY *stream, long offset, int origin);
+DLL_API BOOL DLL_CALLCONV FreeImage_AcquireMemory(FIMEMORY *stream, BYTE **data, DWORD *size_in_bytes);
+DLL_API unsigned DLL_CALLCONV FreeImage_ReadMemory(void *buffer, unsigned size, unsigned count, FIMEMORY *stream);
+DLL_API unsigned DLL_CALLCONV FreeImage_WriteMemory(const void *buffer, unsigned size, unsigned count, FIMEMORY *stream);
+DLL_API FIMULTIBITMAP *DLL_CALLCONV FreeImage_LoadMultiBitmapFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0));
+
+// Plugin Interface ---------------------------------------------------------
+
+DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_RegisterLocalPlugin(FI_InitProc proc_address, const char *format FI_DEFAULT(0), const char *description FI_DEFAULT(0), const char *extension FI_DEFAULT(0), const char *regexpr FI_DEFAULT(0));
+DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_RegisterExternalPlugin(const char *path, const char *format FI_DEFAULT(0), const char *description FI_DEFAULT(0), const char *extension FI_DEFAULT(0), const char *regexpr FI_DEFAULT(0));
+DLL_API int DLL_CALLCONV FreeImage_GetFIFCount(void);
+DLL_API int DLL_CALLCONV FreeImage_SetPluginEnabled(FREE_IMAGE_FORMAT fif, BOOL enable);
+DLL_API int DLL_CALLCONV FreeImage_IsPluginEnabled(FREE_IMAGE_FORMAT fif);
+DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFormat(const char *format);
+DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromMime(const char *mime);
+DLL_API const char *DLL_CALLCONV FreeImage_GetFormatFromFIF(FREE_IMAGE_FORMAT fif);
+DLL_API const char *DLL_CALLCONV FreeImage_GetFIFExtensionList(FREE_IMAGE_FORMAT fif);
+DLL_API const char *DLL_CALLCONV FreeImage_GetFIFDescription(FREE_IMAGE_FORMAT fif);
+DLL_API const char *DLL_CALLCONV FreeImage_GetFIFRegExpr(FREE_IMAGE_FORMAT fif);
+DLL_API const char *DLL_CALLCONV FreeImage_GetFIFMimeType(FREE_IMAGE_FORMAT fif);
+DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilename(const char *filename);
+DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilenameU(const wchar_t *filename);
+DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsReading(FREE_IMAGE_FORMAT fif);
+DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsWriting(FREE_IMAGE_FORMAT fif);
+DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsExportBPP(FREE_IMAGE_FORMAT fif, int bpp);
+DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsExportType(FREE_IMAGE_FORMAT fif, FREE_IMAGE_TYPE type);
+DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsICCProfiles(FREE_IMAGE_FORMAT fif);
+
+// Multipaging interface ----------------------------------------------------
+
+DLL_API FIMULTIBITMAP * DLL_CALLCONV FreeImage_OpenMultiBitmap(FREE_IMAGE_FORMAT fif, const char *filename, BOOL create_new, BOOL read_only, BOOL keep_cache_in_memory FI_DEFAULT(FALSE), int flags FI_DEFAULT(0));
+DLL_API FIMULTIBITMAP * DLL_CALLCONV FreeImage_OpenMultiBitmapFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
+DLL_API BOOL DLL_CALLCONV FreeImage_CloseMultiBitmap(FIMULTIBITMAP *bitmap, int flags FI_DEFAULT(0));
+DLL_API int DLL_CALLCONV FreeImage_GetPageCount(FIMULTIBITMAP *bitmap);
+DLL_API void DLL_CALLCONV FreeImage_AppendPage(FIMULTIBITMAP *bitmap, FIBITMAP *data);
+DLL_API void DLL_CALLCONV FreeImage_InsertPage(FIMULTIBITMAP *bitmap, int page, FIBITMAP *data);
+DLL_API void DLL_CALLCONV FreeImage_DeletePage(FIMULTIBITMAP *bitmap, int page);
+DLL_API FIBITMAP * DLL_CALLCONV FreeImage_LockPage(FIMULTIBITMAP *bitmap, int page);
+DLL_API void DLL_CALLCONV FreeImage_UnlockPage(FIMULTIBITMAP *bitmap, FIBITMAP *data, BOOL changed);
+DLL_API BOOL DLL_CALLCONV FreeImage_MovePage(FIMULTIBITMAP *bitmap, int target, int source);
+DLL_API BOOL DLL_CALLCONV FreeImage_GetLockedPageNumbers(FIMULTIBITMAP *bitmap, int *pages, int *count);
+
+// Filetype request routines ------------------------------------------------
+
+DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileType(const char *filename, int size FI_DEFAULT(0));
+DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeU(const wchar_t *filename, int size FI_DEFAULT(0));
+DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromHandle(FreeImageIO *io, fi_handle handle, int size FI_DEFAULT(0));
+DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromMemory(FIMEMORY *stream, int size FI_DEFAULT(0));
+
+// Image type request routine -----------------------------------------------
+
+DLL_API FREE_IMAGE_TYPE DLL_CALLCONV FreeImage_GetImageType(FIBITMAP *dib);
+
+// FreeImage helper routines ------------------------------------------------
+
+DLL_API BOOL DLL_CALLCONV FreeImage_IsLittleEndian(void);
+DLL_API BOOL DLL_CALLCONV FreeImage_LookupX11Color(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue);
+DLL_API BOOL DLL_CALLCONV FreeImage_LookupSVGColor(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue);
+
+// Pixel access routines ----------------------------------------------------
+
+DLL_API BYTE *DLL_CALLCONV FreeImage_GetBits(FIBITMAP *dib);
+DLL_API BYTE *DLL_CALLCONV FreeImage_GetScanLine(FIBITMAP *dib, int scanline);
+
+DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value);
+DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value);
+
+// DIB info routines --------------------------------------------------------
+
+DLL_API unsigned DLL_CALLCONV FreeImage_GetColorsUsed(FIBITMAP *dib);
+DLL_API unsigned DLL_CALLCONV FreeImage_GetBPP(FIBITMAP *dib);
+DLL_API unsigned DLL_CALLCONV FreeImage_GetWidth(FIBITMAP *dib);
+DLL_API unsigned DLL_CALLCONV FreeImage_GetHeight(FIBITMAP *dib);
+DLL_API unsigned DLL_CALLCONV FreeImage_GetLine(FIBITMAP *dib);
+DLL_API unsigned DLL_CALLCONV FreeImage_GetPitch(FIBITMAP *dib);
+DLL_API unsigned DLL_CALLCONV FreeImage_GetDIBSize(FIBITMAP *dib);
+DLL_API RGBQUAD *DLL_CALLCONV FreeImage_GetPalette(FIBITMAP *dib);
+
+DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterX(FIBITMAP *dib);
+DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterY(FIBITMAP *dib);
+DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterX(FIBITMAP *dib, unsigned res);
+DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterY(FIBITMAP *dib, unsigned res);
+
+DLL_API BITMAPINFOHEADER *DLL_CALLCONV FreeImage_GetInfoHeader(FIBITMAP *dib);
+DLL_API BITMAPINFO *DLL_CALLCONV FreeImage_GetInfo(FIBITMAP *dib);
+DLL_API FREE_IMAGE_COLOR_TYPE DLL_CALLCONV FreeImage_GetColorType(FIBITMAP *dib);
+
+DLL_API unsigned DLL_CALLCONV FreeImage_GetRedMask(FIBITMAP *dib);
+DLL_API unsigned DLL_CALLCONV FreeImage_GetGreenMask(FIBITMAP *dib);
+DLL_API unsigned DLL_CALLCONV FreeImage_GetBlueMask(FIBITMAP *dib);
+
+DLL_API unsigned DLL_CALLCONV FreeImage_GetTransparencyCount(FIBITMAP *dib);
+DLL_API BYTE * DLL_CALLCONV FreeImage_GetTransparencyTable(FIBITMAP *dib);
+DLL_API void DLL_CALLCONV FreeImage_SetTransparent(FIBITMAP *dib, BOOL enabled);
+DLL_API void DLL_CALLCONV FreeImage_SetTransparencyTable(FIBITMAP *dib, BYTE *table, int count);
+DLL_API BOOL DLL_CALLCONV FreeImage_IsTransparent(FIBITMAP *dib);
+DLL_API void DLL_CALLCONV FreeImage_SetTransparentIndex(FIBITMAP *dib, int index);
+DLL_API int DLL_CALLCONV FreeImage_GetTransparentIndex(FIBITMAP *dib);
+
+DLL_API BOOL DLL_CALLCONV FreeImage_HasBackgroundColor(FIBITMAP *dib);
+DLL_API BOOL DLL_CALLCONV FreeImage_GetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor);
+
+
+// ICC profile routines -----------------------------------------------------
+
+DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_GetICCProfile(FIBITMAP *dib);
+DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_CreateICCProfile(FIBITMAP *dib, void *data, long size);
+DLL_API void DLL_CALLCONV FreeImage_DestroyICCProfile(FIBITMAP *dib);
+
+// Line conversion routines -------------------------------------------------
+
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To4(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To4(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_555(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_565(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To4(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To4(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To8(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To8(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_555(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_565(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To8(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To8(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_565_To16_555(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_555(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_555(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_555_To16_565(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_565(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_565(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_555(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_565(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To24(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_555(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_565(BYTE *target, BYTE *source, int width_in_pixels);
+DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To32(BYTE *target, BYTE *source, int width_in_pixels);
+
+// Smart conversion routines ------------------------------------------------
+
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo4Bits(FIBITMAP *dib);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo8Bits(FIBITMAP *dib);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToGreyscale(FIBITMAP *dib);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo16Bits555(FIBITMAP *dib);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo16Bits565(FIBITMAP *dib);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo24Bits(FIBITMAP *dib);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo32Bits(FIBITMAP *dib);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ColorQuantize(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ColorQuantizeEx(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize FI_DEFAULT(FIQ_WUQUANT), int PaletteSize FI_DEFAULT(256), int ReserveSize FI_DEFAULT(0), RGBQUAD *ReservePalette FI_DEFAULT(NULL));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Threshold(FIBITMAP *dib, BYTE T);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Dither(FIBITMAP *dib, FREE_IMAGE_DITHER algorithm);
+
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertFromRawBits(BYTE *bits, int width, int height, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE));
+DLL_API void DLL_CALLCONV FreeImage_ConvertToRawBits(BYTE *bits, FIBITMAP *dib, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE));
+
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToRGBF(FIBITMAP *dib);
+
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToStandardType(FIBITMAP *src, BOOL scale_linear FI_DEFAULT(TRUE));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToType(FIBITMAP *src, FREE_IMAGE_TYPE dst_type, BOOL scale_linear FI_DEFAULT(TRUE));
+
+// tone mapping operators
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ToneMapping(FIBITMAP *dib, FREE_IMAGE_TMO tmo, double first_param FI_DEFAULT(0), double second_param FI_DEFAULT(0));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoDrago03(FIBITMAP *src, double gamma FI_DEFAULT(2.2), double exposure FI_DEFAULT(0));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoReinhard05(FIBITMAP *src, double intensity FI_DEFAULT(0), double contrast FI_DEFAULT(0));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoReinhard05Ex(FIBITMAP *src, double intensity FI_DEFAULT(0), double contrast FI_DEFAULT(0), double adaptation FI_DEFAULT(1), double color_correction FI_DEFAULT(0));
+
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoFattal02(FIBITMAP *src, double color_saturation FI_DEFAULT(0.5), double attenuation FI_DEFAULT(0.85));
+
+// ZLib interface -----------------------------------------------------------
+
+DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
+DLL_API DWORD DLL_CALLCONV FreeImage_ZLibUncompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
+DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGZip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
+DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGUnzip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
+DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCRC32(DWORD crc, BYTE *source, DWORD source_size);
+
+// --------------------------------------------------------------------------
+// Metadata routines --------------------------------------------------------
+// --------------------------------------------------------------------------
+
+// tag creation / destruction
+DLL_API FITAG *DLL_CALLCONV FreeImage_CreateTag(void);
+DLL_API void DLL_CALLCONV FreeImage_DeleteTag(FITAG *tag);
+DLL_API FITAG *DLL_CALLCONV FreeImage_CloneTag(FITAG *tag);
+
+// tag getters and setters
+DLL_API const char *DLL_CALLCONV FreeImage_GetTagKey(FITAG *tag);
+DLL_API const char *DLL_CALLCONV FreeImage_GetTagDescription(FITAG *tag);
+DLL_API WORD DLL_CALLCONV FreeImage_GetTagID(FITAG *tag);
+DLL_API FREE_IMAGE_MDTYPE DLL_CALLCONV FreeImage_GetTagType(FITAG *tag);
+DLL_API DWORD DLL_CALLCONV FreeImage_GetTagCount(FITAG *tag);
+DLL_API DWORD DLL_CALLCONV FreeImage_GetTagLength(FITAG *tag);
+DLL_API const void *DLL_CALLCONV FreeImage_GetTagValue(FITAG *tag);
+
+DLL_API BOOL DLL_CALLCONV FreeImage_SetTagKey(FITAG *tag, const char *key);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetTagDescription(FITAG *tag, const char *description);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetTagID(FITAG *tag, WORD id);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetTagType(FITAG *tag, FREE_IMAGE_MDTYPE type);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetTagCount(FITAG *tag, DWORD count);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetTagLength(FITAG *tag, DWORD length);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetTagValue(FITAG *tag, const void *value);
+
+// iterator
+DLL_API FIMETADATA *DLL_CALLCONV FreeImage_FindFirstMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, FITAG **tag);
+DLL_API BOOL DLL_CALLCONV FreeImage_FindNextMetadata(FIMETADATA *mdhandle, FITAG **tag);
+DLL_API void DLL_CALLCONV FreeImage_FindCloseMetadata(FIMETADATA *mdhandle);
+
+// metadata setter and getter
+DLL_API BOOL DLL_CALLCONV FreeImage_SetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG *tag);
+DLL_API BOOL DLL_CALLCONV FreeImage_GetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG **tag);
+
+// helpers
+DLL_API unsigned DLL_CALLCONV FreeImage_GetMetadataCount(FREE_IMAGE_MDMODEL model, FIBITMAP *dib);
+DLL_API BOOL DLL_CALLCONV FreeImage_CloneMetadata(FIBITMAP *dst, FIBITMAP *src);
+
+// tag to C string conversion
+DLL_API const char* DLL_CALLCONV FreeImage_TagToString(FREE_IMAGE_MDMODEL model, FITAG *tag, char *Make FI_DEFAULT(NULL));
+
+// --------------------------------------------------------------------------
+// Image manipulation toolkit -----------------------------------------------
+// --------------------------------------------------------------------------
+
+// rotation and flipping
+/// @deprecated see FreeImage_Rotate
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateClassic(FIBITMAP *dib, double angle);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rotate(FIBITMAP *dib, double angle, const void *bkcolor FI_DEFAULT(NULL));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateEx(FIBITMAP *dib, double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask);
+DLL_API BOOL DLL_CALLCONV FreeImage_FlipHorizontal(FIBITMAP *dib);
+DLL_API BOOL DLL_CALLCONV FreeImage_FlipVertical(FIBITMAP *dib);
+DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransform(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(FALSE));
+DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(FALSE));
+
+// upsampling / downsampling
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rescale(FIBITMAP *dib, int dst_width, int dst_height, FREE_IMAGE_FILTER filter);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_MakeThumbnail(FIBITMAP *dib, int max_pixel_size, BOOL convert FI_DEFAULT(TRUE));
+
+// color manipulation routines (point operations)
+DLL_API BOOL DLL_CALLCONV FreeImage_AdjustCurve(FIBITMAP *dib, BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel);
+DLL_API BOOL DLL_CALLCONV FreeImage_AdjustGamma(FIBITMAP *dib, double gamma);
+DLL_API BOOL DLL_CALLCONV FreeImage_AdjustBrightness(FIBITMAP *dib, double percentage);
+DLL_API BOOL DLL_CALLCONV FreeImage_AdjustContrast(FIBITMAP *dib, double percentage);
+DLL_API BOOL DLL_CALLCONV FreeImage_Invert(FIBITMAP *dib);
+DLL_API BOOL DLL_CALLCONV FreeImage_GetHistogram(FIBITMAP *dib, DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel FI_DEFAULT(FICC_BLACK));
+DLL_API int DLL_CALLCONV FreeImage_GetAdjustColorsLookupTable(BYTE *LUT, double brightness, double contrast, double gamma, BOOL invert);
+DLL_API BOOL DLL_CALLCONV FreeImage_AdjustColors(FIBITMAP *dib, double brightness, double contrast, double gamma, BOOL invert FI_DEFAULT(FALSE));
+DLL_API unsigned DLL_CALLCONV FreeImage_ApplyColorMapping(FIBITMAP *dib, RGBQUAD *srccolors, RGBQUAD *dstcolors, unsigned count, BOOL ignore_alpha, BOOL swap);
+DLL_API unsigned DLL_CALLCONV FreeImage_SwapColors(FIBITMAP *dib, RGBQUAD *color_a, RGBQUAD *color_b, BOOL ignore_alpha);
+DLL_API unsigned DLL_CALLCONV FreeImage_ApplyPaletteIndexMapping(FIBITMAP *dib, BYTE *srcindices,	BYTE *dstindices, unsigned count, BOOL swap);
+DLL_API unsigned DLL_CALLCONV FreeImage_SwapPaletteIndices(FIBITMAP *dib, BYTE *index_a, BYTE *index_b);
+
+// channel processing routines
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetChannel(FIBITMAP *dib, FREE_IMAGE_COLOR_CHANNEL channel);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetChannel(FIBITMAP *dib, FIBITMAP *dib8, FREE_IMAGE_COLOR_CHANNEL channel);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetComplexChannel(FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel);
+DLL_API BOOL DLL_CALLCONV FreeImage_SetComplexChannel(FIBITMAP *dst, FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel);
+
+// copy / paste / composite routines
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Copy(FIBITMAP *dib, int left, int top, int right, int bottom);
+DLL_API BOOL DLL_CALLCONV FreeImage_Paste(FIBITMAP *dst, FIBITMAP *src, int left, int top, int alpha);
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Composite(FIBITMAP *fg, BOOL useFileBkg FI_DEFAULT(FALSE), RGBQUAD *appBkColor FI_DEFAULT(NULL), FIBITMAP *bg FI_DEFAULT(NULL));
+DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCrop(const char *src_file, const char *dst_file, int left, int top, int right, int bottom);
+DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCropU(const wchar_t *src_file, const wchar_t *dst_file, int left, int top, int right, int bottom);
+DLL_API BOOL DLL_CALLCONV FreeImage_PreMultiplyWithAlpha(FIBITMAP *dib);
+
+// background filling routines
+DLL_API BOOL DLL_CALLCONV FreeImage_FillBackground(FIBITMAP *dib, const void *color, int options FI_DEFAULT(0));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_EnlargeCanvas(FIBITMAP *src, int left, int top, int right, int bottom, const void *color, int options FI_DEFAULT(0));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateEx(int width, int height, int bpp, const RGBQUAD *color, int options FI_DEFAULT(0), const RGBQUAD *palette FI_DEFAULT(NULL), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0));
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateExT(FREE_IMAGE_TYPE type, int width, int height, int bpp, const void *color, int options FI_DEFAULT(0), const RGBQUAD *palette FI_DEFAULT(NULL), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0));
+
+// miscellaneous algorithms
+DLL_API FIBITMAP *DLL_CALLCONV FreeImage_MultigridPoissonSolver(FIBITMAP *Laplacian, int ncycle FI_DEFAULT(3));
+
+// restore the borland-specific enum size option
+#if defined(__BORLANDC__)
+#pragma option pop
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // FREEIMAGE_H
diff --git a/Source/FreeImage/BitmapAccess.cpp b/Source/FreeImage/BitmapAccess.cpp
new file mode 100644
index 0000000..9106ad2
--- /dev/null
+++ b/Source/FreeImage/BitmapAccess.cpp
@@ -0,0 +1,1080 @@
+// ==========================================================
+// FreeImage implementation
+//
+// Design and implementation by
+// - Floris van den Berg (flvdberg@wxs.nl)
+// - Hervé Drolon (drolon@infonie.fr)
+// - Detlev Vendt (detlev.vendt@brillit.de)
+// - Petr Supina (psup@centrum.cz)
+// - Carsten Klein (c.klein@datagis.com)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#ifdef _MSC_VER 
+#pragma warning (disable : 4786) // identifier was truncated to 'number' characters
+#endif 
+
+#include <stdlib.h>
+#if defined(_WIN32) || defined(_WIN64) || defined(__MINGW32__)
+#include <malloc.h>
+#endif // _WIN32 || _WIN64 || __MINGW32__
+
+#include "FreeImage.h"
+#include "FreeImageIO.h"
+#include "Utilities.h"
+
+#include "../Metadata/FreeImageTag.h"
+
+// ----------------------------------------------------------
+//  Metadata definitions
+// ----------------------------------------------------------
+
+// helper for map<key, value> where value is a pointer to a FreeImage tag
+typedef std::map<std::string, FITAG*> TAGMAP;
+
+// helper for map<FREE_IMAGE_MDMODEL, TAGMAP*>
+typedef std::map<int, TAGMAP*> METADATAMAP;
+
+// helper for metadata iterator
+FI_STRUCT (METADATAHEADER) { 
+	long pos;		// current position when iterating the map
+	TAGMAP *tagmap;	// pointer to the tag map
+};
+
+// ----------------------------------------------------------
+//  FIBITMAP definition
+// ----------------------------------------------------------
+
+FI_STRUCT (FREEIMAGEHEADER) {
+    FREE_IMAGE_TYPE type;		// data type - bitmap, array of long, double, complex, etc
+
+	unsigned red_mask;			// bit layout of the red components
+	unsigned green_mask;		// bit layout of the green components
+	unsigned blue_mask;			// bit layout of the blue components
+
+	RGBQUAD bkgnd_color;		// background color used for RGB transparency
+
+	BOOL transparent;			 // why another table? for easy transparency table retrieval!
+	int  transparency_count;	 // transparency could be stored in the palette, which is better
+	BYTE transparent_table[256]; // overall, but it requires quite some changes and it will render
+								 // FreeImage_GetTransparencyTable obsolete in its current form;
+	FIICCPROFILE iccProfile;	 // space to hold ICC profile
+
+	METADATAMAP *metadata;		 // contains a list of metadata models attached to the bitmap
+
+	//BYTE filler[1];			 // fill to 32-bit alignment
+};
+
+// ----------------------------------------------------------
+//  Memory allocation on a specified alignment boundary
+// ----------------------------------------------------------
+
+#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
+
+void* FreeImage_Aligned_Malloc(size_t amount, size_t alignment) {
+	assert(alignment == FIBITMAP_ALIGNMENT);
+	return _aligned_malloc(amount, alignment);
+}
+
+void FreeImage_Aligned_Free(void* mem) {
+	_aligned_free(mem);
+}
+
+#elif defined (__MINGW32__)
+
+void* FreeImage_Aligned_Malloc(size_t amount, size_t alignment) {
+	assert(alignment == FIBITMAP_ALIGNMENT);
+	return __mingw_aligned_malloc (amount, alignment);
+}
+
+void FreeImage_Aligned_Free(void* mem) {
+	__mingw_aligned_free (mem);
+}
+
+#else
+
+void* FreeImage_Aligned_Malloc(size_t amount, size_t alignment) {
+	assert(alignment == FIBITMAP_ALIGNMENT);
+	/*
+	In some rare situations, the malloc routines can return misaligned memory. 
+	The routine FreeImage_Aligned_Malloc allocates a bit more memory to do
+	aligned writes.  Normally, it *should* allocate "alignment" extra memory and then writes
+	one dword back the true pointer.  But if the memory manager returns a
+	misaligned block that is less than a dword from the next alignment, 
+	then the writing back one dword will corrupt memory.
+
+	For example, suppose that alignment is 16 and malloc returns the address 0xFFFF.
+
+	16 - 0xFFFF % 16 + 0xFFFF = 16 - 15 + 0xFFFF = 0x10000.
+
+	Now, you subtract one dword from that and write and that will corrupt memory.
+
+	That's why the code below allocates *two* alignments instead of one. 
+	*/
+	void* mem_real = malloc(amount + 2 * alignment);
+	if(!mem_real) return NULL;
+	char* mem_align = (char*)((unsigned long)(2 * alignment - (unsigned long)mem_real % (unsigned long)alignment) + (unsigned long)mem_real);
+	*((long*)mem_align - 1) = (long)mem_real;
+	return mem_align;
+}
+
+void FreeImage_Aligned_Free(void* mem) {
+	free((void*)*((long*)mem - 1));
+}
+
+#endif // _WIN32 || _WIN64
+
+// ----------------------------------------------------------
+//  DIB information functions
+// ----------------------------------------------------------
+
+/**
+Calculate the size of a FreeImage image. 
+Align the palette and the pixels on a FIBITMAP_ALIGNMENT bytes alignment boundary.
+*/
+static unsigned 
+FreeImage_GetImageSize(int width, int height, int bpp) {
+	unsigned dib_size = sizeof(FREEIMAGEHEADER); 
+	dib_size += (dib_size % FIBITMAP_ALIGNMENT ? FIBITMAP_ALIGNMENT - dib_size % FIBITMAP_ALIGNMENT : 0);  
+	dib_size += FIBITMAP_ALIGNMENT - sizeof(BITMAPINFOHEADER) % FIBITMAP_ALIGNMENT; 
+	dib_size += sizeof(BITMAPINFOHEADER);  
+	// palette is aligned on a 16 bytes boundary
+	dib_size += sizeof(RGBQUAD) * CalculateUsedPaletteEntries(bpp);  
+	dib_size += (dib_size % FIBITMAP_ALIGNMENT ? FIBITMAP_ALIGNMENT - dib_size % FIBITMAP_ALIGNMENT : 0);  
+	// pixels are aligned on a 16 bytes boundary
+	dib_size += CalculatePitch(CalculateLine(width, bpp)) * height; 
+
+	return dib_size;
+}
+
+FIBITMAP * DLL_CALLCONV
+FreeImage_Allocate(int width, int height, int bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask) {
+	return FreeImage_AllocateT(FIT_BITMAP, width, height, bpp, red_mask, green_mask, blue_mask);
+}
+
+FIBITMAP * DLL_CALLCONV
+FreeImage_AllocateT(FREE_IMAGE_TYPE type, int width, int height, int bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask) {
+	FIBITMAP *bitmap = (FIBITMAP *)malloc(sizeof(FIBITMAP));
+
+	if (bitmap != NULL) {
+		height = abs(height);
+
+		// check pixel bit depth
+		switch(type) {
+			case FIT_BITMAP:
+				switch(bpp) {
+					case 1:
+					case 4:
+					case 8:
+					case 16:
+					case 24:
+					case 32:
+						break;
+					default:
+						bpp = 8;
+						break;
+				}
+				break;
+			case FIT_UINT16:
+				bpp = 8 * sizeof(unsigned short);
+				break;
+			case FIT_INT16:
+				bpp = 8 * sizeof(short);
+				break;
+			case FIT_UINT32:
+				bpp = 8 * sizeof(unsigned long);
+				break;
+			case FIT_INT32:
+				bpp = 8 * sizeof(long);
+				break;
+			case FIT_FLOAT:
+				bpp = 8 * sizeof(float);
+				break;
+			case FIT_DOUBLE:
+				bpp = 8 * sizeof(double);
+				break;
+			case FIT_COMPLEX:
+				bpp = 8 * sizeof(FICOMPLEX);
+				break;
+			case FIT_RGB16:
+				bpp = 8 * sizeof(FIRGB16);
+				break;
+			case FIT_RGBA16:
+				bpp = 8 * sizeof(FIRGBA16);
+				break;
+			case FIT_RGBF:
+				bpp = 8 * sizeof(FIRGBF);
+				break;
+			case FIT_RGBAF:
+				bpp = 8 * sizeof(FIRGBAF);
+				break;
+			default:
+				free(bitmap);
+				return NULL;
+		}
+
+		// calculate the size of a FreeImage image
+		// align the palette and the pixels on a FIBITMAP_ALIGNMENT bytes alignment boundary
+		// palette is aligned on a 16 bytes boundary
+		// pixels are aligned on a 16 bytes boundary
+
+		unsigned dib_size = FreeImage_GetImageSize(width, height, bpp); 
+
+		bitmap->data = (BYTE *)FreeImage_Aligned_Malloc(dib_size * sizeof(BYTE), FIBITMAP_ALIGNMENT);
+
+		if (bitmap->data != NULL) {
+			memset(bitmap->data, 0, dib_size);
+
+			// write out the FREEIMAGEHEADER
+
+			FREEIMAGEHEADER *fih    = (FREEIMAGEHEADER *)bitmap->data;
+			fih->type				= type;
+
+			fih->red_mask           = red_mask;
+			fih->green_mask         = green_mask;
+			fih->blue_mask          = blue_mask;
+
+			memset(&fih->bkgnd_color, 0, sizeof(RGBQUAD));
+
+			fih->transparent        = FALSE;
+			fih->transparency_count = 0;
+			memset(fih->transparent_table, 0xff, 256);
+
+			// initialize FIICCPROFILE link
+
+			FIICCPROFILE *iccProfile = FreeImage_GetICCProfile(bitmap);
+			iccProfile->size		= 0;
+			iccProfile->data		= 0;
+			iccProfile->flags		= 0;
+
+			// initialize metadata models list
+
+			fih->metadata = new METADATAMAP;
+
+			// write out the BITMAPINFOHEADER
+
+			BITMAPINFOHEADER *bih   = FreeImage_GetInfoHeader(bitmap);
+			bih->biSize             = sizeof(BITMAPINFOHEADER);
+			bih->biWidth            = width;
+			bih->biHeight           = height;
+			bih->biPlanes           = 1;
+			bih->biCompression      = 0;
+			bih->biBitCount         = (WORD)bpp;
+			bih->biClrUsed          = CalculateUsedPaletteEntries(bpp);
+			bih->biClrImportant     = bih->biClrUsed;
+			bih->biXPelsPerMeter	= 2835;	// 72 dpi
+			bih->biYPelsPerMeter	= 2835;	// 72 dpi
+
+			return bitmap;
+		}
+
+		free(bitmap);
+	}
+
+	return NULL;
+}
+
+void DLL_CALLCONV
+FreeImage_Unload(FIBITMAP *dib) {
+	if (NULL != dib) {	
+		if (NULL != dib->data) {
+			// delete possible icc profile ...
+			if (FreeImage_GetICCProfile(dib)->data)
+				free(FreeImage_GetICCProfile(dib)->data);
+
+			// delete metadata models
+			METADATAMAP *metadata = ((FREEIMAGEHEADER *)dib->data)->metadata;
+
+			for(METADATAMAP::iterator i = (*metadata).begin(); i != (*metadata).end(); i++) {
+				TAGMAP *tagmap = (*i).second;
+
+				if(tagmap) {
+					for(TAGMAP::iterator j = tagmap->begin(); j != tagmap->end(); j++) {
+						FITAG *tag = (*j).second;
+						FreeImage_DeleteTag(tag);
+					}
+
+					delete tagmap;
+				}
+			}
+
+			delete metadata;
+
+			// delete bitmap ...
+			FreeImage_Aligned_Free(dib->data);
+		}
+		free(dib);		// ... and the wrapper
+	}
+}
+
+// ----------------------------------------------------------
+
+FIBITMAP * DLL_CALLCONV
+FreeImage_Clone(FIBITMAP *dib) {
+	if(!dib) return NULL;
+
+	unsigned width  = FreeImage_GetWidth(dib);
+	unsigned height = FreeImage_GetHeight(dib);
+	unsigned bpp    = FreeImage_GetBPP(dib);
+	
+	// allocate a new dib
+	FIBITMAP *new_dib = FreeImage_AllocateT(FreeImage_GetImageType(dib), width, height, bpp, 
+			FreeImage_GetRedMask(dib), FreeImage_GetGreenMask(dib), FreeImage_GetBlueMask(dib));
+
+	if (new_dib) {
+		// save ICC profile links
+		FIICCPROFILE *src_iccProfile = FreeImage_GetICCProfile(dib);
+		FIICCPROFILE *dst_iccProfile = FreeImage_GetICCProfile(new_dib);
+
+		// save metadata links
+		METADATAMAP *src_metadata = ((FREEIMAGEHEADER *)dib->data)->metadata;
+		METADATAMAP *dst_metadata = ((FREEIMAGEHEADER *)new_dib->data)->metadata;
+
+		// calculate the size of a FreeImage image
+		// align the palette and the pixels on a FIBITMAP_ALIGNMENT bytes alignment boundary
+		// palette is aligned on a 16 bytes boundary
+		// pixels are aligned on a 16 bytes boundary
+
+		unsigned dib_size = FreeImage_GetImageSize(width, height, bpp); 
+
+		// copy the bitmap + internal pointers (remember to restore new_dib internal pointers later)
+		memcpy(new_dib->data, dib->data, dib_size);
+
+		// reset ICC profile link for new_dib
+		memset(dst_iccProfile, 0, sizeof(FIICCPROFILE));
+
+		// restore metadata link for new_dib
+		((FREEIMAGEHEADER *)new_dib->data)->metadata = dst_metadata;
+
+		// copy possible ICC profile
+		FreeImage_CreateICCProfile(new_dib, src_iccProfile->data, src_iccProfile->size);
+		dst_iccProfile->flags = src_iccProfile->flags;
+
+		// copy metadata models
+		for(METADATAMAP::iterator i = (*src_metadata).begin(); i != (*src_metadata).end(); i++) {
+			int model = (*i).first;
+			TAGMAP *src_tagmap = (*i).second;
+
+			if(src_tagmap) {
+				// create a metadata model
+				TAGMAP *dst_tagmap = new TAGMAP();
+
+				// fill the model
+				for(TAGMAP::iterator j = src_tagmap->begin(); j != src_tagmap->end(); j++) {
+					std::string dst_key = (*j).first;
+					FITAG *dst_tag = FreeImage_CloneTag( (*j).second );
+
+					// assign key and tag value
+					(*dst_tagmap)[dst_key] = dst_tag;
+				}
+
+				// assign model and tagmap
+				(*dst_metadata)[model] = dst_tagmap;
+			}
+		}
+
+		return new_dib;
+	}
+
+	return NULL;
+}
+
+// ----------------------------------------------------------
+
+FREE_IMAGE_COLOR_TYPE DLL_CALLCONV
+FreeImage_GetColorType(FIBITMAP *dib) {
+	RGBQUAD *rgb;
+
+	const FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(dib);
+
+	// special bitmap type
+	if(image_type != FIT_BITMAP) {
+		switch(image_type) {
+			case FIT_RGB16:
+			case FIT_RGBF:
+				return FIC_RGB;
+			case FIT_RGBA16:
+			case FIT_RGBAF:
+				return FIC_RGBALPHA;
+		}
+
+		return FIC_MINISBLACK;
+	}
+
+	// standard image type
+	switch (FreeImage_GetBPP(dib)) {
+		case 1:
+		{
+			rgb = FreeImage_GetPalette(dib);
+
+			if ((rgb->rgbRed == 0) && (rgb->rgbGreen == 0) && (rgb->rgbBlue == 0)) {
+				rgb++;
+
+				if ((rgb->rgbRed == 255) && (rgb->rgbGreen == 255) && (rgb->rgbBlue == 255))
+					return FIC_MINISBLACK;				
+			}
+
+			if ((rgb->rgbRed == 255) && (rgb->rgbGreen == 255) && (rgb->rgbBlue == 255)) {
+				rgb++;
+
+				if ((rgb->rgbRed == 0) && (rgb->rgbGreen == 0) && (rgb->rgbBlue == 0))
+					return FIC_MINISWHITE;				
+			}
+
+			return FIC_PALETTE;
+		}
+
+		case 4:
+		case 8:	// Check if the DIB has a color or a greyscale palette
+		{
+			int ncolors = FreeImage_GetColorsUsed(dib);
+		    int minisblack = 1;
+			rgb = FreeImage_GetPalette(dib);
+
+			for (int i = 0; i < ncolors; i++) {
+				if ((rgb->rgbRed != rgb->rgbGreen) || (rgb->rgbRed != rgb->rgbBlue))
+					return FIC_PALETTE;
+
+				// The DIB has a color palette if the greyscale isn't a linear ramp
+				// Take care of reversed grey images
+				if (rgb->rgbRed != i) {
+					if ((ncolors-i-1) != rgb->rgbRed)
+						return FIC_PALETTE;
+				    else
+						minisblack = 0;
+				}
+
+				rgb++;
+			}
+
+			return minisblack ? FIC_MINISBLACK : FIC_MINISWHITE;
+		}
+
+		case 16:
+		case 24:
+			return FIC_RGB;
+
+		case 32:
+		{
+			if (FreeImage_GetICCProfile(dib)->flags & FIICC_COLOR_IS_CMYK)
+				return FIC_CMYK;
+
+			for (unsigned y = 0; y < FreeImage_GetHeight(dib); y++) {
+				rgb = (RGBQUAD *)FreeImage_GetScanLine(dib, y);
+
+				for (unsigned x = 0; x < FreeImage_GetWidth(dib); x++)
+					if (rgb[x].rgbReserved != 0xFF)
+						return FIC_RGBALPHA;			
+			}
+
+			return FIC_RGB;
+		}
+				
+		default :
+			return FIC_MINISBLACK;
+	}
+}
+
+// ----------------------------------------------------------
+
+FREE_IMAGE_TYPE DLL_CALLCONV 
+FreeImage_GetImageType(FIBITMAP *dib) {
+	return (dib != NULL) ? ((FREEIMAGEHEADER *)dib->data)->type : FIT_UNKNOWN;
+}
+
+// ----------------------------------------------------------
+
+unsigned DLL_CALLCONV
+FreeImage_GetRedMask(FIBITMAP *dib) {
+	return dib ? ((FREEIMAGEHEADER *)dib->data)->red_mask : 0;
+}
+
+unsigned DLL_CALLCONV
+FreeImage_GetGreenMask(FIBITMAP *dib) {
+	return dib ? ((FREEIMAGEHEADER *)dib->data)->green_mask : 0;
+}
+
+unsigned DLL_CALLCONV
+FreeImage_GetBlueMask(FIBITMAP *dib) {
+	return dib ? ((FREEIMAGEHEADER *)dib->data)->blue_mask : 0;
+}
+
+// ----------------------------------------------------------
+
+BOOL DLL_CALLCONV
+FreeImage_HasBackgroundColor(FIBITMAP *dib) {
+	if(dib) {
+		RGBQUAD *bkgnd_color = &((FREEIMAGEHEADER *)dib->data)->bkgnd_color;
+		return (bkgnd_color->rgbReserved != 0) ? TRUE : FALSE;
+	}
+	return FALSE;
+}
+
+BOOL DLL_CALLCONV
+FreeImage_GetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor) {
+	if(dib && bkcolor) {
+		if(FreeImage_HasBackgroundColor(dib)) {
+			// get the background color
+			RGBQUAD *bkgnd_color = &((FREEIMAGEHEADER *)dib->data)->bkgnd_color;
+			memcpy(bkcolor, bkgnd_color, sizeof(RGBQUAD));
+			// get the background index
+			if(FreeImage_GetBPP(dib) == 8) {
+				RGBQUAD *pal = FreeImage_GetPalette(dib);
+				for(unsigned i = 0; i < FreeImage_GetColorsUsed(dib); i++) {
+					if(bkgnd_color->rgbRed == pal[i].rgbRed) {
+						if(bkgnd_color->rgbGreen == pal[i].rgbGreen) {
+							if(bkgnd_color->rgbBlue == pal[i].rgbBlue) {
+								bkcolor->rgbReserved = (BYTE)i;
+								return TRUE;
+							}
+						}
+					}
+				}
+			}
+
+			bkcolor->rgbReserved = 0;
+
+			return TRUE;
+		}
+	}
+
+	return FALSE;
+}
+
+BOOL DLL_CALLCONV 
+FreeImage_SetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor) {
+	if(dib) {
+		RGBQUAD *bkgnd_color = &((FREEIMAGEHEADER *)dib->data)->bkgnd_color;
+		if(bkcolor) {
+			// set the background color
+			memcpy(bkgnd_color, bkcolor, sizeof(RGBQUAD));
+			// enable the file background color
+			bkgnd_color->rgbReserved = 1;
+		} else {
+			// clear and disable the file background color
+			memset(bkgnd_color, 0, sizeof(RGBQUAD));
+		}
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+// ----------------------------------------------------------
+
+BOOL DLL_CALLCONV
+FreeImage_IsTransparent(FIBITMAP *dib) {
+	if(dib) {
+		if(FreeImage_GetBPP(dib) == 32) {
+			if(FreeImage_GetColorType(dib) == FIC_RGBALPHA) {
+				return TRUE;
+			}
+		} else {
+			return ((FREEIMAGEHEADER *)dib->data)->transparent ? TRUE : FALSE;
+		}
+	}
+	return FALSE;
+}
+
+BYTE * DLL_CALLCONV
+FreeImage_GetTransparencyTable(FIBITMAP *dib) {
+	return dib ? ((FREEIMAGEHEADER *)dib->data)->transparent_table : NULL;
+}
+
+void DLL_CALLCONV
+FreeImage_SetTransparent(FIBITMAP *dib, BOOL enabled) {
+	if (dib) {
+		if ((FreeImage_GetBPP(dib) <= 8) || (FreeImage_GetBPP(dib) == 32)) {
+			((FREEIMAGEHEADER *)dib->data)->transparent = enabled;
+		} else {
+			((FREEIMAGEHEADER *)dib->data)->transparent = FALSE;
+		}
+	}
+}
+
+unsigned DLL_CALLCONV
+FreeImage_GetTransparencyCount(FIBITMAP *dib) {
+	return dib ? ((FREEIMAGEHEADER *)dib->data)->transparency_count : 0;
+}
+
+void DLL_CALLCONV
+FreeImage_SetTransparencyTable(FIBITMAP *dib, BYTE *table, int count) {
+	if (dib) {
+		if (FreeImage_GetBPP(dib) <= 8) {
+			((FREEIMAGEHEADER *)dib->data)->transparent = TRUE;
+			((FREEIMAGEHEADER *)dib->data)->transparency_count = count;
+
+			if (table) {
+				memcpy(((FREEIMAGEHEADER *)dib->data)->transparent_table, table, count);
+			} else {
+				memset(((FREEIMAGEHEADER *)dib->data)->transparent_table, 0xff, count);
+			}
+		} 
+	}
+}
+
+/** @brief Sets the index of the palette entry to be used as transparent color
+ for the image specified. Does nothing on high color images. 
+ 
+ This method sets the index of the palette entry to be used as single transparent
+ color for the image specified. This works on palletised images only and does
+ nothing for high color images.
+ 
+ Although it is possible for palletised images to have more than one transparent
+ color, this method sets the palette entry specified as the single transparent
+ color for the image. All other colors will be set to be non-transparent by this
+ method.
+ 
+ As with FreeImage_SetTransparencyTable(), this method also sets the image's
+ transparency property to TRUE (as it is set and obtained by
+ FreeImage_SetTransparent() and FreeImage_IsTransparent() respectively) for
+ palletised images.
+ 
+ @param dib Input image, whose transparent color is to be set.
+ @param index The index of the palette entry to be set as transparent color.
+ */
+void DLL_CALLCONV
+FreeImage_SetTransparentIndex(FIBITMAP *dib, int index) {
+	if (dib) {
+		int count = FreeImage_GetColorsUsed(dib);
+		if (count) {
+			BYTE *new_tt = (BYTE *)malloc(count * sizeof(BYTE));
+			memset(new_tt, 0xFF, count);
+			if ((index >= 0) && (index < count)) {
+				new_tt[index] = 0x00;
+			}
+			FreeImage_SetTransparencyTable(dib, new_tt, count);
+			free(new_tt);
+		}
+	}
+}
+
+/** @brief Returns the palette entry used as transparent color for the image
+ specified. Works for palletised images only and returns -1 for high color
+ images or if the image has no color set to be transparent. 
+ 
+ Although it is possible for palletised images to have more than one transparent
+ color, this function always returns the index of the first palette entry, set
+ to be transparent. 
+ 
+ @param dib Input image, whose transparent color is to be returned.
+ @return Returns the index of the palette entry used as transparent color for
+ the image specified or -1 if there is no transparent color found (e.g. the image
+ is a high color image).
+ */
+int DLL_CALLCONV
+FreeImage_GetTransparentIndex(FIBITMAP *dib) {
+	int count = FreeImage_GetTransparencyCount(dib);
+	BYTE *tt = FreeImage_GetTransparencyTable(dib);
+	for (int i = 0; i < count; i++) {
+		if (tt[i] == 0) {
+			return i;
+		}
+	}
+	return -1;
+}
+
+// ----------------------------------------------------------
+
+FIICCPROFILE * DLL_CALLCONV
+FreeImage_GetICCProfile(FIBITMAP *dib) {
+	FIICCPROFILE *profile = (dib) ? (FIICCPROFILE *)&((FREEIMAGEHEADER *)dib->data)->iccProfile : NULL;
+	return profile;
+}
+
+FIICCPROFILE * DLL_CALLCONV
+FreeImage_CreateICCProfile(FIBITMAP *dib, void *data, long size) {
+	// clear the profile but preserve profile->flags
+	FreeImage_DestroyICCProfile(dib);
+	// create the new profile
+	FIICCPROFILE *profile = FreeImage_GetICCProfile(dib);
+	if(size && profile) {
+		profile->data = malloc(size);
+		if(profile->data) {
+			memcpy(profile->data, data, profile->size = size);
+		}
+	}
+	return profile;
+}
+
+void DLL_CALLCONV
+FreeImage_DestroyICCProfile(FIBITMAP *dib) {
+	FIICCPROFILE *profile = FreeImage_GetICCProfile(dib);
+	if(profile) {
+		if (profile->data) {
+			free (profile->data);
+		}
+		// clear the profile but preserve profile->flags
+		profile->data = NULL;
+		profile->size = 0;
+	}
+}
+
+// ----------------------------------------------------------
+
+unsigned DLL_CALLCONV
+FreeImage_GetWidth(FIBITMAP *dib) {
+	return dib ? FreeImage_GetInfoHeader(dib)->biWidth : 0;
+}
+
+unsigned DLL_CALLCONV
+FreeImage_GetHeight(FIBITMAP *dib) {
+	return (dib) ? FreeImage_GetInfoHeader(dib)->biHeight : 0;
+}
+
+unsigned DLL_CALLCONV
+FreeImage_GetBPP(FIBITMAP *dib) {
+	return dib ? FreeImage_GetInfoHeader(dib)->biBitCount : 0;
+}
+
+unsigned DLL_CALLCONV
+FreeImage_GetLine(FIBITMAP *dib) {
+	return dib ? ((FreeImage_GetWidth(dib) * FreeImage_GetBPP(dib)) + 7) / 8 : 0;
+}
+
+unsigned DLL_CALLCONV
+FreeImage_GetPitch(FIBITMAP *dib) {
+	return dib ? FreeImage_GetLine(dib) + 3 & ~3 : 0;
+}
+
+unsigned DLL_CALLCONV
+FreeImage_GetColorsUsed(FIBITMAP *dib) {
+	return dib ? FreeImage_GetInfoHeader(dib)->biClrUsed : 0;
+}
+
+unsigned DLL_CALLCONV
+FreeImage_GetDIBSize(FIBITMAP *dib) {
+	return (dib) ? sizeof(BITMAPINFOHEADER) + (FreeImage_GetColorsUsed(dib) * sizeof(RGBQUAD)) + (FreeImage_GetPitch(dib) * FreeImage_GetHeight(dib)) : 0;
+}
+
+RGBQUAD * DLL_CALLCONV
+FreeImage_GetPalette(FIBITMAP *dib) {
+	return (dib && FreeImage_GetBPP(dib) < 16) ? (RGBQUAD *)(((BYTE *)FreeImage_GetInfoHeader(dib)) + sizeof(BITMAPINFOHEADER)) : NULL;
+}
+
+unsigned DLL_CALLCONV
+FreeImage_GetDotsPerMeterX(FIBITMAP *dib) {
+	return (dib) ? FreeImage_GetInfoHeader(dib)->biXPelsPerMeter : 0;
+}
+
+unsigned DLL_CALLCONV
+FreeImage_GetDotsPerMeterY(FIBITMAP *dib) {
+	return (dib) ? FreeImage_GetInfoHeader(dib)->biYPelsPerMeter : 0;
+}
+
+void DLL_CALLCONV
+FreeImage_SetDotsPerMeterX(FIBITMAP *dib, unsigned res) {
+	if(dib) {
+		FreeImage_GetInfoHeader(dib)->biXPelsPerMeter = res;
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_SetDotsPerMeterY(FIBITMAP *dib, unsigned res) {
+	if(dib) {
+		FreeImage_GetInfoHeader(dib)->biYPelsPerMeter = res;
+	}
+}
+
+BITMAPINFOHEADER * DLL_CALLCONV
+FreeImage_GetInfoHeader(FIBITMAP *dib) {
+	if(!dib) return NULL;
+	size_t lp = (size_t)dib->data + sizeof(FREEIMAGEHEADER);
+	lp += (lp % FIBITMAP_ALIGNMENT ? FIBITMAP_ALIGNMENT - lp % FIBITMAP_ALIGNMENT : 0);
+	lp += FIBITMAP_ALIGNMENT - sizeof(BITMAPINFOHEADER) % FIBITMAP_ALIGNMENT;
+	return (BITMAPINFOHEADER *)lp;
+}
+
+BITMAPINFO * DLL_CALLCONV
+FreeImage_GetInfo(FIBITMAP *dib) {
+	return (BITMAPINFO *)FreeImage_GetInfoHeader(dib);
+}
+
+// ----------------------------------------------------------
+//  Metadata routines
+// ----------------------------------------------------------
+
+FIMETADATA * DLL_CALLCONV 
+FreeImage_FindFirstMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, FITAG **tag) {
+	if(!dib)
+		return NULL;
+
+	// get the metadata model
+	METADATAMAP *metadata = ((FREEIMAGEHEADER *)dib->data)->metadata;
+	TAGMAP *tagmap = NULL;
+	if( (*metadata).find(model) != (*metadata).end() ) {
+		tagmap = (*metadata)[model];
+	}
+	if(tagmap) {
+		// allocate a handle
+		FIMETADATA 	*handle = (FIMETADATA *)malloc(sizeof(FIMETADATA));
+		if(handle) {
+			// calculate the size of a METADATAHEADER
+			int header_size = sizeof(METADATAHEADER);
+
+			handle->data = (BYTE *)malloc(header_size * sizeof(BYTE));
+			
+			if(handle->data) {
+				memset(handle->data, 0, header_size * sizeof(BYTE));
+
+				// write out the METADATAHEADER
+				METADATAHEADER *mdh = (METADATAHEADER *)handle->data;
+
+				mdh->pos = 1;
+				mdh->tagmap = tagmap;
+
+				// get the first element
+				TAGMAP::iterator i = tagmap->begin();
+				*tag = (*i).second;
+
+				return handle;
+			}
+
+			free(handle);
+		}
+	}
+
+	return NULL;
+}
+
+BOOL DLL_CALLCONV 
+FreeImage_FindNextMetadata(FIMETADATA *mdhandle, FITAG **tag) {
+	if(!mdhandle)
+		return FALSE;
+
+	METADATAHEADER *mdh = (METADATAHEADER *)mdhandle->data;
+	TAGMAP *tagmap = mdh->tagmap;
+
+	int current_pos = mdh->pos;
+	int mapsize     = (int)tagmap->size();
+
+	if(current_pos < mapsize) {
+		// get the tag element at position pos
+		int count = 0;
+
+		for(TAGMAP::iterator i = tagmap->begin(); i != tagmap->end(); i++) {
+			if(count == current_pos) {
+				*tag = (*i).second;
+				mdh->pos++;
+				break;
+			}
+			count++;
+		}
+		
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+void DLL_CALLCONV 
+FreeImage_FindCloseMetadata(FIMETADATA *mdhandle) {
+	if (NULL != mdhandle) {	// delete the handle
+		if (NULL != mdhandle->data) {
+			free(mdhandle->data);
+		}
+		free(mdhandle);		// ... and the wrapper
+	}
+}
+
+
+// ----------------------------------------------------------
+
+BOOL DLL_CALLCONV
+FreeImage_CloneMetadata(FIBITMAP *dst, FIBITMAP *src) {
+	if(!src || !dst) return FALSE;
+
+	// get metadata links
+	METADATAMAP *src_metadata = ((FREEIMAGEHEADER *)src->data)->metadata;
+	METADATAMAP *dst_metadata = ((FREEIMAGEHEADER *)dst->data)->metadata;
+
+	// copy metadata models, *except* the FIMD_ANIMATION model
+	for(METADATAMAP::iterator i = (*src_metadata).begin(); i != (*src_metadata).end(); i++) {
+		int model = (*i).first;
+		if(model == (int)FIMD_ANIMATION) {
+			continue;
+		}
+		TAGMAP *src_tagmap = (*i).second;
+
+		if(src_tagmap) {
+			if( dst_metadata->find(model) != dst_metadata->end() ) {
+				// destroy dst model
+				FreeImage_SetMetadata((FREE_IMAGE_MDMODEL)model, dst, NULL, NULL);
+			}
+
+			// create a metadata model
+			TAGMAP *dst_tagmap = new TAGMAP();
+
+			// fill the model
+			for(TAGMAP::iterator j = src_tagmap->begin(); j != src_tagmap->end(); j++) {
+				std::string dst_key = (*j).first;
+				FITAG *dst_tag = FreeImage_CloneTag( (*j).second );
+
+				// assign key and tag value
+				(*dst_tagmap)[dst_key] = dst_tag;
+			}
+
+			// assign model and tagmap
+			(*dst_metadata)[model] = dst_tagmap;
+		}
+	}
+
+	return TRUE;
+}
+
+// ----------------------------------------------------------
+
+BOOL DLL_CALLCONV 
+FreeImage_SetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG *tag) {
+	if(!dib) 
+		return FALSE;
+
+	TAGMAP *tagmap = NULL;
+
+	// get the metadata model
+	METADATAMAP *metadata = ((FREEIMAGEHEADER *)dib->data)->metadata;
+	METADATAMAP::iterator model_iterator = metadata->find(model);
+	if (model_iterator != metadata->end()) {
+		tagmap = model_iterator->second;
+	}
+
+	if(key != NULL) {
+
+		if(!tagmap) {
+			// this model, doesn't exist: create it 
+			tagmap = new TAGMAP();
+			(*metadata)[model] = tagmap;
+		}
+		
+		if(tag) {
+			// first check the tag
+			if(FreeImage_GetTagKey(tag) == NULL) {
+				FreeImage_SetTagKey(tag, key);
+			} else if(strcmp(key, FreeImage_GetTagKey(tag)) != 0) {
+				// set the tag key
+				FreeImage_SetTagKey(tag, key);
+			}
+			if(FreeImage_GetTagCount(tag) * FreeImage_TagDataWidth((WORD)FreeImage_GetTagType(tag)) != FreeImage_GetTagLength(tag)) {
+				FreeImage_OutputMessageProc(FIF_UNKNOWN, "Invalid data count for tag '%s'", key);
+				return FALSE;
+			}
+
+			// fill the tag ID if possible and if it's needed
+			TagLib& tag_lib = TagLib::instance();
+			switch(model) {
+				case FIMD_IPTC:
+				{
+					int id = tag_lib.getTagID(TagLib::IPTC, key);
+					/*
+					if(id == -1) {
+						FreeImage_OutputMessageProc(FIF_UNKNOWN, "IPTC: Invalid key '%s'", key);
+					}
+					*/
+					FreeImage_SetTagID(tag, (WORD)id);
+				}
+				break;
+
+				default:
+					break;
+			}
+
+			// delete existing tag
+			FITAG *old_tag = (*tagmap)[key];
+			if(old_tag) {
+				FreeImage_DeleteTag(old_tag);
+			}
+
+			// create a new tag
+			(*tagmap)[key] = FreeImage_CloneTag(tag);
+		}
+		else {
+			// delete existing tag
+			TAGMAP::iterator i = tagmap->find(key);
+			if(i != tagmap->end()) {
+				FITAG *old_tag = (*i).second;
+				FreeImage_DeleteTag(old_tag);
+				tagmap->erase(key);
+			}
+		}
+	}
+	else {
+		// destroy the metadata model
+		if(tagmap) {
+			for(TAGMAP::iterator i = tagmap->begin(); i != tagmap->end(); i++) {
+				FITAG *tag = (*i).second;
+				FreeImage_DeleteTag(tag);
+			}
+
+			delete tagmap;
+			metadata->erase(model_iterator);
+		}
+	}
+
+	return TRUE;
+}
+
+BOOL DLL_CALLCONV 
+FreeImage_GetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG **tag) {
+	if(!dib || !key || !tag) 
+		return FALSE;
+
+	TAGMAP *tagmap = NULL;
+	*tag = NULL;
+
+	// get the metadata model
+	METADATAMAP *metadata = ((FREEIMAGEHEADER *)dib->data)->metadata;
+	if(!(*metadata).empty()) {
+		METADATAMAP::iterator model_iterator = metadata->find(model);
+		if (model_iterator != metadata->end() ) {
+			// this model exists : try to get the requested tag
+			tagmap = model_iterator->second;
+			TAGMAP::iterator tag_iterator = tagmap->find(key);
+			if (tag_iterator != tagmap->end() ) {
+				// get the requested tag
+				*tag = tag_iterator->second;
+			} 
+		}
+	}
+
+	return (*tag != NULL) ? TRUE : FALSE;
+}
+
+// ----------------------------------------------------------
+
+unsigned DLL_CALLCONV 
+FreeImage_GetMetadataCount(FREE_IMAGE_MDMODEL model, FIBITMAP *dib) {
+	if(!dib) 
+		return FALSE;
+
+	TAGMAP *tagmap = NULL;
+
+	// get the metadata model
+	METADATAMAP *metadata = ((FREEIMAGEHEADER *)dib->data)->metadata;
+	if( (*metadata).find(model) != (*metadata).end() ) {
+		tagmap = (*metadata)[model];
+	}
+	if(!tagmap) {
+		// this model, doesn't exist: return
+		return 0;
+	}
+
+	// get the tag count
+	return (unsigned)tagmap->size();
+}
+
+// ----------------------------------------------------------
+
+
diff --git a/Source/FreeImage/CacheFile.cpp b/Source/FreeImage/CacheFile.cpp
new file mode 100644
index 0000000..16f0531
--- /dev/null
+++ b/Source/FreeImage/CacheFile.cpp
@@ -0,0 +1,274 @@
+// ==========================================================
+// Multi-Page functions
+//
+// Design and implementation by
+// - Floris van den Berg (flvdberg@wxs.nl)
+// - checkered (checkered@users.sourceforge.net)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#ifdef _MSC_VER 
+#pragma warning (disable : 4786) // identifier was truncated to 'number' characters
+#endif 
+
+#include "CacheFile.h"
+
+// ----------------------------------------------------------
+
+CacheFile::CacheFile(const char *filename, BOOL keep_in_memory) :
+m_file(NULL),
+m_filename(),
+m_free_pages(),
+m_page_cache_mem(),
+m_page_cache_disk(),
+m_page_map(),
+m_page_count(0),
+m_current_block(NULL),
+m_keep_in_memory(keep_in_memory) {
+	if (filename) {
+		m_filename = filename;
+	}
+}
+
+CacheFile::~CacheFile() {
+}
+
+BOOL
+CacheFile::open() {
+	if ((!m_filename.empty()) && (!m_keep_in_memory)) {
+		m_file = fopen(m_filename.c_str(), "w+b");
+		return (m_file != NULL);
+	}
+
+	return (m_keep_in_memory == TRUE);
+}
+
+void
+CacheFile::close() {
+	// dispose the cache entries
+
+	while (!m_page_cache_disk.empty()) {
+		Block *block = *m_page_cache_disk.begin();
+		m_page_cache_disk.pop_front();
+		delete [] block->data;
+		delete block;
+	}
+	while (!m_page_cache_mem.empty()) { 
+		Block *block = *m_page_cache_mem.begin(); 
+		m_page_cache_mem.pop_front(); 
+		delete [] block->data; 
+		delete block; 
+	} 
+
+	if (m_file) {
+		// close the file
+
+		fclose(m_file);
+
+		// delete the file
+
+		remove(m_filename.c_str());
+	}
+}
+
+void
+CacheFile::cleanupMemCache() {
+	if (!m_keep_in_memory) {
+		if (m_page_cache_mem.size() > CACHE_SIZE) {
+			// flush the least used block to file
+
+			Block *old_block = m_page_cache_mem.back();
+			fseek(m_file, old_block->nr * BLOCK_SIZE, SEEK_SET);
+			fwrite(old_block->data, BLOCK_SIZE, 1, m_file);
+
+			// remove the data
+
+			delete [] old_block->data;
+			old_block->data = NULL;
+
+			// move the block to another list
+
+			m_page_cache_disk.splice(m_page_cache_disk.begin(), m_page_cache_mem, --m_page_cache_mem.end());
+			m_page_map[old_block->nr] = m_page_cache_disk.begin();
+		}
+	}
+}
+
+int
+CacheFile::allocateBlock() {
+	Block *block = new Block;
+	block->data = new BYTE[BLOCK_SIZE];
+	block->next = 0;
+
+	if (!m_free_pages.empty()) {
+		block->nr = *m_free_pages.begin();
+		m_free_pages.pop_front();
+	} else {
+		block->nr = m_page_count++;
+	}
+
+	m_page_cache_mem.push_front(block);
+	m_page_map[block->nr] = m_page_cache_mem.begin();
+
+	cleanupMemCache();
+
+	return block->nr;
+}
+
+Block *
+CacheFile::lockBlock(int nr) {
+	if (m_current_block == NULL) {
+		PageMapIt it = m_page_map.find(nr);
+
+		if (it != m_page_map.end()) {
+			m_current_block = *(it->second);
+
+			// the block is swapped out to disc. load it back
+			// and remove the block from the cache. it might get cached
+			// again as soon as the memory buffer fills up
+
+			if (m_current_block->data == NULL) {
+				m_current_block->data = new BYTE[BLOCK_SIZE];
+
+				fseek(m_file, m_current_block->nr * BLOCK_SIZE, SEEK_SET);
+				fread(m_current_block->data, BLOCK_SIZE, 1, m_file);
+
+				m_page_cache_mem.splice(m_page_cache_mem.begin(), m_page_cache_disk, it->second);
+				m_page_map[nr] = m_page_cache_mem.begin();
+			}
+
+			// if the memory cache size is too large, swap an item to disc
+
+			cleanupMemCache();
+
+			// return the current block
+
+			return m_current_block;
+		}
+	}
+
+	return NULL;
+}
+
+BOOL
+CacheFile::unlockBlock(int nr) {
+	if (m_current_block) {
+		m_current_block = NULL;
+
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+BOOL
+CacheFile::deleteBlock(int nr) {
+	if (!m_current_block) {
+		PageMapIt it = m_page_map.find(nr);
+
+		// remove block from cache
+
+		if (it != m_page_map.end())
+			m_page_map.erase(nr);
+
+		// add block to free page list
+
+		m_free_pages.push_back(nr);
+
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+BOOL
+CacheFile::readFile(BYTE *data, int nr, int size) {
+	if ((data) && (size > 0)) {
+		int s = 0;
+		int block_nr = nr;
+
+		do {
+			int copy_nr = block_nr;
+
+			Block *block = lockBlock(copy_nr);
+
+			block_nr = block->next;
+
+			memcpy(data + s, block->data, (s + BLOCK_SIZE > size) ? size - s : BLOCK_SIZE);
+
+			unlockBlock(copy_nr);
+
+			s += BLOCK_SIZE;
+		} while (block_nr != 0);
+
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+int
+CacheFile::writeFile(BYTE *data, int size) {
+	if ((data) && (size > 0)) {
+		int nr_blocks_required = 1 + (size / BLOCK_SIZE);
+		int count = 0;
+		int s = 0;
+		int stored_alloc;
+		int alloc;
+		
+		stored_alloc = alloc = allocateBlock();
+
+		do {
+			int copy_alloc = alloc;
+
+			Block *block = lockBlock(copy_alloc);
+
+			block->next = 0;
+
+			memcpy(block->data, data + s, (s + BLOCK_SIZE > size) ? size - s : BLOCK_SIZE);
+
+			if (count + 1 < nr_blocks_required)
+				alloc = block->next = allocateBlock();
+
+			unlockBlock(copy_alloc);
+
+			s += BLOCK_SIZE;			
+		} while (++count < nr_blocks_required);
+
+		return stored_alloc;
+	}
+
+	return 0;
+}
+
+void
+CacheFile::deleteFile(int nr) {
+	do {
+		Block *block = lockBlock(nr);
+
+		if (block == NULL)
+			break;
+
+		int next = block->next;
+
+		unlockBlock(nr);
+
+		deleteBlock(nr);
+
+		nr = next;
+	} while (nr != 0);
+}
+
diff --git a/Source/FreeImage/ColorLookup.cpp b/Source/FreeImage/ColorLookup.cpp
new file mode 100644
index 0000000..9e9d779
--- /dev/null
+++ b/Source/FreeImage/ColorLookup.cpp
@@ -0,0 +1,782 @@
+// ==========================================================
+// X11 and SVG Color name lookup
+//
+// Design and implementation by
+// - Karl-Heinz Bussian (khbussian@moss.de)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+//
+// ==========================================================
+
+#include "FreeImage.h"
+#include "Utilities.h"
+
+// RGB color names  ---------------------------------------------------------
+
+typedef struct tagNamedColor {
+        char *name;     // color name
+        BYTE  r;        // red value
+        BYTE  g;        // green value
+        BYTE  b;        // blue value
+} NamedColor;
+
+// --------------------------------------------------------------------------
+
+/**
+Helper function : perform a binary search on a color array
+@param name Color name
+@param color_array Color array
+@param n Length of the color array
+@return Returns the color index in the array if successful, returns -1 otherwise
+*/
+static int
+binsearch(const char *name, const NamedColor *color_array, int n) {
+    int cond, low, mid, high;
+
+    low = 0;
+    high = n - 1;
+    while (low <= high) {
+                mid = (low + high) / 2;
+                if ((cond = strcmp(name, color_array[mid].name)) < 0)
+                        high = mid - 1;
+                else if (cond > 0)
+                        low = mid + 1;
+                else
+                        return mid;
+        }
+    return -1;
+}
+
+/**
+Perform a binary search on a color array
+@param szColor Color name
+@param color_array Color array
+@param ncolors Length of the color array
+@return Returns the color index in the array if successful, returns -1 otherwise
+*/
+static int
+FreeImage_LookupNamedColor(const char *szColor, const NamedColor *color_array, int ncolors) {
+    int i;
+    char color[64];
+
+    // make lower case name, squezze white space
+
+    for (i = 0; szColor[i] && i < sizeof(color) - 1; i++) {
+        if (isspace(szColor[i]))
+            continue;
+        if (isupper(szColor[i]))
+            color[i] = (char)tolower(szColor[i]);
+        else
+            color[i] = szColor[i];
+    }
+    color[i] = 0;
+
+    return (binsearch(color, color_array, ncolors));
+}
+
+// ==========================================================
+// X11 Color name lookup
+
+/**
+ This big list of color names was formed from the file: /usr/X11R6/lib/X11/rgb.txt
+ found on a standard Linux installation.
+*/
+
+static NamedColor X11ColorMap[] = {
+    { "aliceblue",            240, 248, 255 },
+    { "antiquewhite",         250, 235, 215 },
+    { "antiquewhite1",        255, 239, 219 },
+    { "antiquewhite2",        238, 223, 204 },
+    { "antiquewhite3",        205, 192, 176 },
+    { "antiquewhite4",        139, 131, 120 },
+    { "aquamarine",           127, 255, 212 },
+    { "aquamarine1",          127, 255, 212 },
+    { "aquamarine2",          118, 238, 198 },
+    { "aquamarine3",          102, 205, 170 },
+    { "aquamarine4",           69, 139, 116 },
+    { "azure",                240, 255, 255 },
+    { "azure1",               240, 255, 255 },
+    { "azure2",               224, 238, 238 },
+    { "azure3",               193, 205, 205 },
+    { "azure4",               131, 139, 139 },
+    { "beige",                245, 245, 220 },
+    { "bisque",               255, 228, 196 },
+    { "bisque1",              255, 228, 196 },
+    { "bisque2",              238, 213, 183 },
+    { "bisque3",              205, 183, 158 },
+    { "bisque4",              139, 125, 107 },
+    { "black",                  0,   0,   0 },
+    { "blanchedalmond",       255, 235, 205 },
+    { "blue",                   0,   0, 255 },
+    { "blue1",                  0,   0, 255 },
+    { "blue2",                  0,   0, 238 },
+    { "blue3",                  0,   0, 205 },
+    { "blue4",                  0,   0, 139 },
+    { "blueviolet",           138,  43, 226 },
+    { "brown",                165,  42,  42 },
+    { "brown1",               255,  64,  64 },
+    { "brown2",               238,  59,  59 },
+    { "brown3",               205,  51,  51 },
+    { "brown4",               139,  35,  35 },
+    { "burlywood",            222, 184, 135 },
+    { "burlywood1",           255, 211, 155 },
+    { "burlywood2",           238, 197, 145 },
+    { "burlywood3",           205, 170, 125 },
+    { "burlywood4",           139, 115,  85 },
+    { "cadetblue",             95, 158, 160 },
+    { "cadetblue1",           152, 245, 255 },
+    { "cadetblue2",           142, 229, 238 },
+    { "cadetblue3",           122, 197, 205 },
+    { "cadetblue4",            83, 134, 139 },
+    { "chartreuse",           127, 255,   0 },
+    { "chartreuse1",          127, 255,   0 },
+    { "chartreuse2",          118, 238,   0 },
+    { "chartreuse3",          102, 205,   0 },
+    { "chartreuse4",           69, 139,   0 },
+    { "chocolate",            210, 105,  30 },
+    { "chocolate1",           255, 127,  36 },
+    { "chocolate2",           238, 118,  33 },
+    { "chocolate3",           205, 102,  29 },
+    { "chocolate4",           139,  69,  19 },
+    { "coral",                255, 127,  80 },
+    { "coral1",               255, 114,  86 },
+    { "coral2",               238, 106,  80 },
+    { "coral3",               205,  91,  69 },
+    { "coral4",               139,  62,  47 },
+    { "cornflowerblue",       100, 149, 237 },
+    { "cornsilk",             255, 248, 220 },
+    { "cornsilk1",            255, 248, 220 },
+    { "cornsilk2",            238, 232, 205 },
+    { "cornsilk3",            205, 200, 177 },
+    { "cornsilk4",            139, 136, 120 },
+    { "cyan",                   0, 255, 255 },
+    { "cyan1",                  0, 255, 255 },
+    { "cyan2",                  0, 238, 238 },
+    { "cyan3",                  0, 205, 205 },
+    { "cyan4",                  0, 139, 139 },
+    { "darkblue",               0,   0, 139 },
+    { "darkcyan",               0, 139, 139 },
+    { "darkgoldenrod",        184, 134,  11 },
+    { "darkgoldenrod1",       255, 185,  15 },
+    { "darkgoldenrod2",       238, 173,  14 },
+    { "darkgoldenrod3",       205, 149,  12 },
+    { "darkgoldenrod4",       139, 101,   8 },
+    { "darkgreen",              0, 100,   0 },
+    { "darkkhaki",            189, 183, 107 },
+    { "darkmagenta",          139,   0, 139 },
+    { "darkolivegreen",        85, 107,  47 },
+    { "darkolivegreen1",      202, 255, 112 },
+    { "darkolivegreen2",      188, 238, 104 },
+    { "darkolivegreen3",      162, 205,  90 },
+    { "darkolivegreen4",      110, 139,  61 },
+    { "darkorange",           255, 140,   0 },
+    { "darkorange1",          255, 127,   0 },
+    { "darkorange2",          238, 118,   0 },
+    { "darkorange3",          205, 102,   0 },
+    { "darkorange4",          139,  69,   0 },
+    { "darkorchid",           153,  50, 204 },
+    { "darkorchid1",          191,  62, 255 },
+    { "darkorchid2",          178,  58, 238 },
+    { "darkorchid3",          154,  50, 205 },
+    { "darkorchid4",          104,  34, 139 },
+    { "darkred",              139,   0,   0 },
+    { "darksalmon",           233, 150, 122 },
+    { "darkseagreen",         143, 188, 143 },
+    { "darkseagreen1",        193, 255, 193 },
+    { "darkseagreen2",        180, 238, 180 },
+    { "darkseagreen3",        155, 205, 155 },
+    { "darkseagreen4",        105, 139, 105 },
+    { "darkslateblue",         72,  61, 139 },
+    { "darkslategray",         47,  79,  79 },
+    { "darkslategray1",       151, 255, 255 },
+    { "darkslategray2",       141, 238, 238 },
+    { "darkslategray3",       121, 205, 205 },
+    { "darkslategray4",        82, 139, 139 },
+    { "darkslategrey",         47,  79,  79 },
+    { "darkturquoise",          0, 206, 209 },
+    { "darkviolet",           148,   0, 211 },
+    { "deeppink",             255,  20, 147 },
+    { "deeppink1",            255,  20, 147 },
+    { "deeppink2",            238,  18, 137 },
+    { "deeppink3",            205,  16, 118 },
+    { "deeppink4",            139,  10,  80 },
+    { "deepskyblue",            0, 191, 255 },
+    { "deepskyblue1",           0, 191, 255 },
+    { "deepskyblue2",           0, 178, 238 },
+    { "deepskyblue3",           0, 154, 205 },
+    { "deepskyblue4",           0, 104, 139 },
+    { "dimgray",              105, 105, 105 },
+    { "dimgrey",              105, 105, 105 },
+    { "dodgerblue",            30, 144, 255 },
+    { "dodgerblue1",           30, 144, 255 },
+    { "dodgerblue2",           28, 134, 238 },
+    { "dodgerblue3",           24, 116, 205 },
+    { "dodgerblue4",           16,  78, 139 },
+    { "firebrick",            178,  34,  34 },
+    { "firebrick1",           255,  48,  48 },
+    { "firebrick2",           238,  44,  44 },
+    { "firebrick3",           205,  38,  38 },
+    { "firebrick4",           139,  26,  26 },
+    { "floralwhite",          255, 250, 240 },
+    { "forestgreen",          176,  48,  96 },
+    { "gainsboro",            220, 220, 220 },
+    { "ghostwhite",           248, 248, 255 },
+    { "gold",                 255, 215,   0 },
+    { "gold1",                255, 215,   0 },
+    { "gold2",                238, 201,   0 },
+    { "gold3",                205, 173,   0 },
+    { "gold4",                139, 117,   0 },
+    { "goldenrod",            218, 165,  32 },
+    { "goldenrod1",           255, 193,  37 },
+    { "goldenrod2",           238, 180,  34 },
+    { "goldenrod3",           205, 155,  29 },
+    { "goldenrod4",           139, 105,  20 },
+    { "gray",                 190, 190, 190 },
+    { "green",                  0, 255,   0 },
+    { "green1",                 0, 255,   0 },
+    { "green2",                 0, 238,   0 },
+    { "green3",                 0, 205,   0 },
+    { "green4",                 0, 139,   0 },
+    { "greenyellow",          173, 255,  47 },
+    { "grey",                 190, 190, 190 },
+    { "honeydew",             240, 255, 240 },
+    { "honeydew1",            240, 255, 240 },
+    { "honeydew2",            224, 238, 224 },
+    { "honeydew3",            193, 205, 193 },
+    { "honeydew4",            131, 139, 131 },
+    { "hotpink",              255, 105, 180 },
+    { "hotpink1",             255, 110, 180 },
+    { "hotpink2",             238, 106, 167 },
+    { "hotpink3",             205,  96, 144 },
+    { "hotpink4",             139,  58,  98 },
+    { "indianred",            205,  92,  92 },
+    { "indianred1",           255, 106, 106 },
+    { "indianred2",           238,  99,  99 },
+    { "indianred3",           205,  85,  85 },
+    { "indianred4",           139,  58,  58 },
+    { "ivory",                255, 255, 240 },
+    { "ivory1",               255, 255, 240 },
+    { "ivory2",               238, 238, 224 },
+    { "ivory3",               205, 205, 193 },
+    { "ivory4",               139, 139, 131 },
+    { "khaki",                240, 230, 140 },
+    { "khaki1",               255, 246, 143 },
+    { "khaki2",               238, 230, 133 },
+    { "khaki3",               205, 198, 115 },
+    { "khaki4",               139, 134,  78 },
+    { "lavender",             230, 230, 250 },
+    { "lavenderblush",        255, 240, 245 },
+    { "lavenderblush1",       255, 240, 245 },
+    { "lavenderblush2",       238, 224, 229 },
+    { "lavenderblush3",       205, 193, 197 },
+    { "lavenderblush4",       139, 131, 134 },
+    { "lawngreen",            124, 252,   0 },
+    { "lemonchiffon",         255, 250, 205 },
+    { "lemonchiffon1",        255, 250, 205 },
+    { "lemonchiffon2",        238, 233, 191 },
+    { "lemonchiffon3",        205, 201, 165 },
+    { "lemonchiffon4",        139, 137, 112 },
+    { "lightblue",            173, 216, 230 },
+    { "lightblue1",           191, 239, 255 },
+    { "lightblue2",           178, 223, 238 },
+    { "lightblue3",           154, 192, 205 },
+    { "lightblue4",           104, 131, 139 },
+    { "lightcoral",           240, 128, 128 },
+    { "lightcyan",            224, 255, 255 },
+    { "lightcyan1",           224, 255, 255 },
+    { "lightcyan2",           209, 238, 238 },
+    { "lightcyan3",           180, 205, 205 },
+    { "lightcyan4",           122, 139, 139 },
+    { "lightgoldenrod",       238, 221, 130 },
+    { "lightgoldenrod1",      255, 236, 139 },
+    { "lightgoldenrod2",      238, 220, 130 },
+    { "lightgoldenrod3",      205, 190, 112 },
+    { "lightgoldenrod4",      139, 129,  76 },
+    { "lightgoldenrodyellow", 250, 250, 210 },
+    { "lightgray",            211, 211, 211 },
+    { "lightgreen",           144, 238, 144 },
+    { "lightgrey",            211, 211, 211 },
+    { "lightpink",            255, 182, 193 },
+    { "lightpink1",           255, 174, 185 },
+    { "lightpink2",           238, 162, 173 },
+    { "lightpink3",           205, 140, 149 },
+    { "lightpink4",           139,  95, 101 },
+    { "lightsalmon",          255, 160, 122 },
+    { "lightsalmon1",         255, 160, 122 },
+    { "lightsalmon2",         238, 149, 114 },
+    { "lightsalmon3",         205, 129,  98 },
+    { "lightsalmon4",         139,  87,  66 },
+    { "lightseagreen",         32, 178, 170 },
+    { "lightskyblue",         135, 206, 250 },
+    { "lightskyblue1",        176, 226, 255 },
+    { "lightskyblue2",        164, 211, 238 },
+    { "lightskyblue3",        141, 182, 205 },
+    { "lightskyblue4",         96, 123, 139 },
+    { "lightslateblue",       132, 112, 255 },
+    { "lightslategray",       119, 136, 153 },
+    { "lightslategrey",       119, 136, 153 },
+    { "lightsteelblue",       176, 196, 222 },
+    { "lightsteelblue1",      202, 225, 255 },
+    { "lightsteelblue2",      188, 210, 238 },
+    { "lightsteelblue3",      162, 181, 205 },
+    { "lightsteelblue4",      110, 123, 139 },
+    { "lightyellow",          255, 255, 224 },
+    { "lightyellow1",         255, 255, 224 },
+    { "lightyellow2",         238, 238, 209 },
+    { "lightyellow3",         205, 205, 180 },
+    { "lightyellow4",         139, 139, 122 },
+    { "limegreen",             50, 205,  50 },
+    { "linen",                250, 240, 230 },
+    { "magenta",              255,   0, 255 },
+    { "magenta1",             255,   0, 255 },
+    { "magenta2",             238,   0, 238 },
+    { "magenta3",             205,   0, 205 },
+    { "magenta4",             139,   0, 139 },
+    { "maroon",                 0, 255, 255 },
+    { "maroon1",              255,  52, 179 },
+    { "maroon2",              238,  48, 167 },
+    { "maroon3",              205,  41, 144 },
+    { "maroon4",              139,  28,  98 },
+    { "mediumaquamarine",     102, 205, 170 },
+    { "mediumblue",             0,   0, 205 },
+    { "mediumorchid",         186,  85, 211 },
+    { "mediumorchid1",        224, 102, 255 },
+    { "mediumorchid2",        209,  95, 238 },
+    { "mediumorchid3",        180,  82, 205 },
+    { "mediumorchid4",        122,  55, 139 },
+    { "mediumpurple",         147, 112, 219 },
+    { "mediumpurple1",        171, 130, 255 },
+    { "mediumpurple2",        159, 121, 238 },
+    { "mediumpurple3",        137, 104, 205 },
+    { "mediumpurple4",         93,  71, 139 },
+    { "mediumseagreen",        60, 179, 113 },
+    { "mediumslateblue",      123, 104, 238 },
+    { "mediumspringgreen",      0, 250, 154 },
+    { "mediumturquoise",       72, 209, 204 },
+    { "mediumvioletred",      199,  21, 133 },
+    { "midnightblue",          25,  25, 112 },
+    { "mintcream",            245, 255, 250 },
+    { "mistyrose",            255, 228, 225 },
+    { "mistyrose1",           255, 228, 225 },
+    { "mistyrose2",           238, 213, 210 },
+    { "mistyrose3",           205, 183, 181 },
+    { "mistyrose4",           139, 125, 123 },
+    { "moccasin",             255, 228, 181 },
+    { "navajowhite",          255, 222, 173 },
+    { "navajowhite1",         255, 222, 173 },
+    { "navajowhite2",         238, 207, 161 },
+    { "navajowhite3",         205, 179, 139 },
+    { "navajowhite4",         139, 121,  94 },
+    { "navy",                   0,   0, 128 },
+    { "navyblue",               0,   0, 128 },
+    { "oldlace",              253, 245, 230 },
+    { "olivedrab",            107, 142,  35 },
+    { "olivedrab1",           192, 255,  62 },
+    { "olivedrab2",           179, 238,  58 },
+    { "olivedrab3",           154, 205,  50 },
+    { "olivedrab4",           105, 139,  34 },
+    { "orange",               255, 165,   0 },
+    { "orange1",              255, 165,   0 },
+    { "orange2",              238, 154,   0 },
+    { "orange3",              205, 133,   0 },
+    { "orange4",              139,  90,   0 },
+    { "orangered",            255,  69,   0 },
+    { "orangered1",           255,  69,   0 },
+    { "orangered2",           238,  64,   0 },
+    { "orangered3",           205,  55,   0 },
+    { "orangered4",           139,  37,   0 },
+    { "orchid",               218, 112, 214 },
+    { "orchid1",              255, 131, 250 },
+    { "orchid2",              238, 122, 233 },
+    { "orchid3",              205, 105, 201 },
+    { "orchid4",              139,  71, 137 },
+    { "palegoldenrod",        238, 232, 170 },
+    { "palegreen",            152, 251, 152 },
+    { "palegreen1",           154, 255, 154 },
+    { "palegreen2",           144, 238, 144 },
+    { "palegreen3",           124, 205, 124 },
+    { "palegreen4",            84, 139,  84 },
+    { "paleturquoise",        175, 238, 238 },
+    { "paleturquoise1",       187, 255, 255 },
+    { "paleturquoise2",       174, 238, 238 },
+    { "paleturquoise3",       150, 205, 205 },
+    { "paleturquoise4",       102, 139, 139 },
+    { "palevioletred",        219, 112, 147 },
+    { "palevioletred1",       255, 130, 171 },
+    { "palevioletred2",       238, 121, 159 },
+    { "palevioletred3",       205, 104, 137 },
+    { "palevioletred4",       139,  71,  93 },
+    { "papayawhip",           255, 239, 213 },
+    { "peachpuff",            255, 218, 185 },
+    { "peachpuff1",           255, 218, 185 },
+    { "peachpuff2",           238, 203, 173 },
+    { "peachpuff3",           205, 175, 149 },
+    { "peachpuff4",           139, 119, 101 },
+    { "peru",                 205, 133,  63 },
+    { "pink",                 255, 192, 203 },
+    { "pink1",                255, 181, 197 },
+    { "pink2",                238, 169, 184 },
+    { "pink3",                205, 145, 158 },
+    { "pink4",                139,  99, 108 },
+    { "plum",                 221, 160, 221 },
+    { "plum1",                255, 187, 255 },
+    { "plum2",                238, 174, 238 },
+    { "plum3",                205, 150, 205 },
+    { "plum4",                139, 102, 139 },
+    { "powderblue",           176, 224, 230 },
+    { "purple",               160,  32, 240 },
+    { "purple1",              155,  48, 255 },
+    { "purple2",              145,  44, 238 },
+    { "purple3",              125,  38, 205 },
+    { "purple4",               85,  26, 139 },
+    { "red",                  255,   0,   0 },
+    { "red1",                 255,   0,   0 },
+    { "red2",                 238,   0,   0 },
+    { "red3",                 205,   0,   0 },
+    { "red4",                 139,   0,   0 },
+    { "rosybrown",            188, 143, 143 },
+    { "rosybrown1",           255, 193, 193 },
+    { "rosybrown2",           238, 180, 180 },
+    { "rosybrown3",           205, 155, 155 },
+    { "rosybrown4",           139, 105, 105 },
+    { "royalblue",             65, 105, 225 },
+    { "royalblue1",            72, 118, 255 },
+    { "royalblue2",            67, 110, 238 },
+    { "royalblue3",            58,  95, 205 },
+    { "royalblue4",            39,  64, 139 },
+    { "saddlebrown",          139,  69,  19 },
+    { "salmon",               250, 128, 114 },
+    { "salmon1",              255, 140, 105 },
+    { "salmon2",              238, 130,  98 },
+    { "salmon3",              205, 112,  84 },
+    { "salmon4",              139,  76,  57 },
+    { "sandybrown",           244, 164,  96 },
+    { "seagreen",              46, 139,  87 },
+    { "seagreen1",             84, 255, 159 },
+    { "seagreen2",             78, 238, 148 },
+    { "seagreen3",             67, 205, 128 },
+    { "seagreen4",             46, 139,  87 },
+    { "seashell",             255, 245, 238 },
+    { "seashell1",            255, 245, 238 },
+    { "seashell2",            238, 229, 222 },
+    { "seashell3",            205, 197, 191 },
+    { "seashell4",            139, 134, 130 },
+    { "sienna",               160,  82,  45 },
+    { "sienna1",              255, 130,  71 },
+    { "sienna2",              238, 121,  66 },
+    { "sienna3",              205, 104,  57 },
+    { "sienna4",              139,  71,  38 },
+    { "skyblue",              135, 206, 235 },
+    { "skyblue1",             135, 206, 255 },
+    { "skyblue2",             126, 192, 238 },
+    { "skyblue3",             108, 166, 205 },
+    { "skyblue4",              74, 112, 139 },
+    { "slateblue",            106,  90, 205 },
+    { "slateblue1",           131, 111, 255 },
+    { "slateblue2",           122, 103, 238 },
+    { "slateblue3",           105,  89, 205 },
+    { "slateblue4",            71,  60, 139 },
+    { "slategray",            112, 128, 144 },
+    { "slategray1",           198, 226, 255 },
+    { "slategray2",           185, 211, 238 },
+    { "slategray3",           159, 182, 205 },
+    { "slategray4",           108, 123, 139 },
+    { "slategrey",            112, 128, 144 },
+    { "snow",                 255, 250, 250 },
+    { "snow1",                255, 250, 250 },
+    { "snow2",                238, 233, 233 },
+    { "snow3",                205, 201, 201 },
+    { "snow4",                139, 137, 137 },
+    { "springgreen",            0, 255, 127 },
+    { "springgreen1",           0, 255, 127 },
+    { "springgreen2",           0, 238, 118 },
+    { "springgreen3",           0, 205, 102 },
+    { "springgreen4",           0, 139,  69 },
+    { "steelblue",             70, 130, 180 },
+    { "steelblue1",            99, 184, 255 },
+    { "steelblue2",            92, 172, 238 },
+    { "steelblue3",            79, 148, 205 },
+    { "steelblue4",            54, 100, 139 },
+    { "tan",                  210, 180, 140 },
+    { "tan1",                 255, 165,  79 },
+    { "tan2",                 238, 154,  73 },
+    { "tan3",                 205, 133,  63 },
+    { "tan4",                 139,  90,  43 },
+    { "thistle",              216, 191, 216 },
+    { "thistle1",             255, 225, 255 },
+    { "thistle2",             238, 210, 238 },
+    { "thistle3",             205, 181, 205 },
+    { "thistle4",             139, 123, 139 },
+    { "tomato",               255,  99,  71 },
+    { "tomato1",              255,  99,  71 },
+    { "tomato2",              238,  92,  66 },
+    { "tomato3",              205,  79,  57 },
+    { "tomato4",              139,  54,  38 },
+    { "turquoise",             64, 224, 208 },
+    { "turquoise1",             0, 245, 255 },
+    { "turquoise2",             0, 229, 238 },
+    { "turquoise3",             0, 197, 205 },
+    { "turquoise4",             0, 134, 139 },
+    { "violet",               238, 130, 238 },
+    { "violetred",            208,  32, 144 },
+    { "violetred1",           255,  62, 150 },
+    { "violetred2",           238,  58, 140 },
+    { "violetred3",           205,  50, 120 },
+    { "violetred4",           139,  34,  82 },
+    { "wheat",                245, 222, 179 },
+    { "wheat1",               255, 231, 186 },
+    { "wheat2",               238, 216, 174 },
+    { "wheat3",               205, 186, 150 },
+    { "wheat4",               139, 126, 102 },
+    { "white",                255, 255, 255 },
+    { "whitesmoke",           245, 245, 245 },
+    { "yellow",               255, 255,   0 },
+    { "yellow1",              255, 255,   0 },
+    { "yellow2",              238, 238,   0 },
+    { "yellow3",              205, 205,   0 },
+    { "yellow4",              139, 139,   0 },
+    { "yellowgreen",          154, 205,  50 }
+};
+
+
+BOOL DLL_CALLCONV
+FreeImage_LookupX11Color(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue) {
+    int i;
+
+    // lookup color
+    i = FreeImage_LookupNamedColor(szColor, X11ColorMap, sizeof(X11ColorMap)/sizeof(X11ColorMap[0]));
+    if (i >= 0) {
+        *nRed   = X11ColorMap[i].r;
+        *nGreen = X11ColorMap[i].g;
+        *nBlue  = X11ColorMap[i].b;
+        return TRUE;
+    }
+
+    // not found, try for grey color with attached percent value
+    if ( (szColor[0] == 'g' || szColor[0] == 'G') &&
+         (szColor[1] == 'r' || szColor[1] == 'R') &&
+         (szColor[2] == 'e' || szColor[2] == 'E' || szColor[2] == 'a' || szColor[2] == 'A' ) &&
+         (szColor[3] == 'y' || szColor[3] == 'Y' ) )  {
+
+        // grey<num>, or gray<num>, num 1...100
+        i = strtol(szColor+4, NULL, 10);
+        *nRed   = (BYTE)(255.0/100.0 * i);
+        *nGreen = *nRed;
+        *nBlue  = *nRed;
+
+        return TRUE;
+    }
+
+    // not found at all
+    *nRed   = 0;
+    *nGreen = 0;
+    *nBlue  = 0;
+
+    return FALSE;
+}
+
+// ==========================================================
+// SVG Color name lookup
+
+/**
+ These are the colors defined in the SVG standard (I haven't checked
+ the final recommendation for changes)
+*/
+static NamedColor SVGColorMap[] = {
+        { "aliceblue",                  240, 248, 255 },
+        { "antiquewhite",               250, 235, 215 },
+        { "aqua",                         0, 255, 255 },
+        { "aquamarine",                 127, 255, 212 },
+        { "azure",                      240, 255, 255 },
+        { "beige",                      245, 245, 220 },
+        { "bisque",                     255, 228, 196 },
+        { "black",                        0,   0,   0 },
+        { "blanchedalmond",             255, 235, 205 },
+        { "blue",                         0,   0, 255 },
+        { "blueviolet",                 138,  43, 226 },
+        { "brown",                      165,  42,  42 },
+        { "burlywood",                  222, 184, 135 },
+        { "cadetblue",                   95, 158, 160 },
+        { "chartreuse",                 127, 255,   0 },
+        { "chocolate",                  210, 105,  30 },
+        { "coral",                      255, 127,  80 },
+        { "cornflowerblue",             100, 149, 237 },
+        { "cornsilk",                   255, 248, 220 },
+        { "crimson",                    220,  20,  60 },
+        { "cyan",                         0, 255, 255 },
+        { "darkblue",                     0,   0, 139 },
+        { "darkcyan",                     0, 139, 139 },
+        { "darkgoldenrod",              184, 134,  11 },
+        { "darkgray",                   169, 169, 169 },
+        { "darkgreen",                    0, 100,   0 },
+        { "darkgrey",                   169, 169, 169 },
+        { "darkkhaki",                  189, 183, 107 },
+        { "darkmagenta",                139,   0, 139 },
+        { "darkolivegreen",              85, 107,  47 },
+        { "darkorange",                 255, 140,   0 },
+        { "darkorchid",                 153,  50, 204 },
+        { "darkred",                    139,   0,   0 },
+        { "darksalmon",                 233, 150, 122 },
+        { "darkseagreen",               143, 188, 143 },
+        { "darkslateblue",               72,  61, 139 },
+        { "darkslategray",               47,  79,  79 },
+        { "darkslategrey",               47,  79,  79 },
+        { "darkturquoise",                0, 206, 209 },
+        { "darkviolet",                 148,   0, 211 },
+        { "deeppink",                   255,  20, 147 },
+        { "deepskyblue",                  0, 191, 255 },
+        { "dimgray",                    105, 105, 105 },
+        { "dimgrey",                    105, 105, 105 },
+        { "dodgerblue",                  30, 144, 255 },
+        { "firebrick",                  178,  34,  34 },
+        { "floralwhite",                255, 250, 240 },
+        { "forestgreen",                 34, 139,  34 },
+        { "fuchsia",                    255,   0, 255 },
+        { "gainsboro",                  220, 220, 220 },
+        { "ghostwhite",                 248, 248, 255 },
+        { "gold",                       255, 215,   0 },
+        { "goldenrod",                  218, 165,  32 },
+        { "gray",                       128, 128, 128 },
+        { "grey",                       128, 128, 128 },
+        { "green",                        0, 128,   0 },
+        { "greenyellow",                173, 255,  47 },
+        { "honeydew",                   240, 255, 240 },
+        { "hotpink",                    255, 105, 180 },
+        { "indianred",                  205,  92,  92 },
+        { "indigo",                      75,   0, 130 },
+        { "ivory",                      255, 255, 240 },
+        { "khaki",                      240, 230, 140 },
+        { "lavender",                   230, 230, 250 },
+        { "lavenderblush",              255, 240, 245 },
+        { "lawngreen",                  124, 252,   0 },
+        { "lemonchiffon",               255, 250, 205 },
+        { "lightblue",                  173, 216, 230 },
+        { "lightcoral",                 240, 128, 128 },
+        { "lightcyan",                  224, 255, 255 },
+        { "lightgoldenrodyellow",       250, 250, 210 },
+        { "lightgray",                  211, 211, 211 },
+        { "lightgreen",                 144, 238, 144 },
+        { "lightgrey",                  211, 211, 211 },
+        { "lightpink",                  255, 182, 193 },
+        { "lightsalmon",                255, 160, 122 },
+        { "lightseagreen",               32, 178, 170 },
+        { "lightskyblue",               135, 206, 250 },
+        { "lightslategray",             119, 136, 153 },
+        { "lightslategrey",             119, 136, 153 },
+        { "lightsteelblue",             176, 196, 222 },
+        { "lightyellow",                255, 255, 224 },
+        { "lime",                         0, 255,   0 },
+        { "limegreen",                   50, 205,  50 },
+        { "linen",                      250, 240, 230 },
+        { "magenta",                    255,   0, 255 },
+        { "maroon",                     128,   0,   0 },
+        { "mediumaquamarine",           102, 205, 170 },
+        { "mediumblue",                   0,   0, 205 },
+        { "mediumorchid",               186,  85, 211 },
+        { "mediumpurple",               147, 112, 219 },
+        { "mediumseagreen",              60, 179, 113 },
+        { "mediumslateblue",            123, 104, 238 },
+        { "mediumspringgreen",            0, 250, 154 },
+        { "mediumturquoise",             72, 209, 204 },
+        { "mediumvioletred",            199,  21, 133 },
+        { "midnightblue",                25,  25, 112 },
+        { "mintcream",                  245, 255, 250 },
+        { "mistyrose",                  255, 228, 225 },
+        { "moccasin",                   255, 228, 181 },
+        { "navajowhite",                255, 222, 173 },
+        { "navy",                         0,   0, 128 },
+        { "oldlace",                    253, 245, 230 },
+        { "olive",                      128, 128,   0 },
+        { "olivedrab",                  107, 142,  35 },
+        { "orange",                     255, 165,   0 },
+        { "orangered",                  255,  69,   0 },
+        { "orchid",                     218, 112, 214 },
+        { "palegoldenrod",              238, 232, 170 },
+        { "palegreen",                  152, 251, 152 },
+        { "paleturquoise",              175, 238, 238 },
+        { "palevioletred",              219, 112, 147 },
+        { "papayawhip",                 255, 239, 213 },
+        { "peachpuff",                  255, 218, 185 },
+        { "peru",                       205, 133,  63 },
+        { "pink",                       255, 192, 203 },
+        { "plum",                       221, 160, 221 },
+        { "powderblue",                 176, 224, 230 },
+        { "purple",                     128,   0, 128 },
+        { "red",                        255,   0,   0 },
+        { "rosybrown",                  188, 143, 143 },
+        { "royalblue",                   65, 105, 225 },
+        { "saddlebrown",                139,  69,  19 },
+        { "salmon",                     250, 128, 114 },
+        { "sandybrown",                 244, 164,  96 },
+        { "seagreen",                    46, 139,  87 },
+        { "seashell",                   255, 245, 238 },
+        { "sienna",                     160,  82,  45 },
+        { "silver",                     192, 192, 192 },
+        { "skyblue",                    135, 206, 235 },
+        { "slateblue",                  106,  90, 205 },
+        { "slategray",                  112, 128, 144 },
+        { "slategrey",                  112, 128, 144 },
+        { "snow",                       255, 250, 250 },
+        { "springgreen",                  0, 255, 127 },
+        { "steelblue",                   70, 130, 180 },
+        { "tan",                        210, 180, 140 },
+        { "teal",                         0, 128, 128 },
+        { "thistle",                    216, 191, 216 },
+        { "tomato",                     255,  99,  71 },
+        { "turquoise",                   64, 224, 208 },
+        { "violet",                     238, 130, 238 },
+        { "wheat",                      245, 222, 179 },
+        { "white",                      255, 255, 255 },
+        { "whitesmoke",                 245, 245, 245 },
+        { "yellow",                     255, 255,   0 },
+        { "yellowgreen",                154, 205,  50 }
+};
+
+
+BOOL DLL_CALLCONV
+FreeImage_LookupSVGColor(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue) {
+    int i;
+
+    // lookup color
+    i = FreeImage_LookupNamedColor(szColor, SVGColorMap, sizeof(SVGColorMap)/sizeof(SVGColorMap[0]));
+    if (i >= 0) {
+        *nRed   = SVGColorMap[i].r;
+        *nGreen = SVGColorMap[i].g;
+        *nBlue  = SVGColorMap[i].b;
+        return TRUE;
+    }
+
+    // not found, try for grey color with attached percent value
+    if ( (szColor[0] == 'g' || szColor[0] == 'G') &&
+         (szColor[1] == 'r' || szColor[1] == 'R') &&
+         (szColor[2] == 'e' || szColor[2] == 'E' || szColor[2] == 'a' || szColor[2] == 'A' ) &&
+         (szColor[3] == 'y' || szColor[3] == 'Y' ) )  {
+
+        // grey<num>, or gray<num>, num 1...100
+        i = strtol(szColor+4, NULL, 10);
+        *nRed   = (BYTE)(255.0/100.0 * i);
+        *nGreen = *nRed;
+        *nBlue  = *nRed;
+        return TRUE;
+    }
+
+    // not found at all
+    *nRed   = 0;
+    *nGreen = 0;
+    *nBlue  = 0;
+
+    return FALSE;
+}
+
diff --git a/Source/FreeImage/Conversion.cpp b/Source/FreeImage/Conversion.cpp
new file mode 100644
index 0000000..513dbee
--- /dev/null
+++ b/Source/FreeImage/Conversion.cpp
@@ -0,0 +1,203 @@
+// ==========================================================
+// Bitmap conversion routines
+//
+// Design and implementation by
+// - Floris van den Berg (flvdberg@wxs.nl)
+// - Hervé Drolon (drolon@infonie.fr)
+// - Jani Kajala (janik@remedy.fi)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#include "FreeImage.h"
+#include "Utilities.h"
+#include "Quantizers.h"
+
+// ----------------------------------------------------------
+
+#define CONVERT(from, to) case to : FreeImage_ConvertLine##from##To##to(bits, scanline, FreeImage_GetWidth(dib)); break;
+#define CONVERTWITHPALETTE(from, to) case to : FreeImage_ConvertLine##from##To##to(bits, scanline, FreeImage_GetWidth(dib), FreeImage_GetPalette(dib)); break;
+
+#define CONVERTTO16(from) \
+	case 16 : \
+		if ((red_mask == FI16_555_RED_MASK) && (green_mask == FI16_555_GREEN_MASK) && (blue_mask == FI16_555_BLUE_MASK)) { \
+			FreeImage_ConvertLine##from##To16_555(bits, scanline, FreeImage_GetWidth(dib)); \
+		} else { \
+			FreeImage_ConvertLine##from##To16_565(bits, scanline, FreeImage_GetWidth(dib)); \
+		} \
+		break;
+
+#define CONVERTTO16WITHPALETTE(from) \
+	case 16 : \
+		if ((red_mask == FI16_555_RED_MASK) && (green_mask == FI16_555_GREEN_MASK) && (blue_mask == FI16_555_BLUE_MASK)) { \
+			FreeImage_ConvertLine##from##To16_555(bits, scanline, FreeImage_GetWidth(dib), FreeImage_GetPalette(dib)); \
+		} else { \
+			FreeImage_ConvertLine##from##To16_565(bits, scanline, FreeImage_GetWidth(dib), FreeImage_GetPalette(dib)); \
+		} \
+		break;
+
+// ==========================================================
+
+FIBITMAP * DLL_CALLCONV
+FreeImage_ColorQuantize(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize) {
+	return FreeImage_ColorQuantizeEx(dib, quantize);
+}
+
+FIBITMAP * DLL_CALLCONV
+FreeImage_ColorQuantizeEx(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize, int PaletteSize, int ReserveSize, RGBQUAD *ReservePalette) {
+	if( PaletteSize < 2 ) PaletteSize = 2;
+	if( PaletteSize > 256 ) PaletteSize = 256;
+	if( ReserveSize < 0 ) ReserveSize = 0;
+	if( ReserveSize > PaletteSize ) ReserveSize = PaletteSize;
+	if (dib) {
+		if (FreeImage_GetBPP(dib) == 24) {
+			switch(quantize) {
+				case FIQ_WUQUANT :
+				{
+					try {
+						WuQuantizer Q (dib);
+						FIBITMAP *dst = Q.Quantize(PaletteSize, ReserveSize, ReservePalette);
+						if(dst) {
+							// copy metadata from src to dst
+							FreeImage_CloneMetadata(dst, dib);
+						}
+						return dst;
+					} catch (const char *) {
+						return NULL;
+					}
+				}
+				case FIQ_NNQUANT :
+				{
+					// sampling factor in range 1..30. 
+					// 1 => slower (but better), 30 => faster. Default value is 1
+					const int sampling = 1;
+
+					NNQuantizer Q(PaletteSize);
+					FIBITMAP *dst = Q.Quantize(dib, ReserveSize, ReservePalette, sampling);
+					if(dst) {
+						// copy metadata from src to dst
+						FreeImage_CloneMetadata(dst, dib);
+					}
+					return dst;
+				}
+			}
+		}
+	}
+
+	return NULL;
+}
+
+// ==========================================================
+
+FIBITMAP * DLL_CALLCONV
+FreeImage_ConvertFromRawBits(BYTE *bits, int width, int height, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown) {
+	FIBITMAP *dib = FreeImage_Allocate(width, height, bpp, red_mask, green_mask, blue_mask);
+
+	if (dib != NULL) {
+		if (topdown) {
+			for (int i = height - 1; i >= 0; --i) {
+				memcpy(FreeImage_GetScanLine(dib, i), bits, FreeImage_GetLine(dib));
+				bits += pitch;
+			}
+		} else {
+			for (int i = 0; i < height; ++i) {			
+				memcpy(FreeImage_GetScanLine(dib, i), bits, FreeImage_GetLine(dib));
+				bits += pitch;
+			}
+		}
+	}
+
+	return dib;
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertToRawBits(BYTE *bits, FIBITMAP *dib, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown) {
+	if ((dib != NULL) && (bits != NULL)) {
+		for (unsigned i = 0; i < FreeImage_GetHeight(dib); ++i) {
+			BYTE *scanline = FreeImage_GetScanLine(dib, topdown ? (FreeImage_GetHeight(dib) - i - 1) : i);
+
+			if ((bpp == 16) && (FreeImage_GetBPP(dib) == 16)) {
+				// convert 555 to 565 or vice versa
+
+				if ((red_mask == FI16_555_RED_MASK) && (green_mask == FI16_555_GREEN_MASK) && (blue_mask == FI16_555_BLUE_MASK)) {
+					if ((FreeImage_GetRedMask(dib) == FI16_565_RED_MASK) && (FreeImage_GetGreenMask(dib) == FI16_565_GREEN_MASK) && (FreeImage_GetBlueMask(dib) == FI16_565_BLUE_MASK)) {
+						FreeImage_ConvertLine16_565_To16_555(bits, scanline, FreeImage_GetWidth(dib));
+					} else {
+						memcpy(bits, scanline, FreeImage_GetLine(dib));
+					}
+				} else {
+					if ((FreeImage_GetRedMask(dib) == FI16_555_RED_MASK) && (FreeImage_GetGreenMask(dib) == FI16_555_GREEN_MASK) && (FreeImage_GetBlueMask(dib) == FI16_555_BLUE_MASK)) {
+						FreeImage_ConvertLine16_555_To16_565(bits, scanline, FreeImage_GetWidth(dib));
+					} else {
+						memcpy(bits, scanline, FreeImage_GetLine(dib));
+					}
+				}
+			} else if (FreeImage_GetBPP(dib) != bpp) {
+				switch(FreeImage_GetBPP(dib)) {
+					case 1 :
+						switch(bpp) {
+							CONVERT(1, 8)
+							CONVERTTO16WITHPALETTE(1)
+							CONVERTWITHPALETTE(1, 24)
+							CONVERTWITHPALETTE(1, 32)
+						};
+
+						break;
+
+					case 4 :
+						switch(bpp) {
+							CONVERT(4, 8)
+							CONVERTTO16WITHPALETTE(4)
+							CONVERTWITHPALETTE(4, 24)
+							CONVERTWITHPALETTE(4, 32)
+						};
+
+						break;
+
+					case 8 :
+						switch(bpp) {
+							CONVERTTO16WITHPALETTE(8)
+							CONVERTWITHPALETTE(8, 24)
+							CONVERTWITHPALETTE(8, 32)
+						};
+
+						break;
+
+					case 24 :
+						switch(bpp) {
+							CONVERT(24, 8)
+							CONVERTTO16(24)
+							CONVERT(24, 32)
+						};
+
+						break;
+
+					case 32 :
+						switch(bpp) {
+							CONVERT(32, 8)
+							CONVERTTO16(32)
+							CONVERT(32, 24)
+						};
+
+						break;
+				};
+			} else {
+				memcpy(bits, scanline, FreeImage_GetLine(dib));
+			}
+
+			bits += pitch;
+		}
+	}
+}
diff --git a/Source/FreeImage/Conversion16_555.cpp b/Source/FreeImage/Conversion16_555.cpp
new file mode 100644
index 0000000..da30db6
--- /dev/null
+++ b/Source/FreeImage/Conversion16_555.cpp
@@ -0,0 +1,209 @@
+// ==========================================================
+// Bitmap conversion routines
+//
+// Design and implementation by
+// - Floris van den Berg (flvdberg@wxs.nl)
+// - Hervé Drolon (drolon@infonie.fr)
+// - Jani Kajala (janik@remedy.fi)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#include "FreeImage.h"
+#include "Utilities.h"
+
+// ----------------------------------------------------------
+
+#define RGB555(b, g, r) ((((b) >> 3) << FI16_555_BLUE_SHIFT) | (((g) >> 3) << FI16_555_GREEN_SHIFT) | (((r) >> 3) << FI16_555_RED_SHIFT))
+
+// ----------------------------------------------------------
+//  internal conversions X to 16 bits (555)
+// ----------------------------------------------------------
+
+void DLL_CALLCONV
+FreeImage_ConvertLine1To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) {
+	WORD *new_bits = (WORD *)target;
+
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		int index = (source[cols >> 3] & (0x80 >> (cols & 0x07))) != 0 ? 1 : 0;
+
+		new_bits[cols] = RGB555(palette[index].rgbBlue, palette[index].rgbGreen, palette[index].rgbRed);
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine4To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) {
+	WORD *new_bits = (WORD *)target;
+	BOOL lonibble = FALSE;
+	int x = 0;
+
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		RGBQUAD *grab_palette;
+
+		if (lonibble) {
+			grab_palette = palette + LOWNIBBLE(source[x++]);
+		} else {
+			grab_palette = palette + (HINIBBLE(source[x]) >> 4);								
+		}
+
+		new_bits[cols] = RGB555(grab_palette->rgbBlue, grab_palette->rgbGreen, grab_palette->rgbRed);
+
+		lonibble = !lonibble;
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine8To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) {
+	WORD *new_bits = (WORD *)target;
+
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		RGBQUAD *grab_palette = palette + source[cols];
+
+		new_bits[cols] = RGB555(grab_palette->rgbBlue, grab_palette->rgbGreen, grab_palette->rgbRed);
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine16_565_To16_555(BYTE *target, BYTE *source, int width_in_pixels) {
+	WORD *src_bits = (WORD *)source;
+	WORD *new_bits = (WORD *)target;
+
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		new_bits[cols] = RGB555((((src_bits[cols] & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) * 0xFF) / 0x1F,
+			                    (((src_bits[cols] & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) * 0xFF) / 0x3F,
+								(((src_bits[cols] & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) * 0xFF) / 0x1F);
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine24To16_555(BYTE *target, BYTE *source, int width_in_pixels) {
+	WORD *new_bits = (WORD *)target;
+
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		new_bits[cols] = RGB555(source[FI_RGBA_BLUE], source[FI_RGBA_GREEN], source[FI_RGBA_RED]);
+
+		source += 3;
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine32To16_555(BYTE *target, BYTE *source, int width_in_pixels) {
+	WORD *new_bits = (WORD *)target;
+
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		new_bits[cols] = RGB555(source[FI_RGBA_BLUE], source[FI_RGBA_GREEN], source[FI_RGBA_RED]);
+
+		source += 4;
+	}
+}
+
+// ----------------------------------------------------------
+//   smart convert X to 16 bits
+// ----------------------------------------------------------
+
+FIBITMAP * DLL_CALLCONV
+FreeImage_ConvertTo16Bits555(FIBITMAP *dib) {
+	if(!dib || (FreeImage_GetImageType(dib) != FIT_BITMAP)) return NULL;
+
+	const int width = FreeImage_GetWidth(dib);
+	const int height = FreeImage_GetHeight(dib);
+	const int bpp = FreeImage_GetBPP(dib);
+
+	if(bpp == 16) {
+		if ((FreeImage_GetRedMask(dib) == FI16_565_RED_MASK) && (FreeImage_GetGreenMask(dib) == FI16_565_GREEN_MASK) && (FreeImage_GetBlueMask(dib) == FI16_565_BLUE_MASK)) {
+			// RGB 565
+			FIBITMAP *new_dib = FreeImage_Allocate(width, height, 16, FI16_555_RED_MASK, FI16_555_GREEN_MASK, FI16_555_BLUE_MASK);
+			if(new_dib == NULL) {
+				return NULL;
+			}
+			for (int rows = 0; rows < height; rows++) {
+				FreeImage_ConvertLine16_565_To16_555(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);
+			}
+
+			// copy metadata from src to dst
+			FreeImage_CloneMetadata(new_dib, dib);
+
+			return new_dib;
+		} else {
+			// RGB 555
+			return FreeImage_Clone(dib);
+		}
+	}
+	else {
+		// other bpp cases => convert to RGB 555
+		FIBITMAP *new_dib = FreeImage_Allocate(width, height, 16, FI16_555_RED_MASK, FI16_555_GREEN_MASK, FI16_555_BLUE_MASK);
+		if(new_dib == NULL) {
+			return NULL;
+		}
+
+		// copy metadata from src to dst
+		FreeImage_CloneMetadata(new_dib, dib);
+
+		switch (bpp) {
+			case 1 :
+			{
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine1To16_555(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width, FreeImage_GetPalette(dib));
+				}
+
+				return new_dib;
+			}
+
+			case 4 :
+			{
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine4To16_555(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width, FreeImage_GetPalette(dib));
+				}
+
+				return new_dib;
+			}
+
+			case 8 :
+			{
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine8To16_555(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width, FreeImage_GetPalette(dib));
+				}
+
+				return new_dib;
+			}
+
+			case 24 :
+			{
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine24To16_555(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);
+				}
+
+				return new_dib;
+			}
+
+			case 32 :
+			{
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine32To16_555(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);
+				}
+
+				return new_dib;
+			}
+
+			default :
+				// unreachable code ...
+				FreeImage_Unload(new_dib);
+				break;
+
+		}
+	}
+
+	return NULL;
+}
diff --git a/Source/FreeImage/Conversion16_565.cpp b/Source/FreeImage/Conversion16_565.cpp
new file mode 100644
index 0000000..367bc4a
--- /dev/null
+++ b/Source/FreeImage/Conversion16_565.cpp
@@ -0,0 +1,204 @@
+// ==========================================================
+// Bitmap conversion routines
+//
+// Design and implementation by
+// - Floris van den Berg (flvdberg@wxs.nl)
+// - Hervé Drolon (drolon@infonie.fr)
+// - Jani Kajala (janik@remedy.fi)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#include "FreeImage.h"
+#include "Utilities.h"
+
+// ----------------------------------------------------------
+//  internal conversions X to 16 bits (565)
+// ----------------------------------------------------------
+
+void DLL_CALLCONV
+FreeImage_ConvertLine1To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) {
+	WORD *new_bits = (WORD *)target;
+
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		int index = (source[cols >> 3] & (0x80 >> (cols & 0x07))) != 0 ? 1 : 0;
+
+		new_bits[cols] = RGB565(palette[index].rgbBlue, palette[index].rgbGreen, palette[index].rgbRed);
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine4To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) {
+	WORD *new_bits = (WORD *)target;
+	BOOL lonibble = FALSE;
+	int x = 0;
+
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		RGBQUAD *grab_palette;
+
+		if (lonibble) {
+			grab_palette = palette + LOWNIBBLE(source[x++]);
+		} else {
+			grab_palette = palette + (HINIBBLE(source[x]) >> 4);								
+		}
+
+		new_bits[cols] = RGB565(grab_palette->rgbBlue, grab_palette->rgbGreen, grab_palette->rgbRed);
+
+		lonibble = !lonibble;
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine8To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) {
+	WORD *new_bits = (WORD *)target;
+
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		RGBQUAD *grab_palette = palette + source[cols];
+
+		new_bits[cols] = RGB565(grab_palette->rgbBlue, grab_palette->rgbGreen, grab_palette->rgbRed);
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine16_555_To16_565(BYTE *target, BYTE *source, int width_in_pixels) {
+	WORD *src_bits = (WORD *)source;
+	WORD *new_bits = (WORD *)target;
+
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		new_bits[cols] = RGB565((((src_bits[cols] & FI16_555_BLUE_MASK) >> FI16_555_BLUE_SHIFT) * 0xFF) / 0x1F,
+			                    (((src_bits[cols] & FI16_555_GREEN_MASK) >> FI16_555_GREEN_SHIFT) * 0xFF) / 0x1F,
+								(((src_bits[cols] & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) * 0xFF) / 0x1F);
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine24To16_565(BYTE *target, BYTE *source, int width_in_pixels) {
+	WORD *new_bits = (WORD *)target;
+
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		new_bits[cols] = RGB565(source[FI_RGBA_BLUE], source[FI_RGBA_GREEN], source[FI_RGBA_RED]);
+
+		source += 3;
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine32To16_565(BYTE *target, BYTE *source, int width_in_pixels) {
+	WORD *new_bits = (WORD *)target;
+
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		new_bits[cols] = RGB565(source[FI_RGBA_BLUE], source[FI_RGBA_GREEN], source[FI_RGBA_RED]);
+
+		source += 4;
+	}
+}
+
+// ----------------------------------------------------------
+//   smart convert X to 16 bits (565)
+// ----------------------------------------------------------
+
+FIBITMAP * DLL_CALLCONV
+FreeImage_ConvertTo16Bits565(FIBITMAP *dib) {
+	if(!dib || (FreeImage_GetImageType(dib) != FIT_BITMAP)) return NULL;
+
+	const int width = FreeImage_GetWidth(dib);
+	const int height = FreeImage_GetHeight(dib);
+	const int bpp = FreeImage_GetBPP(dib);
+
+	if(bpp == 16) {
+		if ((FreeImage_GetRedMask(dib) == FI16_555_RED_MASK) && (FreeImage_GetGreenMask(dib) == FI16_555_GREEN_MASK) && (FreeImage_GetBlueMask(dib) == FI16_555_BLUE_MASK)) {
+			// RGB 555
+			FIBITMAP *new_dib = FreeImage_Allocate(width, height, 16, FI16_565_RED_MASK, FI16_565_GREEN_MASK, FI16_565_BLUE_MASK);
+			if(new_dib == NULL) {
+				return NULL;
+			}
+			for (int rows = 0; rows < height; rows++) {
+				FreeImage_ConvertLine16_555_To16_565(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);
+			}
+
+			// copy metadata from src to dst
+			FreeImage_CloneMetadata(new_dib, dib);
+
+			return new_dib;
+		} else {
+			// RGB 565
+			return FreeImage_Clone(dib);
+		}
+	}
+	else {
+		// other bpp cases => convert to RGB 565
+		FIBITMAP *new_dib = FreeImage_Allocate(width, height, 16, FI16_565_RED_MASK, FI16_565_GREEN_MASK, FI16_565_BLUE_MASK);
+		if(new_dib == NULL) {
+			return NULL;
+		}
+
+		// copy metadata from src to dst
+		FreeImage_CloneMetadata(new_dib, dib);
+
+		switch (bpp) {
+			case 1 :
+			{
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine1To16_565(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width, FreeImage_GetPalette(dib));
+				}
+
+				return new_dib;
+			}
+
+			case 4 :
+			{
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine4To16_565(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width, FreeImage_GetPalette(dib));
+				}
+
+				return new_dib;
+			}
+
+			case 8 :
+			{
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine8To16_565(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width, FreeImage_GetPalette(dib));
+				}
+
+				return new_dib;
+			}
+
+			case 24 :
+			{
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine24To16_565(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);
+				}
+
+				return new_dib;
+			}
+
+			case 32 :
+			{
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine32To16_565(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);
+				}
+
+				return new_dib;
+			}
+
+			default :
+				// unreachable code ...
+				FreeImage_Unload(new_dib);
+				break;
+		}
+	}
+
+	return NULL;
+}
diff --git a/Source/FreeImage/Conversion24.cpp b/Source/FreeImage/Conversion24.cpp
new file mode 100644
index 0000000..8e18864
--- /dev/null
+++ b/Source/FreeImage/Conversion24.cpp
@@ -0,0 +1,214 @@
+// ==========================================================
+// Bitmap conversion routines
+//
+// Design and implementation by
+// - Floris van den Berg (flvdberg@wxs.nl)
+// - Dale Larson (dlarson@norsesoft.com)
+// - Hervé Drolon (drolon@infonie.fr)
+// - Jani Kajala (janik@remedy.fi)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#include "FreeImage.h"
+#include "Utilities.h"
+
+// ----------------------------------------------------------
+//  internal conversions X to 24 bits
+// ----------------------------------------------------------
+
+void DLL_CALLCONV
+FreeImage_ConvertLine1To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) {
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		BYTE index = (source[cols >> 3] & (0x80 >> (cols & 0x07))) != 0 ? 1 : 0;
+
+		target[FI_RGBA_BLUE] = palette[index].rgbBlue;
+		target[FI_RGBA_GREEN] = palette[index].rgbGreen;
+		target[FI_RGBA_RED] = palette[index].rgbRed;
+
+		target += 3;
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine4To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) {
+	BOOL low_nibble = FALSE;
+	int x = 0;
+
+	for (int cols = 0; cols < width_in_pixels; ++cols ) {
+		if (low_nibble) {
+			target[FI_RGBA_BLUE] = palette[LOWNIBBLE(source[x])].rgbBlue;
+			target[FI_RGBA_GREEN] = palette[LOWNIBBLE(source[x])].rgbGreen;
+			target[FI_RGBA_RED] = palette[LOWNIBBLE(source[x])].rgbRed;
+
+			x++;
+		} else {
+			target[FI_RGBA_BLUE] = palette[HINIBBLE(source[x]) >> 4].rgbBlue;
+			target[FI_RGBA_GREEN] = palette[HINIBBLE(source[x]) >> 4].rgbGreen;
+			target[FI_RGBA_RED] = palette[HINIBBLE(source[x]) >> 4].rgbRed;
+		}
+
+		low_nibble = !low_nibble;
+
+		target += 3;
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine8To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) {
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		target[FI_RGBA_BLUE] = palette[source[cols]].rgbBlue;
+		target[FI_RGBA_GREEN] = palette[source[cols]].rgbGreen;
+		target[FI_RGBA_RED] = palette[source[cols]].rgbRed;
+
+		target += 3;
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine16To24_555(BYTE *target, BYTE *source, int width_in_pixels) {
+	WORD *bits = (WORD *)source;
+
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		target[FI_RGBA_RED]   = (BYTE)((((bits[cols] & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) * 0xFF) / 0x1F);
+		target[FI_RGBA_GREEN] = (BYTE)((((bits[cols] & FI16_555_GREEN_MASK) >> FI16_555_GREEN_SHIFT) * 0xFF) / 0x1F);
+		target[FI_RGBA_BLUE]  = (BYTE)((((bits[cols] & FI16_555_BLUE_MASK) >> FI16_555_BLUE_SHIFT) * 0xFF) / 0x1F);
+
+		target += 3;
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine16To24_565(BYTE *target, BYTE *source, int width_in_pixels) {
+	WORD *bits = (WORD *)source;
+
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		target[FI_RGBA_RED]   = (BYTE)((((bits[cols] & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) * 0xFF) / 0x1F);
+		target[FI_RGBA_GREEN] = (BYTE)((((bits[cols] & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) * 0xFF) / 0x3F);
+		target[FI_RGBA_BLUE]  = (BYTE)((((bits[cols] & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) * 0xFF) / 0x1F);
+
+		target += 3;
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine32To24(BYTE *target, BYTE *source, int width_in_pixels) {
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		target[FI_RGBA_BLUE] = source[FI_RGBA_BLUE];
+		target[FI_RGBA_GREEN] = source[FI_RGBA_GREEN];
+		target[FI_RGBA_RED] = source[FI_RGBA_RED];
+
+		target += 3;
+		source += 4;
+	}
+}
+
+// ----------------------------------------------------------
+//   smart convert X to 24 bits
+// ----------------------------------------------------------
+
+FIBITMAP * DLL_CALLCONV
+FreeImage_ConvertTo24Bits(FIBITMAP *dib) {
+	if(!dib) return NULL;
+
+	const unsigned bpp = FreeImage_GetBPP(dib);
+
+	const FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(dib);
+	if((image_type != FIT_BITMAP) && (image_type != FIT_RGB16)) {
+		return NULL;
+	}
+
+	if (bpp != 24) {
+		const int width = FreeImage_GetWidth(dib);
+		const int height = FreeImage_GetHeight(dib);
+		FIBITMAP *new_dib = FreeImage_Allocate(width, height, 24, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
+
+		if(new_dib == NULL) {
+			return NULL;
+		}
+
+		// copy metadata from src to dst
+		FreeImage_CloneMetadata(new_dib, dib);
+
+		switch(bpp) {
+			case 1 :
+			{
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine1To24(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width, FreeImage_GetPalette(dib));					
+				}
+				return new_dib;
+			}
+
+			case 4 :
+			{
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine4To24(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width, FreeImage_GetPalette(dib));
+				}
+				return new_dib;
+			}
+				
+			case 8 :
+			{
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine8To24(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width, FreeImage_GetPalette(dib));
+				}
+				return new_dib;
+			}
+
+			case 16 :
+			{
+				for (int rows = 0; rows < height; rows++) {
+					if ((FreeImage_GetRedMask(dib) == FI16_565_RED_MASK) && (FreeImage_GetGreenMask(dib) == FI16_565_GREEN_MASK) && (FreeImage_GetBlueMask(dib) == FI16_565_BLUE_MASK)) {
+						FreeImage_ConvertLine16To24_565(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);
+					} else {
+						// includes case where all the masks are 0
+						FreeImage_ConvertLine16To24_555(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);
+					}
+				}
+				return new_dib;
+			}
+
+			case 32 :
+			{
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine32To24(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);
+				}
+				return new_dib;
+			}
+
+			case 48:
+			{
+				const unsigned src_pitch = FreeImage_GetPitch(dib);
+				const unsigned dst_pitch = FreeImage_GetPitch(new_dib);
+				const BYTE *src_bits = FreeImage_GetBits(dib);
+				BYTE *dst_bits = FreeImage_GetBits(new_dib);
+				for (int rows = 0; rows < height; rows++) {
+					const FIRGB16 *src_pixel = (FIRGB16*)src_bits;
+					RGBTRIPLE *dst_pixel = (RGBTRIPLE*)dst_bits;
+					for(int cols = 0; cols < width; cols++) {
+						dst_pixel[cols].rgbtRed   = (BYTE)(src_pixel[cols].red   >> 8);
+						dst_pixel[cols].rgbtGreen = (BYTE)(src_pixel[cols].green >> 8);
+						dst_pixel[cols].rgbtBlue  = (BYTE)(src_pixel[cols].blue  >> 8);
+					}
+					src_bits += src_pitch;
+					dst_bits += dst_pitch;
+				}
+				return new_dib;
+			}
+		}
+	}
+
+	return FreeImage_Clone(dib);
+}
diff --git a/Source/FreeImage/Conversion32.cpp b/Source/FreeImage/Conversion32.cpp
new file mode 100644
index 0000000..30a4310
--- /dev/null
+++ b/Source/FreeImage/Conversion32.cpp
@@ -0,0 +1,319 @@
+// ==========================================================
+// Bitmap conversion routines
+//
+// Design and implementation by
+// - Floris van den Berg (flvdberg@wxs.nl)
+// - Hervé Drolon (drolon@infonie.fr)
+// - Jani Kajala (janik@remedy.fi)
+// - Detlev Vendt (detlev.vendt@brillit.de)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#include "FreeImage.h"
+#include "Utilities.h"
+
+// ----------------------------------------------------------
+//  internal conversions X to 32 bits
+// ----------------------------------------------------------
+
+void DLL_CALLCONV
+FreeImage_ConvertLine1To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) {
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		int index = (source[cols>>3] & (0x80 >> (cols & 0x07))) != 0 ? 1 : 0;
+
+		target[FI_RGBA_BLUE]	= palette[index].rgbBlue;
+		target[FI_RGBA_GREEN]	= palette[index].rgbGreen;
+		target[FI_RGBA_RED]		= palette[index].rgbRed;
+		target[FI_RGBA_ALPHA]	= 0xFF;
+		target += 4;
+	}	
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine4To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) {
+	BOOL low_nibble = FALSE;
+	int x = 0;
+
+	for (int cols = 0 ; cols < width_in_pixels ; ++cols) {
+		if (low_nibble) {
+			target[FI_RGBA_BLUE]	= palette[LOWNIBBLE(source[x])].rgbBlue;
+			target[FI_RGBA_GREEN]	= palette[LOWNIBBLE(source[x])].rgbGreen;
+			target[FI_RGBA_RED]		= palette[LOWNIBBLE(source[x])].rgbRed;
+
+			x++;
+		} else {
+			target[FI_RGBA_BLUE]	= palette[HINIBBLE(source[x]) >> 4].rgbBlue;
+			target[FI_RGBA_GREEN]	= palette[HINIBBLE(source[x]) >> 4].rgbGreen;
+			target[FI_RGBA_RED]		= palette[HINIBBLE(source[x]) >> 4].rgbRed;
+		}
+
+		low_nibble = !low_nibble;
+
+		target[FI_RGBA_ALPHA] = 0xFF;
+		target += 4;
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine8To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) {
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		target[FI_RGBA_BLUE]	= palette[source[cols]].rgbBlue;
+		target[FI_RGBA_GREEN]	= palette[source[cols]].rgbGreen;
+		target[FI_RGBA_RED]		= palette[source[cols]].rgbRed;
+		target[FI_RGBA_ALPHA]	= 0xFF;
+		target += 4;
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine16To32_555(BYTE *target, BYTE *source, int width_in_pixels) {
+	WORD *bits = (WORD *)source;
+
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		target[FI_RGBA_RED]   = (BYTE)((((bits[cols] & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) * 0xFF) / 0x1F);
+		target[FI_RGBA_GREEN] = (BYTE)((((bits[cols] & FI16_555_GREEN_MASK) >> FI16_555_GREEN_SHIFT) * 0xFF) / 0x1F);
+		target[FI_RGBA_BLUE]  = (BYTE)((((bits[cols] & FI16_555_BLUE_MASK) >> FI16_555_BLUE_SHIFT) * 0xFF) / 0x1F);
+		target[FI_RGBA_ALPHA] = 0xFF;
+		target += 4;
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine16To32_565(BYTE *target, BYTE *source, int width_in_pixels) {
+	WORD *bits = (WORD *)source;
+
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		target[FI_RGBA_RED]   = (BYTE)((((bits[cols] & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) * 0xFF) / 0x1F);
+		target[FI_RGBA_GREEN] = (BYTE)((((bits[cols] & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) * 0xFF) / 0x3F);
+		target[FI_RGBA_BLUE]  = (BYTE)((((bits[cols] & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) * 0xFF) / 0x1F);
+		target[FI_RGBA_ALPHA] = 0xFF;
+		target += 4;
+	}
+}
+/*
+void DLL_CALLCONV
+FreeImage_ConvertLine24To32(BYTE *target, BYTE *source, int width_in_pixels) {
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		*(DWORD *)target = (*(DWORD *) source & FI_RGBA_RGB_MASK) | FI_RGBA_ALPHA_MASK;
+		target += 4;
+		source += 3;
+	}
+}
+*/
+/**
+This unoptimized version of the conversion function avoid an undetermined bug with VC++ SP6. 
+The bug occurs in release mode only, when the image height is equal to 537 
+(try e.g. a size of 432x537 to reproduce the bug with the optimized function).
+*/
+void DLL_CALLCONV
+FreeImage_ConvertLine24To32(BYTE *target, BYTE *source, int width_in_pixels) {
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		target[FI_RGBA_RED]   = source[FI_RGBA_RED];
+		target[FI_RGBA_GREEN] = source[FI_RGBA_GREEN];
+		target[FI_RGBA_BLUE]  = source[FI_RGBA_BLUE];
+		target[FI_RGBA_ALPHA] = 0xFF;
+		target += 4;
+		source += 3;
+	}
+}
+// ----------------------------------------------------------
+
+static void DLL_CALLCONV
+MapTransparentTableToAlpha1(RGBQUAD *target, BYTE *source, BYTE *table, int transparent_pixels, int width_in_pixels) {
+	for (int cols = 0 ; cols < width_in_pixels ; cols++) {
+		int index = (source[cols>>3] & (0x80 >> (cols & 0x07))) != 0 ? 1 : 0;
+		target[cols].rgbReserved = (index < transparent_pixels) ? table[index] : 255;
+    }
+}
+
+static void DLL_CALLCONV
+MapTransparentTableToAlpha4(RGBQUAD *target, BYTE *source, BYTE *table, int transparent_pixels, int width_in_pixels) {
+    BOOL low_nibble = FALSE;
+    int x = 0;
+
+    for (int cols = 0 ; cols < width_in_pixels ; ++cols) {
+        int index;
+        if (low_nibble) {
+            index = LOWNIBBLE(source[x]);
+            x++;
+        } else {
+            index = HINIBBLE(source[x]) >> 4;
+        }
+        target[cols].rgbReserved = (index < transparent_pixels) ? table[index] : 255;
+        low_nibble = !low_nibble;
+    }
+}
+
+static void DLL_CALLCONV
+MapTransparentTableToAlpha8(RGBQUAD *target, BYTE *source, BYTE *table, int transparent_pixels, int width_in_pixels) {
+    for (int cols = 0; cols < width_in_pixels; cols++) {
+		target[cols].rgbReserved = (source[cols] < transparent_pixels) ? table[source[cols]] : 255;
+	}
+} 
+
+// ----------------------------------------------------------
+
+FIBITMAP * DLL_CALLCONV
+FreeImage_ConvertTo32Bits(FIBITMAP *dib) {
+	if(!dib) return NULL;
+
+	const int bpp = FreeImage_GetBPP(dib);
+	const FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(dib);
+	
+	if((image_type != FIT_BITMAP) && (image_type != FIT_RGB16) && (image_type != FIT_RGBA16)) {
+		return NULL;
+	}
+	
+	const int width = FreeImage_GetWidth(dib);
+	const int height = FreeImage_GetHeight(dib);
+
+	if(image_type == FIT_BITMAP) {
+
+		if(bpp == 32) {
+			return FreeImage_Clone(dib);
+		}
+
+		FIBITMAP *new_dib = FreeImage_Allocate(width, height, 32, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
+		if(new_dib == NULL) {
+			return NULL;
+		}
+
+		// copy metadata from src to dst
+		FreeImage_CloneMetadata(new_dib, dib);
+
+		switch(bpp) {
+			case 1:
+			{
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine1To32(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width, FreeImage_GetPalette(dib));
+					
+					if (FreeImage_IsTransparent(dib)) {
+						MapTransparentTableToAlpha1((RGBQUAD *)FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), FreeImage_GetTransparencyTable(dib), FreeImage_GetTransparencyCount(dib), width);
+					}
+				}
+
+				return new_dib;
+			}
+
+			case 4:
+			{
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine4To32(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width, FreeImage_GetPalette(dib));
+			
+					if (FreeImage_IsTransparent(dib)) {
+						MapTransparentTableToAlpha4((RGBQUAD *)FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), FreeImage_GetTransparencyTable(dib), FreeImage_GetTransparencyCount(dib), width);
+					}
+				}
+
+				return new_dib;
+			}
+				
+			case 8:
+			{
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine8To32(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width, FreeImage_GetPalette(dib));
+
+					if (FreeImage_IsTransparent(dib)) {
+						MapTransparentTableToAlpha8((RGBQUAD *)FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), FreeImage_GetTransparencyTable(dib), FreeImage_GetTransparencyCount(dib), width);
+					}
+				}
+
+				return new_dib;
+			}
+
+			case 16:
+			{
+				for (int rows = 0; rows < height; rows++) {
+					if ((FreeImage_GetRedMask(dib) == FI16_565_RED_MASK) && (FreeImage_GetGreenMask(dib) == FI16_565_GREEN_MASK) && (FreeImage_GetBlueMask(dib) == FI16_565_BLUE_MASK)) {
+						FreeImage_ConvertLine16To32_565(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);
+					} else {
+						// includes case where all the masks are 0
+						FreeImage_ConvertLine16To32_555(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);
+					}
+				}
+
+				return new_dib;
+			}
+
+			case 24:
+			{
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine24To32(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);
+				}
+
+				return new_dib;
+			}
+		}
+
+	} else if(image_type == FIT_RGB16) {
+		FIBITMAP *new_dib = FreeImage_Allocate(width, height, 32, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
+		if(new_dib == NULL) {
+			return NULL;
+		}
+
+		// copy metadata from src to dst
+		FreeImage_CloneMetadata(new_dib, dib);
+
+		const unsigned src_pitch = FreeImage_GetPitch(dib);
+		const unsigned dst_pitch = FreeImage_GetPitch(new_dib);
+		const BYTE *src_bits = FreeImage_GetBits(dib);
+		BYTE *dst_bits = FreeImage_GetBits(new_dib);
+		for (int rows = 0; rows < height; rows++) {
+			const FIRGB16 *src_pixel = (FIRGB16*)src_bits;
+			RGBQUAD *dst_pixel = (RGBQUAD*)dst_bits;
+			for(int cols = 0; cols < width; cols++) {
+				dst_pixel[cols].rgbRed		= (BYTE)(src_pixel[cols].red   >> 8);
+				dst_pixel[cols].rgbGreen	= (BYTE)(src_pixel[cols].green >> 8);
+				dst_pixel[cols].rgbBlue		= (BYTE)(src_pixel[cols].blue  >> 8);
+				dst_pixel[cols].rgbReserved = (BYTE)0xFF;
+			}
+			src_bits += src_pitch;
+			dst_bits += dst_pitch;
+		}
+
+		return new_dib;
+
+	} else if(image_type == FIT_RGBA16) {
+		FIBITMAP *new_dib = FreeImage_Allocate(width, height, 32, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
+		if(new_dib == NULL) {
+			return NULL;
+		}
+
+		// copy metadata from src to dst
+		FreeImage_CloneMetadata(new_dib, dib);
+
+		const unsigned src_pitch = FreeImage_GetPitch(dib);
+		const unsigned dst_pitch = FreeImage_GetPitch(new_dib);
+		const BYTE *src_bits = FreeImage_GetBits(dib);
+		BYTE *dst_bits = FreeImage_GetBits(new_dib);
+		for (int rows = 0; rows < height; rows++) {
+			const FIRGBA16 *src_pixel = (FIRGBA16*)src_bits;
+			RGBQUAD *dst_pixel = (RGBQUAD*)dst_bits;
+			for(int cols = 0; cols < width; cols++) {
+				dst_pixel[cols].rgbRed		= (BYTE)(src_pixel[cols].red   >> 8);
+				dst_pixel[cols].rgbGreen	= (BYTE)(src_pixel[cols].green >> 8);
+				dst_pixel[cols].rgbBlue		= (BYTE)(src_pixel[cols].blue  >> 8);
+				dst_pixel[cols].rgbReserved = (BYTE)(src_pixel[cols].alpha >> 8);
+			}
+			src_bits += src_pitch;
+			dst_bits += dst_pitch;
+		}		
+
+		return new_dib;
+	}
+	
+	return NULL;
+}
diff --git a/Source/FreeImage/Conversion4.cpp b/Source/FreeImage/Conversion4.cpp
new file mode 100644
index 0000000..46b194d
--- /dev/null
+++ b/Source/FreeImage/Conversion4.cpp
@@ -0,0 +1,246 @@
+// ==========================================================
+// Bitmap conversion routines
+//
+// Design and implementation by
+// - Riley McNiff (rmcniff@marexgroup.com)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#include "FreeImage.h"
+#include "Utilities.h"
+
+// ----------------------------------------------------------
+//  internal conversions X to 4 bits
+// ----------------------------------------------------------
+
+void DLL_CALLCONV
+FreeImage_ConvertLine1To4(BYTE *target, BYTE *source, int width_in_pixels) {
+	BOOL hinibble = TRUE;
+	for (int cols = 0; cols < width_in_pixels; cols++){
+		if (hinibble == TRUE){
+			target[cols >> 1] = ((source[cols >> 3] & (0x80 >> (cols & 0x07))) != 0 ? 15 : 0) << 4;
+		} 
+		else {
+			target[cols >> 1] |= ((source[cols >> 3] & (0x80 >> (cols & 0x07))) != 0 ? 15 : 0);
+		}
+
+		hinibble = !hinibble;
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine8To4(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette) {
+	BOOL hinibble = TRUE;
+	BYTE index;
+
+	for (int cols = 0; cols < width_in_pixels; cols++){
+		index = GREY(palette[source[cols]].rgbRed, palette[source[cols]].rgbGreen, palette[source[cols]].rgbBlue);
+		if (hinibble) {
+			target[cols >> 1] = (index & 0xF0);
+		} else {
+			target[cols >> 1] |= (index >> 4);
+		}
+
+		hinibble = !hinibble;
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine16To4_555(BYTE *target, BYTE *source, int width_in_pixels) {
+	WORD *bits = (WORD *)source;
+	BOOL hinibble = TRUE;
+
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		if (hinibble) {
+			target[cols >> 1] = GREY((((bits[cols] & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) * 0xFF) / 0x1F,
+								(((bits[cols] & FI16_555_GREEN_MASK) >> FI16_555_GREEN_SHIFT) * 0xFF) / 0x1F,
+								(((bits[cols] & FI16_555_BLUE_MASK) >> FI16_555_BLUE_SHIFT) * 0xFF) / 0x1F)
+								& 0xF0;
+		} else {
+			target[cols >> 1] |= GREY((((bits[cols] & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) * 0xFF) / 0x1F,
+								(((bits[cols] & FI16_555_GREEN_MASK) >> FI16_555_GREEN_SHIFT) * 0xFF) / 0x1F,
+								(((bits[cols] & FI16_555_BLUE_MASK) >> FI16_555_BLUE_SHIFT) * 0xFF) / 0x1F)
+								>> 4;
+		}
+		
+		hinibble = !hinibble;
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine16To4_565(BYTE *target, BYTE *source, int width_in_pixels) {
+	WORD *bits = (WORD *)source;
+	BOOL hinibble = TRUE;
+
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		if (hinibble) {
+			target[cols >> 1] = GREY((((bits[cols] & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) * 0xFF) / 0x1F,
+				        (((bits[cols] & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) * 0xFF) / 0x3F,
+						(((bits[cols] & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) * 0xFF) / 0x1F)
+						& 0xF0;
+		} else {
+			target[cols >> 1] |= GREY((((bits[cols] & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) * 0xFF) / 0x1F,
+				        (((bits[cols] & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) * 0xFF) / 0x3F,
+						(((bits[cols] & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) * 0xFF) / 0x1F)
+						>> 4;
+		}
+
+		hinibble = !hinibble;
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine24To4(BYTE *target, BYTE *source, int width_in_pixels) {
+	BOOL hinibble = TRUE;
+
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		if (hinibble) {
+			target[cols >> 1] = GREY(source[FI_RGBA_RED], source[FI_RGBA_GREEN], source[FI_RGBA_BLUE]) & 0xF0;
+		} else {
+			target[cols >> 1] |= GREY(source[FI_RGBA_RED], source[FI_RGBA_GREEN], source[FI_RGBA_BLUE]) >> 4;
+		}
+
+		source += 3;
+		hinibble = !hinibble;
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine32To4(BYTE *target, BYTE *source, int width_in_pixels) {
+	BOOL hinibble = TRUE;
+
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		if (hinibble) {
+			target[cols >> 1] = GREY(source[FI_RGBA_RED], source[FI_RGBA_GREEN], source[FI_RGBA_BLUE]) & 0xF0;
+		} else {
+			target[cols >> 1] |= GREY(source[FI_RGBA_RED], source[FI_RGBA_GREEN], source[FI_RGBA_BLUE]) >> 4;
+		}
+
+		source += 4;
+		hinibble = !hinibble;
+	}
+}
+
+// ----------------------------------------------------------
+//   smart convert X to 4 bits
+// ----------------------------------------------------------
+
+FIBITMAP * DLL_CALLCONV
+FreeImage_ConvertTo4Bits(FIBITMAP *dib) {
+	if(!dib) return NULL;
+
+	const int bpp = FreeImage_GetBPP(dib);
+
+	if(bpp != 4) {
+		const int width  = FreeImage_GetWidth(dib);
+		const int height = FreeImage_GetHeight(dib);
+		FIBITMAP *new_dib = FreeImage_Allocate(width, height, 4);
+
+		if(new_dib == NULL) {
+			return NULL;
+		}
+
+		// copy metadata from src to dst
+		FreeImage_CloneMetadata(new_dib, dib);
+
+		// Build a greyscale palette (*always* needed for image processing)
+
+		RGBQUAD *new_pal = FreeImage_GetPalette(new_dib);
+
+		for(int i = 0; i < 16; i++) {
+			new_pal[i].rgbRed	= (BYTE)((i << 4) + i);
+			new_pal[i].rgbGreen = (BYTE)((i << 4) + i);
+			new_pal[i].rgbBlue	= (BYTE)((i << 4) + i);
+		}
+
+		switch(bpp) {
+			case 1:
+			{
+				if(FreeImage_GetColorType(dib) == FIC_PALETTE) {
+
+					// Copy the palette
+
+					RGBQUAD *old_pal = FreeImage_GetPalette(dib);
+					memcpy(&new_pal[0], &old_pal[0], sizeof(RGBQUAD));
+					memcpy(&new_pal[15], &old_pal[1], sizeof(RGBQUAD));
+
+				}
+				else if(FreeImage_GetColorType(dib) == FIC_MINISWHITE) {
+					
+					// Reverse the grayscale palette
+
+					for(int i = 0; i < 16; i++) {
+						new_pal[i].rgbRed = new_pal[i].rgbGreen = new_pal[i].rgbBlue = (BYTE)(255 - ((i << 4) + i));
+					}
+				}
+
+				// Expand and copy the bitmap data
+
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine1To4(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);
+				}
+				return new_dib;
+			}
+
+			case 8 :
+			{
+				// Expand and copy the bitmap data
+
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine8To4(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width, FreeImage_GetPalette(dib));
+				}
+				return new_dib;
+			}
+
+			case 16 :
+			{
+				// Expand and copy the bitmap data
+
+				for (int rows = 0; rows < height; rows++) {
+					if ((FreeImage_GetRedMask(dib) == FI16_565_RED_MASK) && (FreeImage_GetGreenMask(dib) == FI16_565_GREEN_MASK) && (FreeImage_GetBlueMask(dib) == FI16_565_BLUE_MASK)) {
+						FreeImage_ConvertLine16To4_565(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);
+					} else {
+						FreeImage_ConvertLine16To4_555(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);
+					}
+				}
+				
+				return new_dib;
+			}
+
+			case 24 :
+			{
+				// Expand and copy the bitmap data
+
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine24To4(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);					
+				}
+				return new_dib;
+			}
+
+			case 32 :
+			{
+				// Expand and copy the bitmap data
+
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine32To4(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);
+				}
+				return new_dib;
+			}
+		}
+	}
+
+	return FreeImage_Clone(dib);
+}
diff --git a/Source/FreeImage/Conversion8.cpp b/Source/FreeImage/Conversion8.cpp
new file mode 100644
index 0000000..17d0e61
--- /dev/null
+++ b/Source/FreeImage/Conversion8.cpp
@@ -0,0 +1,327 @@
+// ==========================================================
+// Bitmap conversion routines
+//
+// Design and implementation by
+// - Floris van den Berg (flvdberg@wxs.nl)
+// - Hervé Drolon (drolon@infonie.fr)
+// - Jani Kajala (janik@remedy.fi)
+// - Karl-Heinz Bussian (khbussian@moss.de)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#include "FreeImage.h"
+#include "Utilities.h"
+
+// ----------------------------------------------------------
+//  internal conversions X to 8 bits
+// ----------------------------------------------------------
+
+void DLL_CALLCONV
+FreeImage_ConvertLine1To8(BYTE *target, BYTE *source, int width_in_pixels) {
+	for (int cols = 0; cols < width_in_pixels; cols++)
+		target[cols] = (source[cols >> 3] & (0x80 >> (cols & 0x07))) != 0 ? 255 : 0;	
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine4To8(BYTE *target, BYTE *source, int width_in_pixels) {
+	int count_new = 0;
+	int count_org = 0;
+	BOOL hinibble = TRUE;
+
+	while (count_new < width_in_pixels) {
+		if (hinibble) {
+			target[count_new] = (source[count_org] & 0xF0) >> 4;
+		} else {
+			target[count_new] = (source[count_org] & 0x0F);
+
+			count_org++;
+		}
+
+		hinibble = !hinibble;
+
+		count_new++;
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine16To8_555(BYTE *target, BYTE *source, int width_in_pixels) {
+	WORD *bits = (WORD *)source;
+
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		target[cols] = GREY((((bits[cols] & FI16_555_RED_MASK) >> FI16_555_RED_SHIFT) * 0xFF) / 0x1F,
+			                (((bits[cols] & FI16_555_GREEN_MASK) >> FI16_555_GREEN_SHIFT) * 0xFF) / 0x1F,
+							(((bits[cols] & FI16_555_BLUE_MASK) >> FI16_555_BLUE_SHIFT) * 0xFF) / 0x1F);
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine16To8_565(BYTE *target, BYTE *source, int width_in_pixels) {
+	WORD *bits = (WORD *)source;
+
+	for (int cols = 0; cols < width_in_pixels; cols++)
+		target[cols] = GREY((((bits[cols] & FI16_565_RED_MASK) >> FI16_565_RED_SHIFT) * 0xFF) / 0x1F,
+			        (((bits[cols] & FI16_565_GREEN_MASK) >> FI16_565_GREEN_SHIFT) * 0xFF) / 0x3F,
+					(((bits[cols] & FI16_565_BLUE_MASK) >> FI16_565_BLUE_SHIFT) * 0xFF) / 0x1F);	
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine24To8(BYTE *target, BYTE *source, int width_in_pixels) {
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		target[cols] = GREY(source[FI_RGBA_RED], source[FI_RGBA_GREEN], source[FI_RGBA_BLUE]);
+
+		source += 3;
+	}
+}
+
+void DLL_CALLCONV
+FreeImage_ConvertLine32To8(BYTE *target, BYTE *source, int width_in_pixels) {
+	for (int cols = 0; cols < width_in_pixels; cols++) {
+		target[cols] = GREY(source[FI_RGBA_RED], source[FI_RGBA_GREEN], source[FI_RGBA_BLUE]);
+
+		source += 4;
+	}
+}
+
+// ----------------------------------------------------------
+//   smart convert X to 8 bits
+// ----------------------------------------------------------
+
+FIBITMAP * DLL_CALLCONV
+FreeImage_ConvertTo8Bits(FIBITMAP *dib) {
+	if(!dib) return NULL;
+
+	const int bpp = FreeImage_GetBPP(dib);
+
+	const FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(dib);
+	if((image_type != FIT_BITMAP) && (image_type != FIT_UINT16)) {
+		return NULL;
+	}
+
+	if(bpp != 8) {
+		const int width  = FreeImage_GetWidth(dib);
+		const int height = FreeImage_GetHeight(dib);
+		FIBITMAP *new_dib = FreeImage_Allocate(width, height, 8);
+
+		if(new_dib == NULL) {
+			return NULL;
+		}
+
+		// copy metadata from src to dst
+		FreeImage_CloneMetadata(new_dib, dib);
+
+		// Build a greyscale palette (*always* needed for image processing)
+
+		RGBQUAD *new_pal = FreeImage_GetPalette(new_dib);
+
+		for(int i = 0; i < 256; i++) {
+			new_pal[i].rgbRed	= (BYTE)i;
+			new_pal[i].rgbGreen = (BYTE)i;
+			new_pal[i].rgbBlue	= (BYTE)i;
+		}
+
+		if(image_type == FIT_BITMAP) {
+
+			switch(bpp) {
+				case 1:
+				{
+					if(FreeImage_GetColorType(dib) == FIC_PALETTE) {
+
+						// Copy the palette
+
+						RGBQUAD *old_pal = FreeImage_GetPalette(dib);
+						memcpy(&new_pal[0], &old_pal[0], sizeof(RGBQUAD));
+						memcpy(&new_pal[255], &old_pal[1], sizeof(RGBQUAD));
+
+					}
+					else if(FreeImage_GetColorType(dib) == FIC_MINISWHITE) {
+						
+						// Reverse the grayscale palette
+
+						for(int i = 0; i < 256; i++) {
+							new_pal[i].rgbRed = new_pal[i].rgbGreen = new_pal[i].rgbBlue = (BYTE)(255 - i);
+						}
+					}
+
+
+					// Expand and copy the bitmap data
+
+					for (int rows = 0; rows < height; rows++) {
+						FreeImage_ConvertLine1To8(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);
+					}
+					return new_dib;
+				}
+
+				case 4 :
+				{
+					if(FreeImage_GetColorType(dib) == FIC_PALETTE) {
+
+						// Copy the palette
+
+						RGBQUAD *old_pal = FreeImage_GetPalette(dib);
+
+						for (int i = 0; i < 16; i++) {
+							new_pal[i].rgbRed	= old_pal[i].rgbRed;
+							new_pal[i].rgbGreen = old_pal[i].rgbGreen;
+							new_pal[i].rgbBlue	= old_pal[i].rgbBlue;
+						}
+					}
+
+					// Expand and copy the bitmap data
+
+					for (int rows = 0; rows < height; rows++) {
+						FreeImage_ConvertLine4To8(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);					
+					}
+					return new_dib;
+				}
+
+				case 16 :
+				{
+					// Expand and copy the bitmap data
+
+					for (int rows = 0; rows < height; rows++) {
+						if ((FreeImage_GetRedMask(dib) == FI16_565_RED_MASK) && (FreeImage_GetGreenMask(dib) == FI16_565_GREEN_MASK) && (FreeImage_GetBlueMask(dib) == FI16_565_BLUE_MASK)) {
+							FreeImage_ConvertLine16To8_565(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);
+						} else {
+							FreeImage_ConvertLine16To8_555(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);
+						}
+					}
+					
+					return new_dib;
+				}
+
+				case 24 :
+				{
+					// Expand and copy the bitmap data
+
+					for (int rows = 0; rows < height; rows++) {
+						FreeImage_ConvertLine24To8(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);					
+					}
+					return new_dib;
+				}
+
+				case 32 :
+				{
+					// Expand and copy the bitmap data
+
+					for (int rows = 0; rows < height; rows++) {
+						FreeImage_ConvertLine32To8(FreeImage_GetScanLine(new_dib, rows), FreeImage_GetScanLine(dib, rows), width);
+					}
+					return new_dib;
+				}
+			}
+
+		} else if(image_type == FIT_UINT16) {
+
+			const unsigned src_pitch = FreeImage_GetPitch(dib);
+			const unsigned dst_pitch = FreeImage_GetPitch(new_dib);
+			const BYTE *src_bits = FreeImage_GetBits(dib);
+			BYTE *dst_bits = FreeImage_GetBits(new_dib);
+			for (int rows = 0; rows < height; rows++) {
+				const WORD *src_pixel = (WORD*)src_bits;
+				BYTE *dst_pixel = (BYTE*)dst_bits;
+				for(int cols = 0; cols < width; cols++) {
+					dst_pixel[cols] = (BYTE)(src_pixel[cols] >> 8);
+				}
+				src_bits += src_pitch;
+				dst_bits += dst_pitch;
+			}
+
+			return new_dib;
+
+		} 
+
+	} // bpp != 8
+
+	return FreeImage_Clone(dib);
+}
+
+FIBITMAP * DLL_CALLCONV
+FreeImage_ConvertToGreyscale(FIBITMAP *dib) {
+	if(!dib) return NULL;
+
+	const FREE_IMAGE_COLOR_TYPE color_type = FreeImage_GetColorType(dib);
+	const int bpp = FreeImage_GetBPP(dib);
+
+	if((color_type == FIC_PALETTE) || (color_type == FIC_MINISWHITE)) {
+		const int width  = FreeImage_GetWidth(dib);
+		const int height = FreeImage_GetHeight(dib);
+		FIBITMAP *new_dib = FreeImage_Allocate(width, height, 8);
+
+		if(new_dib == NULL) {
+			return NULL;
+		}
+
+		// copy metadata from src to dst
+		FreeImage_CloneMetadata(new_dib, dib);
+
+		// Build a greyscale palette
+
+		RGBQUAD *new_pal = FreeImage_GetPalette(new_dib);
+
+		for(int i = 0; i < 256; i++) {
+			new_pal[i].rgbRed	= (BYTE)i;
+			new_pal[i].rgbGreen = (BYTE)i;
+			new_pal[i].rgbBlue	= (BYTE)i;
+		}
+
+		// allocate a 24-bit buffer
+
+		BYTE *buffer = (BYTE*)malloc( CalculatePitch(CalculateLine(width, 24)) );
+		if(NULL == buffer) {
+			FreeImage_Unload(new_dib);
+			return NULL;
+		}
+
+		// Convert the palette to 24-bit, then to 8-bit
+
+		switch(bpp) {
+			case 1:
+			{
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine1To24(buffer, FreeImage_GetScanLine(dib, rows), width, FreeImage_GetPalette(dib));
+					FreeImage_ConvertLine24To8(FreeImage_GetScanLine(new_dib, rows), buffer, width);
+				}
+			}
+			break;
+
+			case 4:
+			{
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine4To24(buffer, FreeImage_GetScanLine(dib, rows), width, FreeImage_GetPalette(dib));
+					FreeImage_ConvertLine24To8(FreeImage_GetScanLine(new_dib, rows), buffer, width);
+				}
+			}
+			break;
+
+			case 8:
+			{
+				for (int rows = 0; rows < height; rows++) {
+					FreeImage_ConvertLine8To24(buffer, FreeImage_GetScanLine(dib, rows), width, FreeImage_GetPalette(dib));
+					FreeImage_ConvertLine24To8(FreeImage_GetScanLine(new_dib, rows), buffer, width);
+				}
+			}
+			break;
+
+		}
+		free(buffer);
+
+		return new_dib;
+
+	} 
+	
+	// Convert the bitmap to 8-bit greyscale
+	return FreeImage_ConvertTo8Bits(dib);
+}
diff --git a/Source/FreeImage/ConversionRGBF.cpp b/Source/FreeImage/ConversionRGBF.cpp
new file mode 100644
index 0000000..eac73f0
--- /dev/null
+++ b/Source/FreeImage/ConversionRGBF.cpp
@@ -0,0 +1,179 @@
+// ==========================================================
+// Bitmap conversion routines
+//
+// Design and implementation by
+// - Hervé Drolon (drolon@infonie.fr)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#include "FreeImage.h"
+#include "Utilities.h"
+
+// ----------------------------------------------------------
+//   smart convert X to RGBF
+// ----------------------------------------------------------
+
+FIBITMAP * DLL_CALLCONV
+FreeImage_ConvertToRGBF(FIBITMAP *dib) {
+	FIBITMAP *src = NULL;
+	FIBITMAP *dst = NULL;
+
+	const FREE_IMAGE_TYPE src_type = FreeImage_GetImageType(dib);
+
+	// check for allowed conversions 
+	switch(src_type) {
+		case FIT_BITMAP:
+		{
+			// allow conversion from 24- and 32-bit
+			const FREE_IMAGE_COLOR_TYPE color_type = FreeImage_GetColorType(dib);
+			if((color_type != FIC_RGB) && (color_type != FIC_RGBALPHA)) {
+				src = FreeImage_ConvertTo24Bits(dib);
+				if(!src) return NULL;
+			} else {
+				src = dib;
+			}
+			break;
+		}
+		case FIT_RGB16:
+			// allow conversion from 48-bit
+			src = dib;
+			break;
+		case FIT_RGBAF:
+			// allow conversion from 128-bit
+			src = dib;
+			break;
+		case FIT_RGBF:
+			// RGBF type : clone the src
+			return FreeImage_Clone(dib);
+			break;
+		default:
+			return NULL;
+	}
+
+	// allocate dst image
+
+	const unsigned width = FreeImage_GetWidth(src);
+	const unsigned height = FreeImage_GetHeight(src);
+
+	dst = FreeImage_AllocateT(FIT_RGBF, width, height);
+	if(!dst) return NULL;
+
+	// copy metadata from src to dst
+	FreeImage_CloneMetadata(dst, src);
+
+	// convert from src type to RGBF
+
+	const unsigned src_pitch = FreeImage_GetPitch(src);
+	const unsigned dst_pitch = FreeImage_GetPitch(dst);
+
+	switch(src_type) {
+		case FIT_BITMAP:
+		{
+			// calculate the number of bytes per pixel (3 for 24-bit or 4 for 32-bit)
+			const unsigned bytespp = FreeImage_GetLine(src) / FreeImage_GetWidth(src);
+
+			const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src);
+			BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst);
+
+			for(unsigned y = 0; y < height; y++) {
+				const BYTE   *src_pixel = (BYTE*)src_bits;
+				FIRGBF *dst_pixel = (FIRGBF*)dst_bits;
+				for(unsigned x = 0; x < width; x++) {
+					// convert and scale to the range [0..1]
+					dst_pixel->red   = (float)(src_pixel[FI_RGBA_RED])   / 255;
+					dst_pixel->green = (float)(src_pixel[FI_RGBA_GREEN]) / 255;
+					dst_pixel->blue  = (float)(src_pixel[FI_RGBA_BLUE])  / 255;
+
+					src_pixel += bytespp;
+					dst_pixel ++;
+				}
+				src_bits += src_pitch;
+				dst_bits += dst_pitch;
+			}
+		}
+		break;
+
+		case FIT_RGB16:
+		{
+			const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src);
+			BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst);
+
+			for(unsigned y = 0; y < height; y++) {
+				const FIRGB16 *src_pixel = (FIRGB16*) src_bits;
+				FIRGBF  *dst_pixel = (FIRGBF*)  dst_bits;
+
+				for(unsigned x = 0; x < width; x++) {
+					// convert and scale to the range [0..1]
+					dst_pixel[x].red   = (float)(src_pixel[x].red)   / 65535;
+					dst_pixel[x].green = (float)(src_pixel[x].green) / 65535;
+					dst_pixel[x].blue  = (float)(src_pixel[x].blue)  / 65535;
+				}
+				src_bits += src_pitch;
+				dst_bits += dst_pitch;
+			}
+		}
+		break;
+
+		case FIT_RGBA16:
+		{
+			const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src);
+			BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst);
+
+			for(unsigned y = 0; y < height; y++) {
+				const FIRGBA16 *src_pixel = (FIRGBA16*) src_bits;
+				FIRGBF  *dst_pixel = (FIRGBF*)  dst_bits;
+
+				for(unsigned x = 0; x < width; x++) {
+					// convert and scale to the range [0..1]
+					dst_pixel[x].red   = (float)(src_pixel[x].red)   / 65535;
+					dst_pixel[x].green = (float)(src_pixel[x].green) / 65535;
+					dst_pixel[x].blue  = (float)(src_pixel[x].blue)  / 65535;
+				}
+				src_bits += src_pitch;
+				dst_bits += dst_pitch;
+			}
+		}
+		break;
+
+		case FIT_RGBAF:
+		{
+			const BYTE *src_bits = (BYTE*)FreeImage_GetBits(src);
+			BYTE *dst_bits = (BYTE*)FreeImage_GetBits(dst);
+
+			for(unsigned y = 0; y < height; y++) {
+				const FIRGBAF *src_pixel = (FIRGBAF*) src_bits;
+				FIRGBF  *dst_pixel = (FIRGBF*)  dst_bits;
+
+				for(unsigned x = 0; x < width; x++) {
+					// convert and skip alpha channel
+					dst_pixel[x].red   = src_pixel[x].red;
+					dst_pixel[x].green = src_pixel[x].green;
+					dst_pixel[x].blue  = src_pixel[x].blue;
+				}
+				src_bits += src_pitch;
+				dst_bits += dst_pitch;
+			}
+		}
+		break;
+	}
+
+	if(src != dib) {
+		FreeImage_Unload(src);
+	}
+
+	return dst;
+}
+
diff --git a/Source/FreeImage/ConversionType.cpp b/Source/FreeImage/ConversionType.cpp
new file mode 100644
index 0000000..1952333
--- /dev/null
+++ b/Source/FreeImage/ConversionType.cpp
@@ -0,0 +1,687 @@
+// ==========================================================
+// Bitmap conversion routines
+//
+// Design and implementation by
+// - Hervé Drolon (drolon@infonie.fr)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#include "FreeImage.h"
+#include "Utilities.h"
+
+// ----------------------------------------------------------
+
+/** Convert a greyscale image of type Tsrc to type Tdst.
+	Conversion is done using standard C language casting convention.
+*/
+template<class Tdst, class Tsrc>
+class CONVERT_TYPE
+{
+public:
+	FIBITMAP* convert(FIBITMAP *src, FREE_IMAGE_TYPE dst_type);
+};
+
+template<class Tdst, class Tsrc> FIBITMAP* 
+CONVERT_TYPE<Tdst, Tsrc>::convert(FIBITMAP *src, FREE_IMAGE_TYPE dst_type) {
+
+	FIBITMAP *dst = NULL;
+
+	unsigned width	= FreeImage_GetWidth(src);
+	unsigned height = FreeImage_GetHeight(src);
+	unsigned bpp	= FreeImage_GetBPP(src);
+
+	// allocate dst image
+
+	dst = FreeImage_AllocateT(dst_type, width, height, bpp, 
+			FreeImage_GetRedMask(src), FreeImage_GetGreenMask(src), FreeImage_GetBlueMask(src));
+	if(!dst) return NULL;
+
+	// convert from src_type to dst_type
+	
+	for(unsigned y = 0; y < height; y++) {
+		const Tsrc *src_bits = reinterpret_cast<Tsrc*>(FreeImage_GetScanLine(src, y));
+		Tdst *dst_bits = reinterpret_cast<Tdst*>(FreeImage_GetScanLine(dst, y));
+
+		for(unsigned x = 0; x < width; x++) {
+			*dst_bits++ = static_cast<Tdst>(*src_bits++);
+		}
+	}
+
+	return dst;
+}
+
+
+/** Convert a greyscale image of type Tsrc to a 8-bit grayscale dib.
+	Conversion is done using either a linear scaling from [min, max] to [0, 255]
+	or a rounding from src_pixel to (BYTE) MIN(255, MAX(0, q)) where int q = int(src_pixel + 0.5); 
+*/
+template<class Tsrc>
+class CONVERT_TO_BYTE
+{
+public:
+	FIBITMAP* convert(FIBITMAP *src, BOOL scale_linear);
+};
+
+template<class Tsrc> FIBITMAP* 
+CONVERT_TO_BYTE<Tsrc>::convert(FIBITMAP *src, BOOL scale_linear) {
+	FIBITMAP *dst = NULL;
+	unsigned x, y;
+
+	unsigned width	= FreeImage_GetWidth(src);
+	unsigned height = FreeImage_GetHeight(src);
+
+	// allocate a 8-bit dib
+
+	dst = FreeImage_AllocateT(FIT_BITMAP, width, height, 8, 0, 0, 0);
+	if(!dst) return NULL;
+
+	// build a greyscale palette
+	RGBQUAD *pal = FreeImage_GetPalette(dst);
+	for(int i = 0; i < 256; i++) {
+		pal[i].rgbRed = (BYTE)i;
+		pal[i].rgbGreen = (BYTE)i;
+		pal[i].rgbBlue = (BYTE)i;
+	}
+
+	// convert the src image to dst
+	// (FIBITMAP are stored upside down)
+	if(scale_linear) {
+		Tsrc max, min;
+		double scale;
+
+		// find the min and max value of the image
+		Tsrc l_min, l_max;
+		min = 255, max = 0;
+		for(y = 0; y < height; y++) {
+			Tsrc *bits = reinterpret_cast<Tsrc*>(FreeImage_GetScanLine(src, y));
+			MAXMIN(bits, width, l_max, l_min);
+			if(l_max > max) max = l_max;
+			if(l_min < min) min = l_min;
+		}
+		if(max == min) {
+			max = 255; min = 0;
+		}
+
+		// compute the scaling factor
+		scale = 255 / (double)(max - min);
+
+		// scale to 8-bit
+		for(y = 0; y < height; y++) {
+			Tsrc *src_bits = reinterpret_cast<Tsrc*>(FreeImage_GetScanLine(src, y));
+			BYTE *dst_bits = FreeImage_GetScanLine(dst, y);
+			for(x = 0; x < width; x++) {
+				dst_bits[x] = (BYTE)( scale * (src_bits[x] - min) + 0.5);
+			}
+		}
+	} else {
+		for(y = 0; y < height; y++) {
+			Tsrc *src_bits = reinterpret_cast<Tsrc*>(FreeImage_GetScanLine(src, y));
+			BYTE *dst_bits = FreeImage_GetScanLine(dst, y);
+			for(x = 0; x < width; x++) {
+				// rounding
+				int q = int(src_bits[x] + 0.5);
+				dst_bits[x] = (BYTE) MIN(255, MAX(0, q));
+			}
+		}
+	}
+
+	return dst;
+}
+
+/** Convert a greyscale image of type Tsrc to a FICOMPLEX dib.
+*/
+template<class Tsrc>
+class CONVERT_TO_COMPLEX
+{
+public:
+	FIBITMAP* convert(FIBITMAP *src);
+};
+
+template<class Tsrc> FIBITMAP* 
+CONVERT_TO_COMPLEX<Tsrc>::convert(FIBITMAP *src) {
+	FIBITMAP *dst = NULL;
+
+	unsigned width	= FreeImage_GetWidth(src);
+	unsigned height = FreeImage_GetHeight(src);
+
+	// allocate dst image
+
+	dst = FreeImage_AllocateT(FIT_COMPLEX, width, height);
+	if(!dst) return NULL;
+
+	// convert from src_type to FIT_COMPLEX
+	
+	for(unsigned y = 0; y < height; y++) {
+		const Tsrc *src_bits = reinterpret_cast<Tsrc*>(FreeImage_GetScanLine(src, y));
+		FICOMPLEX *dst_bits = (FICOMPLEX *)FreeImage_GetScanLine(dst, y);
+
+		for(unsigned x = 0; x < width; x++) {
+			dst_bits[x].r = (double)src_bits[x];
+			dst_bits[x].i = 0;
+		}
+	}
+
+	return dst;
+}
+
+// ----------------------------------------------------------
+
+// Convert from type BYTE to type X
+CONVERT_TYPE<unsigned short, BYTE>	convertByteToUShort;
+CONVERT_TYPE<short, BYTE>			convertByteToShort;
+CONVERT_TYPE<unsigned long, BYTE>	convertByteToULong;
+CONVERT_TYPE<long, BYTE>			convertByteToLong;
+CONVERT_TYPE<float, BYTE>			convertByteToFloat;
+CONVERT_TYPE<double, BYTE>			convertByteToDouble;
+
+// Convert from type X to type BYTE
+CONVERT_TO_BYTE<unsigned short>	convertUShortToByte;
+CONVERT_TO_BYTE<short>			convertShortToByte;
+CONVERT_TO_BYTE<unsigned long>	convertULongToByte;
+CONVERT_TO_BYTE<long>			convertLongToByte;
+CONVERT_TO_BYTE<float>			convertFloatToByte;
+CONVERT_TO_BYTE<double>			convertDoubleToByte;
+
+// Convert from type X to type float
+CONVERT_TYPE<float, unsigned short>	convertUShortToFloat;
+CONVERT_TYPE<float, short>			convertShortToFloat;
+CONVERT_TYPE<float, unsigned long>	convertULongToFloat;
+CONVERT_TYPE<float, long>			convertLongToFloat;
+
+// Convert from type X to type double
+CONVERT_TYPE<double, unsigned short>	convertUShortToDouble;
+CONVERT_TYPE<double, short>				convertShortToDouble;
+CONVERT_TYPE<double, unsigned long>		convertULongToDouble;
+CONVERT_TYPE<double, long>				convertLongToDouble;
+CONVERT_TYPE<double, float>				convertFloatToDouble;
+
+// Convert from type X to type FICOMPLEX
+CONVERT_TO_COMPLEX<BYTE>			convertByteToComplex;
+CONVERT_TO_COMPLEX<unsigned short>	convertUShortToComplex;
+CONVERT_TO_COMPLEX<short>			convertShortToComplex;
+CONVERT_TO_COMPLEX<unsigned long>	convertULongToComplex;
+CONVERT_TO_COMPLEX<long>			convertLongToComplex;
+CONVERT_TO_COMPLEX<float>			convertFloatToComplex;
+CONVERT_TO_COMPLEX<double>			convertDoubleToComplex;
+
+// ----------------------------------------------------------
+
+// ----------------------------------------------------------
+//   smart convert X to standard FIBITMAP
+// ----------------------------------------------------------
+
+/** Convert image of any type to a standard 8-bit greyscale image.
+For standard images, a clone of the input image is returned.
+When the scale_linear parameter is TRUE, conversion is done by scaling linearly 
+each pixel to an integer value between [0..255]. When it is FALSE, conversion is done 
+by rounding each float pixel to an integer between [0..255]. 
+For complex images, the magnitude is extracted as a double image, then converted according to the scale parameter. 
+@param image Image to convert
+@param scale_linear Linear scaling / rounding switch
+*/
+FIBITMAP* DLL_CALLCONV
+FreeImage_ConvertToStandardType(FIBITMAP *src, BOOL scale_linear) {
+	FIBITMAP *dst = NULL;
+
+	if(!src) return NULL;
+
+	// convert from src_type to FIT_BITMAP
+
+	const FREE_IMAGE_TYPE src_type = FreeImage_GetImageType(src);
+
+	switch(src_type) {
+		case FIT_BITMAP:	// standard image: 1-, 4-, 8-, 16-, 24-, 32-bit
+			dst = FreeImage_Clone(src);
+			break;
+		case FIT_UINT16:	// array of unsigned short: unsigned 16-bit
+			dst = convertUShortToByte.convert(src, scale_linear);
+			break;
+		case FIT_INT16:		// array of short: signed 16-bit
+			dst = convertShortToByte.convert(src, scale_linear);
+			break;
+		case FIT_UINT32:	// array of unsigned long: unsigned 32-bit
+			dst = convertULongToByte.convert(src, scale_linear);
+			break;
+		case FIT_INT32:		// array of long: signed 32-bit
+			dst = convertLongToByte.convert(src, scale_linear);
+			break;
+		case FIT_FLOAT:		// array of float: 32-bit
+			dst = convertFloatToByte.convert(src, scale_linear);
+			break;
+		case FIT_DOUBLE:	// array of double: 64-bit
+			dst = convertDoubleToByte.convert(src, scale_linear);
+			break;
+		case FIT_COMPLEX:	// array of FICOMPLEX: 2 x 64-bit
+			{
+				// Convert to type FIT_DOUBLE
+				FIBITMAP *dib_double = FreeImage_GetComplexChannel(src, FICC_MAG);
+				if(dib_double) {
+					// Convert to a standard bitmap (linear scaling)
+					dst = convertDoubleToByte.convert(dib_double, scale_linear);
+					// Free image of type FIT_DOUBLE
+					FreeImage_Unload(dib_double);
+				}
+			}
+			break;
+		case FIT_RGB16:		// 48-bit RGB image: 3 x 16-bit
+			break;
+		case FIT_RGBA16:	// 64-bit RGBA image: 4 x 16-bit
+			break;
+		case FIT_RGBF:		// 96-bit RGB float image: 3 x 32-bit IEEE floating point
+			break;
+		case FIT_RGBAF:		// 128-bit RGBA float image: 4 x 32-bit IEEE floating point
+			break;
+	}
+
+	if(NULL == dst) {
+		FreeImage_OutputMessageProc(FIF_UNKNOWN, "FREE_IMAGE_TYPE: Unable to convert from type %d to type %d.\n No such conversion exists.", src_type, FIT_BITMAP);
+	} else {
+		// copy metadata from src to dst
+		FreeImage_CloneMetadata(dst, src);
+	}
+	
+	return dst;
+}
+
+
+
+// ----------------------------------------------------------
+//   smart convert X to Y
+// ----------------------------------------------------------
+
+FIBITMAP* DLL_CALLCONV
+FreeImage_ConvertToType(FIBITMAP *src, FREE_IMAGE_TYPE dst_type, BOOL scale_linear) {
+	FIBITMAP *dst = NULL;
+
+	if(!src) return NULL;
+
+	// convert from src_type to dst_type
+
+	const FREE_IMAGE_TYPE src_type = FreeImage_GetImageType(src);
+
+	if(src_type == dst_type) {
+		return FreeImage_Clone(src);
+	}
+	if(src_type == FIT_BITMAP) {
+		const unsigned src_bpp = FreeImage_GetBPP(src);
+		if(((src_bpp == 24) || (src_bpp == 32)) && (dst_type != FIT_RGBF)) {
+			FreeImage_OutputMessageProc(FIF_UNKNOWN, "FREE_IMAGE_TYPE: Only 24-/32-bit dib can be converted to type %d.", dst_type);
+			return NULL;
+		}
+		else if(src_bpp != 8) {
+			FreeImage_OutputMessageProc(FIF_UNKNOWN, "FREE_IMAGE_TYPE: Only 8-bit dib can be converted to type %d.", dst_type);
+			return NULL;
+		}
+	}
+
+	switch(src_type) {
+		case FIT_BITMAP:
+			switch(dst_type) {
+				case FIT_UINT16:
+					dst = convertByteToUShort.convert(src, dst_type);
+					break;
+				case FIT_INT16:
+					dst = convertByteToShort.convert(src, dst_type);
+					break;
+				case FIT_UINT32:
+					dst = convertByteToULong.convert(src, dst_type);
+					break;
+				case FIT_INT32:
+					dst = convertByteToLong.convert(src, dst_type);
+					break;
+				case FIT_FLOAT:
+					dst = convertByteToFloat.convert(src, dst_type);
+					break;
+				case FIT_DOUBLE:
+					dst = convertByteToDouble.convert(src, dst_type);
+					break;
+				case FIT_COMPLEX:
+					dst = convertByteToComplex.convert(src);
+					break;
+				case FIT_RGB16:					
+					break;
+				case FIT_RGBA16:
+					break;
+				case FIT_RGBF:
+					dst = FreeImage_ConvertToRGBF(src);
+					break;
+				case FIT_RGBAF:
+					break;
+			}
+			break;
+		case FIT_UINT16:
+			switch(dst_type) {
+				case FIT_BITMAP:
+					dst = FreeImage_ConvertToStandardType(src, scale_linear);
+					break;
+				case FIT_INT16:
+					break;
+				case FIT_UINT32:
+					break;
+				case FIT_INT32:
+					break;
+				case FIT_FLOAT:
+					dst = convertUShortToFloat.convert(src, dst_type);
+					break;
+				case FIT_DOUBLE:
+					dst = convertUShortToDouble.convert(src, dst_type);
+					break;
+				case FIT_COMPLEX:
+					dst = convertUShortToComplex.convert(src);
+					break;
+				case FIT_RGB16:
+					break;
+				case FIT_RGBA16:
+					break;
+				case FIT_RGBF:
+					break;
+				case FIT_RGBAF:
+					break;
+			}
+			break;
+		case FIT_INT16:
+			switch(dst_type) {
+				case FIT_BITMAP:
+					dst = FreeImage_ConvertToStandardType(src, scale_linear);
+					break;
+				case FIT_UINT16:
+					break;
+				case FIT_UINT32:
+					break;
+				case FIT_INT32:
+					break;
+				case FIT_FLOAT:
+					dst = convertShortToFloat.convert(src, dst_type);
+					break;
+				case FIT_DOUBLE:
+					dst = convertShortToDouble.convert(src, dst_type);
+					break;
+				case FIT_COMPLEX:
+					dst = convertShortToComplex.convert(src);
+					break;
+				case FIT_RGB16:
+					break;
+				case FIT_RGBA16:
+					break;
+				case FIT_RGBF:
+					break;
+				case FIT_RGBAF:
+					break;
+			}
+			break;
+		case FIT_UINT32:
+			switch(dst_type) {
+				case FIT_BITMAP:
+					dst = FreeImage_ConvertToStandardType(src, scale_linear);
+					break;
+				case FIT_UINT16:
+					break;
+				case FIT_INT16:
+					break;
+				case FIT_INT32:
+					break;
+				case FIT_FLOAT:
+					dst = convertULongToFloat.convert(src, dst_type);
+					break;
+				case FIT_DOUBLE:
+					dst = convertULongToDouble.convert(src, dst_type);
+					break;
+				case FIT_COMPLEX:
+					dst = convertULongToComplex.convert(src);
+					break;
+				case FIT_RGB16:
+					break;
+				case FIT_RGBA16:
+					break;
+				case FIT_RGBF:
+					break;
+				case FIT_RGBAF:
+					break;
+			}
+			break;
+		case FIT_INT32:
+			switch(dst_type) {
+				case FIT_BITMAP:
+					dst = FreeImage_ConvertToStandardType(src, scale_linear);
+					break;
+				case FIT_UINT16:
+					break;
+				case FIT_INT16:
+					break;
+				case FIT_UINT32:
+					break;
+				case FIT_FLOAT:
+					dst = convertLongToFloat.convert(src, dst_type);
+					break;
+				case FIT_DOUBLE:
+					dst = convertLongToDouble.convert(src, dst_type);
+					break;
+				case FIT_COMPLEX:
+					dst = convertLongToComplex.convert(src);
+					break;
+				case FIT_RGB16:
+					break;
+				case FIT_RGBA16:
+					break;
+				case FIT_RGBF:
+					break;
+				case FIT_RGBAF:
+					break;
+			}
+			break;
+		case FIT_FLOAT:
+			switch(dst_type) {
+				case FIT_BITMAP:
+					dst = FreeImage_ConvertToStandardType(src, scale_linear);
+					break;
+				case FIT_UINT16:
+					break;
+				case FIT_INT16:
+					break;
+				case FIT_UINT32:
+					break;
+				case FIT_INT32:
+					break;
+				case FIT_DOUBLE:
+					dst = convertFloatToDouble.convert(src, dst_type);
+					break;
+				case FIT_COMPLEX:
+					dst = convertFloatToComplex.convert(src);
+					break;
+				case FIT_RGB16:
+					break;
+				case FIT_RGBA16:
+					break;
+				case FIT_RGBF:
+					break;
+				case FIT_RGBAF:
+					break;
+			}
+			break;
+		case FIT_DOUBLE:
+			switch(dst_type) {
+				case FIT_BITMAP:
+					dst = FreeImage_ConvertToStandardType(src, scale_linear);
+					break;
+				case FIT_UINT16:
+					break;
+				case FIT_INT16:
+					break;
+				case FIT_UINT32:
+					break;
+				case FIT_INT32:
+					break;
+				case FIT_FLOAT:
+					break;
+				case FIT_COMPLEX:
+					dst = convertDoubleToComplex.convert(src);
+					break;
+				case FIT_RGB16:
+					break;
+				case FIT_RGBA16:
+					break;
+				case FIT_RGBF:
+					break;
+				case FIT_RGBAF:
+					break;
+			}
+			break;
+		case FIT_COMPLEX:
+			switch(dst_type) {
+				case FIT_BITMAP:
+					break;
+				case FIT_UINT16:
+					break;
+				case FIT_INT16:
+					break;
+				case FIT_UINT32:
+					break;
+				case FIT_INT32:
+					break;
+				case FIT_FLOAT:
+					break;
+				case FIT_DOUBLE:
+					break;
+				case FIT_RGB16:
+					break;
+				case FIT_RGBA16:
+					break;
+				case FIT_RGBF:
+					break;
+				case FIT_RGBAF:
+					break;
+			}
+			break;
+		case FIT_RGB16:
+			switch(dst_type) {
+				case FIT_BITMAP:
+					dst = FreeImage_ConvertTo24Bits(src);
+					break;
+				case FIT_UINT16:
+					break;
+				case FIT_INT16:
+					break;
+				case FIT_UINT32:
+					break;
+				case FIT_INT32:
+					break;
+				case FIT_FLOAT:
+					break;
+				case FIT_DOUBLE:
+					break;
+				case FIT_COMPLEX:
+					break;
+				case FIT_RGBA16:
+					break;
+				case FIT_RGBF:
+					dst = FreeImage_ConvertToRGBF(src);
+					break;
+				case FIT_RGBAF:
+					break;
+			}
+			break;
+		case FIT_RGBA16:
+			switch(dst_type) {
+				case FIT_BITMAP:
+					dst = FreeImage_ConvertTo32Bits(src);
+					break;
+				case FIT_UINT16:
+					break;
+				case FIT_INT16:
+					break;
+				case FIT_UINT32:
+					break;
+				case FIT_INT32:
+					break;
+				case FIT_FLOAT:
+					break;
+				case FIT_DOUBLE:
+					break;
+				case FIT_COMPLEX:
+					break;
+				case FIT_RGB16:
+					break;
+				case FIT_RGBF:
+					dst = FreeImage_ConvertToRGBF(src);
+					break;
+				case FIT_RGBAF:
+					break;
+			}
+			break;
+		case FIT_RGBF:
+			switch(dst_type) {
+				case FIT_BITMAP:
+					break;
+				case FIT_UINT16:
+					break;
+				case FIT_INT16:
+					break;
+				case FIT_UINT32:
+					break;
+				case FIT_INT32:
+					break;
+				case FIT_FLOAT:
+					break;
+				case FIT_DOUBLE:
+					break;
+				case FIT_COMPLEX:
+					break;
+				case FIT_RGB16:
+					break;
+				case FIT_RGBA16:
+					break;
+				case FIT_RGBAF:
+					break;
+			}
+			break;
+		case FIT_RGBAF:
+			switch(dst_type) {
+				case FIT_BITMAP:
+					break;
+				case FIT_UINT16:
+					break;
+				case FIT_INT16:
+					break;
+				case FIT_UINT32:
+					break;
+				case FIT_INT32:
+					break;
+				case FIT_FLOAT:
+					break;
+				case FIT_DOUBLE:
+					break;
+				case FIT_COMPLEX:
+					break;
+				case FIT_RGB16:
+					break;
+				case FIT_RGBA16:
+					break;
+				case FIT_RGBF:
+					dst = FreeImage_ConvertToRGBF(src);
+					break;
+			}
+			break;
+	}
+
+	if(NULL == dst) {
+		FreeImage_OutputMessageProc(FIF_UNKNOWN, "FREE_IMAGE_TYPE: Unable to convert from type %d to type %d.\n No such conversion exists.", src_type, dst_type);
+	} else {
+		// copy metadata from src to dst
+		FreeImage_CloneMetadata(dst, src);
+	}
+
+	return dst;
+}
diff --git a/Source/FreeImage/FreeImage.cpp b/Source/FreeImage/FreeImage.cpp
new file mode 100644
index 0000000..f30a54b
--- /dev/null
+++ b/Source/FreeImage/FreeImage.cpp
@@ -0,0 +1,226 @@
+// ==========================================================
+// FreeImage implementation
+//
+// Design and implementation by
+// - Floris van den Berg (flvdberg@wxs.nl)
+// - Hervé Drolon (drolon@infonie.fr)
+// - Karl-Heinz Bussian (khbussian@moss.de)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+
+#ifdef _WIN32
+#include <windows.h>
+#endif
+
+#include "FreeImage.h"
+#include "Utilities.h"
+
+//----------------------------------------------------------------------
+
+static const char *s_copyright = "This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details";
+
+//----------------------------------------------------------------------
+
+#if defined(_WIN32) && !defined(__MINGW32__)
+#ifndef FREEIMAGE_LIB
+
+BOOL APIENTRY
+DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
+	switch (ul_reason_for_call) {
+		case DLL_PROCESS_ATTACH :
+			FreeImage_Initialise(FALSE);
+			break;
+
+		case DLL_PROCESS_DETACH :
+			FreeImage_DeInitialise();
+			break;
+
+		case DLL_THREAD_ATTACH :
+		case DLL_THREAD_DETACH :
+			break;
+    }
+
+    return TRUE;
+}
+
+#endif // FREEIMAGE_LIB
+
+#else // !_WIN32 
+#ifndef FREEIMAGE_LIB
+
+void FreeImage_SO_Initialise() __attribute__((constructor));
+void FreeImage_SO_DeInitialise() __attribute__((destructor));
+
+void FreeImage_SO_Initialise() {
+  FreeImage_Initialise(FALSE);
+}
+
+void FreeImage_SO_DeInitialise() {
+  FreeImage_DeInitialise();
+}
+#endif // FREEIMAGE_LIB
+
+#endif // _WIN32
+
+//----------------------------------------------------------------------
+
+const char * DLL_CALLCONV
+FreeImage_GetVersion() {
+	static char s_version[16];
+	sprintf(s_version, "%d.%d.%d", FREEIMAGE_MAJOR_VERSION, FREEIMAGE_MINOR_VERSION, FREEIMAGE_RELEASE_SERIAL);
+	return s_version;
+}
+
+const char * DLL_CALLCONV
+FreeImage_GetCopyrightMessage() {
+	return s_copyright;
+}
+
+//----------------------------------------------------------------------
+
+BOOL DLL_CALLCONV
+FreeImage_IsLittleEndian() {
+	union {
+		long i;
+		char c[4];
+	} u;
+	u.i = 1;
+	return (u.c[0] != 0);
+}
+
+//----------------------------------------------------------------------
+
+static FreeImage_OutputMessageFunction freeimage_outputmessage_proc = NULL;
+static FreeImage_OutputMessageFunctionStdCall freeimage_outputmessagestdcall_proc = NULL; 
+
+void DLL_CALLCONV
+FreeImage_SetOutputMessage(FreeImage_OutputMessageFunction omf) {
+	freeimage_outputmessage_proc = omf;
+}
+
+void DLL_CALLCONV
+FreeImage_SetOutputMessageStdCall(FreeImage_OutputMessageFunctionStdCall omf) {
+	freeimage_outputmessagestdcall_proc = omf;
+}
+
+void DLL_CALLCONV
+FreeImage_OutputMessageProc(int fif, const char *fmt, ...) {
+	const int MSG_SIZE = 512; // 512 bytes should be more than enough for a short message
+
+	if ((fmt != NULL) && ((freeimage_outputmessage_proc != NULL) || (freeimage_outputmessagestdcall_proc != NULL))) {
+		char message[MSG_SIZE];
+		memset(message, 0, MSG_SIZE);
+
+		// initialize the optional parameter list
+
+		va_list arg;
+		va_start(arg, fmt);
+
+		// check the length of the format string
+
+		int str_length = (int)( (strlen(fmt) > MSG_SIZE) ? MSG_SIZE : strlen(fmt) );
+
+		// parse the format string and put the result in 'message'
+
+		for (int i = 0, j = 0; i < str_length; ++i) {
+			if (fmt[i] == '%') {
+				if (i + 1 < str_length) {
+					switch(tolower(fmt[i + 1])) {
+						case '%' :
+							message[j++] = '%';
+							break;
+
+						case 'o' : // octal numbers
+						{
+							char tmp[16];
+
+							_itoa(va_arg(arg, int), tmp, 8);
+
+							strcat(message, tmp);
+
+							j += (int)strlen(tmp);
+
+							++i;
+
+							break;
+						}
+
+						case 'i' : // decimal numbers
+						case 'd' :
+						{
+							char tmp[16];
+
+							_itoa(va_arg(arg, int), tmp, 10);
+
+							strcat(message, tmp);
+
+							j += (int)strlen(tmp);
+
+							++i;
+
+							break;
+						}
+
+						case 'x' : // hexadecimal numbers
+						{
+							char tmp[16];
+
+							_itoa(va_arg(arg, int), tmp, 16);
+
+							strcat(message, tmp);
+
+							j += (int)strlen(tmp);
+
+							++i;
+
+							break;
+						}
+
+						case 's' : // strings
+						{
+							char *tmp = va_arg(arg, char*);
+
+							strcat(message, tmp);
+
+							j += (int)strlen(tmp);
+
+							++i;
+
+							break;
+						}
+					};
+				} else {
+					message[j++] = fmt[i];
+				}
+			} else {
+				message[j++] = fmt[i];
+			};
+		}
+
+		// deinitialize the optional parameter list
+
+		va_end(arg);
+
+		// output the message to the user program
+
+		if (freeimage_outputmessage_proc != NULL)
+			freeimage_outputmessage_proc((FREE_IMAGE_FORMAT)fif, message);
+
+		if (freeimage_outputmessagestdcall_proc != NULL)
+			freeimage_outputmessagestdcall_proc((FREE_IMAGE_FORMAT)fif, message); 
+	}
+}
diff --git a/Source/FreeImage/FreeImageC.c b/Source/FreeImage/FreeImageC.c
new file mode 100644
index 0000000..9e81259
--- /dev/null
+++ b/Source/FreeImage/FreeImageC.c
@@ -0,0 +1,22 @@
+// ==========================================================
+// Use from c compiler test file
+//
+// Design and implementation by
+// - Floris van den Berg (flvdberg@wxs.nl)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#include "FreeImage.h"
diff --git a/Source/FreeImage/FreeImageIO.cpp b/Source/FreeImage/FreeImageIO.cpp
new file mode 100644
index 0000000..90f32d9
--- /dev/null
+++ b/Source/FreeImage/FreeImageIO.cpp
@@ -0,0 +1,166 @@
+// ==========================================================
+// Input/Output functions
+//
+// Design and implementation by
+// - Floris van den Berg (flvdberg@wxs.nl)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#include "FreeImage.h"
+#include "Utilities.h"
+#include "FreeImageIO.h"
+
+// ----------------------------------------------------------
+
+unsigned DLL_CALLCONV 
+_ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle) {
+	return (unsigned)fread(buffer, size, count, (FILE *)handle);
+}
+
+unsigned DLL_CALLCONV 
+_WriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle) {
+	return (unsigned)fwrite(buffer, size, count, (FILE *)handle);
+}
+
+int DLL_CALLCONV
+_SeekProc(fi_handle handle, long offset, int origin) {
+	return fseek((FILE *)handle, offset, origin);
+}
+
+long DLL_CALLCONV
+_TellProc(fi_handle handle) {
+	return ftell((FILE *)handle);
+}
+
+// ----------------------------------------------------------
+
+void
+SetDefaultIO(FreeImageIO *io) {
+	io->read_proc  = _ReadProc;
+	io->seek_proc  = _SeekProc;
+	io->tell_proc  = _TellProc;
+	io->write_proc = _WriteProc;
+}
+
+// =====================================================================
+// Memory IO functions
+// =====================================================================
+
+unsigned DLL_CALLCONV 
+_MemoryReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle) {
+	unsigned x;
+
+	FIMEMORYHEADER *mem_header = (FIMEMORYHEADER*)(((FIMEMORY*)handle)->data);
+
+	for(x = 0; x < count; x++) {
+		//if there isnt size bytes left to read, set pos to eof and return a short count
+		if( (mem_header->filelen - mem_header->curpos) < (long)size ) {
+			mem_header->curpos = mem_header->filelen;
+			break;
+		}
+		//copy size bytes count times
+		memcpy( buffer, (char *)mem_header->data + mem_header->curpos, size );
+		mem_header->curpos += size;
+		buffer = (char *)buffer + size;
+	}
+	return x;
+}
+
+unsigned DLL_CALLCONV 
+_MemoryWriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle) {
+	void *newdata;
+	long newdatalen;
+
+	FIMEMORYHEADER *mem_header = (FIMEMORYHEADER*)(((FIMEMORY*)handle)->data);
+
+	//double the data block size if we need to
+	while( (mem_header->curpos + (long)(size*count)) >= mem_header->datalen ) {
+		//if we are at or above 1G, we cant double without going negative
+		if( mem_header->datalen & 0x40000000 ) {
+			//max 2G
+			if( mem_header->datalen == 0x7FFFFFFF ) {
+				return 0;
+			}
+			newdatalen = 0x7FFFFFFF;
+		} else if( mem_header->datalen == 0 ) {
+			//default to 4K if nothing yet
+			newdatalen = 4096;
+		} else {
+			//double size
+			newdatalen = mem_header->datalen << 1;
+		}
+		newdata = realloc( mem_header->data, newdatalen );
+		if( !newdata ) {
+			return 0;
+		}
+		mem_header->data = newdata;
+		mem_header->datalen = newdatalen;
+	}
+	memcpy( (char *)mem_header->data + mem_header->curpos, buffer, size*count );
+	mem_header->curpos += size*count;
+	if( mem_header->curpos > mem_header->filelen ) {
+		mem_header->filelen = mem_header->curpos;
+	}
+	return count;
+}
+
+int DLL_CALLCONV 
+_MemorySeekProc(fi_handle handle, long offset, int origin) {
+	FIMEMORYHEADER *mem_header = (FIMEMORYHEADER*)(((FIMEMORY*)handle)->data);
+
+	switch(origin) { //0 to filelen-1 are 'inside' the file
+		default:
+		case SEEK_SET: //can fseek() to 0-7FFFFFFF always
+			if( offset >= 0 ) {
+				mem_header->curpos = offset;
+				return 0;
+			}
+			break;
+
+		case SEEK_CUR:
+			if( mem_header->curpos + offset >= 0 ) {
+				mem_header->curpos += offset;
+				return 0;
+			}
+			break;
+
+		case SEEK_END:
+			if( mem_header->filelen + offset >= 0 ) {
+				mem_header->curpos = mem_header->filelen + offset;
+				return 0;
+			}
+			break;
+	}
+
+	return -1;
+}
+
+long DLL_CALLCONV 
+_MemoryTellProc(fi_handle handle) {
+	FIMEMORYHEADER *mem_header = (FIMEMORYHEADER*)(((FIMEMORY*)handle)->data);
+
+	return mem_header->curpos;
+}
+
+// ----------------------------------------------------------
+
+void
+SetMemoryIO(FreeImageIO *io) {
+	io->read_proc  = _MemoryReadProc;
+	io->seek_proc  = _MemorySeekProc;
+	io->tell_proc  = _MemoryTellProc;
+	io->write_proc = _MemoryWriteProc;
+}
diff --git a/Source/FreeImage/GetType.cpp b/Source/FreeImage/GetType.cpp
new file mode 100644
index 0000000..76edc7f
--- /dev/null
+++ b/Source/FreeImage/GetType.cpp
@@ -0,0 +1,92 @@
+// ==========================================================
+// GetType
+//
+// Design and implementation by
+// - Floris van den Berg (flvdberg@wxs.nl)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#ifdef _MSC_VER 
+#pragma warning (disable : 4786) // identifier was truncated to 'number' characters
+#endif 
+
+#include "FreeImage.h"
+#include "Utilities.h"
+#include "FreeImageIO.h"
+#include "Plugin.h"
+#include "../DeprecationManager/DeprecationMgr.h"
+
+// ----------------------------------------------------------
+
+FREE_IMAGE_FORMAT DLL_CALLCONV
+FreeImage_GetFileTypeFromHandle(FreeImageIO *io, fi_handle handle, int size) {
+	if (handle != NULL) {
+		int fif_count = FreeImage_GetFIFCount();
+
+		for (int i = 0; i < fif_count; ++i) {
+			FREE_IMAGE_FORMAT fif = (FREE_IMAGE_FORMAT)i;
+			if (FreeImage_Validate(fif, io, handle)) {
+				if(fif == FIF_TIFF) {
+					// many camera raw files use a TIFF signature ...
+					// ... try to revalidate against FIF_RAW (even if it breaks the code genericity)
+					if (FreeImage_Validate(FIF_RAW, io, handle)) {
+						return FIF_RAW;
+					}
+				}
+				return fif;
+			}
+		}
+	}
+
+	return FIF_UNKNOWN;
+}
+
+FREE_IMAGE_FORMAT DLL_CALLCONV
+FreeImage_GetFileType(const char *filename, int size) {
+	FreeImageIO io;
+	SetDefaultIO(&io);
+	
+	FILE *handle = fopen(filename, "rb");
+
+	if (handle != NULL) {
+		FREE_IMAGE_FORMAT format = FreeImage_GetFileTypeFromHandle(&io, (fi_handle)handle, size);
+
+		fclose(handle);
+
+		return format;
+	}
+
+	return FIF_UNKNOWN;
+}
+
+FREE_IMAGE_FORMAT DLL_CALLCONV 
+FreeImage_GetFileTypeU(const wchar_t *filename, int size) {
+#ifdef _WIN32	
+	FreeImageIO io;
+	SetDefaultIO(&io);
+	FILE *handle = _wfopen(filename, L"rb");
+
+	if (handle != NULL) {
+		FREE_IMAGE_FORMAT format = FreeImage_GetFileTypeFromHandle(&io, (fi_handle)handle, size);
+
+		fclose(handle);
+
+		return format;
+	}
+#endif
+	return FIF_UNKNOWN;
+}
+
diff --git a/Source/FreeImage/Halftoning.cpp b/Source/FreeImage/Halftoning.cpp
new file mode 100644
index 0000000..11de6fa
--- /dev/null
+++ b/Source/FreeImage/Halftoning.cpp
@@ -0,0 +1,474 @@
+// ==========================================================
+// Bitmap conversion routines
+// Thresholding and halftoning functions
+// Design and implementation by
+// - Hervé Drolon (drolon@infonie.fr)
+// - Dennis Lim (dlkj@users.sourceforge.net)
+// - Thomas Chmielewski (Chmielewski.Thomas@oce.de)
+//
+// Main reference : Ulichney, R., Digital Halftoning, The MIT Press, Cambridge, MA, 1987
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#include "FreeImage.h"
+#include "Utilities.h"
+
+static const int WHITE = 255;
+static const int BLACK = 0;
+
+// Floyd & Steinberg error diffusion dithering
+// This algorithm use the following filter
+//          *   7
+//      3   5   1     (1/16)
+static FIBITMAP* FloydSteinberg(FIBITMAP *dib) {
+
+#define RAND(RN) (((seed = 1103515245 * seed + 12345) >> 12) % (RN))
+#define INITERR(X, Y) (((int) X) - (((int) Y) ? WHITE : BLACK) + ((WHITE/2)-((int)X)) / 2)
+
+	int seed = 0;
+	int x, y, p, pixel, threshold, error;
+	int width, height, pitch;
+	BYTE *bits, *new_bits;
+	FIBITMAP *new_dib = NULL;
+
+	// allocate a 8-bit DIB
+	width = FreeImage_GetWidth(dib);
+	height = FreeImage_GetHeight(dib);
+	pitch = FreeImage_GetPitch(dib);
+	new_dib = FreeImage_Allocate(width, height, 8);
+	if(NULL == new_dib) return NULL;
+
+	// allocate space for error arrays
+	int *lerr = (int*)malloc (width * sizeof(int));
+	int *cerr = (int*)malloc (width * sizeof(int));
+	memset(lerr, 0, width * sizeof(int));
+	memset(cerr, 0, width * sizeof(int));
+
+	// left border
+	error = 0;
+	for(y = 0; y < height; y++) {
+		bits = FreeImage_GetScanLine(dib, y);
+		new_bits = FreeImage_GetScanLine(new_dib, y);
+
+		threshold = (WHITE / 2 + RAND(129) - 64);
+		pixel = bits[0] + error;
+		p = (pixel > threshold) ? WHITE : BLACK;
+		error = pixel - p;
+		new_bits[0] = (BYTE)p;
+	}
+	// right border
+	error = 0;
+	for(y = 0; y < height; y++) {
+		bits = FreeImage_GetScanLine(dib, y);
+		new_bits = FreeImage_GetScanLine(new_dib, y);
+
+		threshold = (WHITE / 2 + RAND(129) - 64);
+		pixel = bits[width-1] + error;
+		p = (pixel > threshold) ? WHITE : BLACK;
+		error = pixel - p;
+		new_bits[width-1] = (BYTE)p;
+	}
+	// top border
+	bits = FreeImage_GetBits(dib);
+	new_bits = FreeImage_GetBits(new_dib);
+	error = 0;
+	for(x = 0; x < width; x++) {
+		threshold = (WHITE / 2 + RAND(129) - 64);
+		pixel = bits[x] + error;
+		p = (pixel > threshold) ? WHITE : BLACK;
+		error = pixel - p;
+		new_bits[x] = (BYTE)p;
+		lerr[x] = INITERR(bits[x], p);
+	}
+
+	// interior bits
+	for(y = 1; y < height; y++) {
+		// scan left to right
+		bits = FreeImage_GetScanLine(dib, y);
+		new_bits = FreeImage_GetScanLine(new_dib, y);
+
+	    cerr[0] = INITERR(bits[0], new_bits[0]);
+		for(x = 1; x < width - 1; x++) {
+			error = (lerr[x-1] + 5 * lerr[x] + 3 * lerr[x+1] + 7 * cerr[x-1]) / 16;
+			pixel = bits[x] + error;
+			if(pixel > (WHITE / 2)) {		
+				new_bits[x] = WHITE;
+				cerr[x] = pixel - WHITE; 
+			} else {
+				new_bits[x] = BLACK;
+				cerr[x] = pixel - BLACK; 
+			}
+		}
+		// set errors for ends of the row
+		cerr[0] = INITERR (bits[0], new_bits[0]);
+		cerr[width - 1] = INITERR (bits[width - 1], new_bits[width - 1]);
+
+		// swap error buffers
+		int *terr = lerr; lerr = cerr; cerr = terr;
+	}
+
+	free(lerr);
+	free(cerr);
+
+	return new_dib;
+}
+
+// ==========================================================
+// Bayer ordered dispersed dot dithering
+//
+
+// Function taken from "Ordered Dithering, Stephen Hawley, Graphics Gems, Academic Press, 1990"
+// This function is used to generate a Bayer dithering matrice whose dimension are 2^size by 2^size
+//
+static int dithervalue(int x, int y, int size) {
+	int d = 0;
+	/*
+	 * calculate the dither value at a particular
+	 * (x, y) over the size of the matrix.
+	 */
+	while (size-->0)	{
+		/* Think of d as the density. At every iteration,
+		 * d is shifted left one and a new bit is put in the
+		 * low bit based on x and y. If x is odd and y is even,
+		 * or x is even and y is odd, a bit is put in. This
+		 * generates the checkerboard seen in dithering.
+		 * This quantity is shifted left again and the low bit of
+		 * y is added in.
+		 * This whole thing interleaves a checkerboard bit pattern
+		 * and y's bits, which is the value you want.
+		 */
+		d = (d <<1 | (x&1 ^ y&1))<<1 | y&1;
+		x >>= 1;
+		y >>= 1;
+	}
+	return d;
+}
+
+// Ordered dithering with a Bayer matrix of size 2^order by 2^order
+//
+static FIBITMAP* OrderedDispersedDot(FIBITMAP *dib, int order) {
+	int x, y;
+	int width, height;
+	BYTE *bits, *new_bits;
+	FIBITMAP *new_dib = NULL;
+
+	// allocate a 8-bit DIB
+	width = FreeImage_GetWidth(dib);
+	height = FreeImage_GetHeight(dib);
+	new_dib = FreeImage_Allocate(width, height, 8);
+	if(NULL == new_dib) return NULL;
+
+	// build the dithering matrix
+	int l = (1 << order);	// square of dither matrix order; the dimensions of the matrix
+	BYTE *matrix = (BYTE*)malloc(l*l * sizeof(BYTE));
+	for(int i = 0; i < l*l; i++) {
+		// according to "Purdue University: Digital Image Processing Laboratory: Image Halftoning, April 30th, 2006
+		matrix[i] = (BYTE)( 255 * (((double)dithervalue(i / l, i % l, order) + 0.5) / (l*l)) );
+	}
+
+	// perform the dithering
+	for(y = 0; y < height; y++) {
+		// scan left to right
+		bits = FreeImage_GetScanLine(dib, y);
+		new_bits = FreeImage_GetScanLine(new_dib, y);
+		for(x = 0; x < width; x++) {
+			if(bits[x] > matrix[(x % l) + l * (y % l)]) {
+				new_bits[x] = WHITE;
+			} else {
+				new_bits[x] = BLACK;
+			}
+		}
+	}
+
+	free(matrix);
+
+	return new_dib;
+}
+
+// ==========================================================
+// Ordered clustered dot dithering
+//
+
+// NB : The predefined dither matrices are the same as matrices used in 
+// the Netpbm package (http://netpbm.sourceforge.net) and are defined in Ulichney's book.
+// See also : The newsprint web site at http://www.cl.cam.ac.uk/~and1000/newsprint/
+// for more technical info on this dithering technique
+//
+static FIBITMAP* OrderedClusteredDot(FIBITMAP *dib, int order) {
+	// Order-3 clustered dithering matrix.
+	int cluster3[] = {
+	  9,11,10, 8, 6, 7,
+	  12,17,16, 5, 0, 1,
+	  13,14,15, 4, 3, 2,
+	  8, 6, 7, 9,11,10,
+	  5, 0, 1,12,17,16,
+	  4, 3, 2,13,14,15
+	};
+
+	// Order-4 clustered dithering matrix. 
+	int cluster4[] = {
+	  18,20,19,16,13,11,12,15,
+	  27,28,29,22, 4, 3, 2, 9,
+	  26,31,30,21, 5, 0, 1,10,
+	  23,25,24,17, 8, 6, 7,14,
+	  13,11,12,15,18,20,19,16,
+	  4, 3, 2, 9,27,28,29,22,
+	  5, 0, 1,10,26,31,30,21,
+	  8, 6, 7,14,23,25,24,17
+	};
+
+	// Order-8 clustered dithering matrix. 
+	int cluster8[] = {
+	   64, 69, 77, 87, 86, 76, 68, 67, 63, 58, 50, 40, 41, 51, 59, 60,
+	   70, 94,100,109,108, 99, 93, 75, 57, 33, 27, 18, 19, 28, 34, 52,
+	   78,101,114,116,115,112, 98, 83, 49, 26, 13, 11, 12, 15, 29, 44,
+	   88,110,123,124,125,118,107, 85, 39, 17,  4,  3,  2,  9, 20, 42,
+	   89,111,122,127,126,117,106, 84, 38, 16,  5,  0,  1, 10, 21, 43,
+	   79,102,119,121,120,113, 97, 82, 48, 25,  8,  6,  7, 14, 30, 45,
+	   71, 95,103,104,105, 96, 92, 74, 56, 32, 24, 23, 22, 31, 35, 53,
+	   65, 72, 80, 90, 91, 81, 73, 66, 62, 55, 47, 37, 36, 46, 54, 61,
+	   63, 58, 50, 40, 41, 51, 59, 60, 64, 69, 77, 87, 86, 76, 68, 67,
+	   57, 33, 27, 18, 19, 28, 34, 52, 70, 94,100,109,108, 99, 93, 75,
+	   49, 26, 13, 11, 12, 15, 29, 44, 78,101,114,116,115,112, 98, 83,
+	   39, 17,  4,  3,  2,  9, 20, 42, 88,110,123,124,125,118,107, 85,
+	   38, 16,  5,  0,  1, 10, 21, 43, 89,111,122,127,126,117,106, 84,
+	   48, 25,  8,  6,  7, 14, 30, 45, 79,102,119,121,120,113, 97, 82,
+	   56, 32, 24, 23, 22, 31, 35, 53, 71, 95,103,104,105, 96, 92, 74,
+	   62, 55, 47, 37, 36, 46, 54, 61, 65, 72, 80, 90, 91, 81, 73, 66
+	};
+
+	int x, y, pixel;
+	int width, height;
+	BYTE *bits, *new_bits;
+	FIBITMAP *new_dib = NULL;
+
+	// allocate a 8-bit DIB
+	width = FreeImage_GetWidth(dib);
+	height = FreeImage_GetHeight(dib);
+	new_dib = FreeImage_Allocate(width, height, 8);
+	if(NULL == new_dib) return NULL;
+
+	// select the dithering matrix
+	int *matrix = NULL;
+	switch(order) {
+		case 3:
+			matrix = &cluster3[0];
+			break;
+		case 4:
+			matrix = &cluster4[0];
+			break;
+		case 8:
+			matrix = &cluster8[0];
+			break;
+		default:
+			return NULL;
+	}
+
+	// scale the dithering matrix
+	int l = 2 * order;
+	int scale = 256 / (l * order);
+	for(y = 0; y < l; y++) {
+		for(x = 0; x < l; x++) {
+			matrix[y*l + x] *= scale;
+		}
+	}
+
+	// perform the dithering
+	for(y = 0; y < height; y++) {
+		// scan left to right
+		bits = FreeImage_GetScanLine(dib, y);
+		new_bits = FreeImage_GetScanLine(new_dib, y);
+		for(x = 0; x < width; x++) {
+			pixel = bits[x];
+			if(pixel >= matrix[(y % l) + l * (x % l)]) {
+				new_bits[x] = WHITE;
+			} else {
+				new_bits[x] = BLACK;
+			}
+		}
+	}
+
+	return new_dib;
+}
+
+
+// ==========================================================
+// Halftoning function
+//
+FIBITMAP * DLL_CALLCONV
+FreeImage_Dither(FIBITMAP *dib, FREE_IMAGE_DITHER algorithm) {
+	FIBITMAP *input = NULL, *dib8 = NULL;
+
+	if(NULL == dib) return NULL;
+
+	const unsigned bpp = FreeImage_GetBPP(dib);
+
+	if(bpp == 1) {
+		// Just clone the dib and adjust the palette if needed
+		FIBITMAP *new_dib = FreeImage_Clone(dib);
+		if(NULL == new_dib) return NULL;
+		if(FreeImage_GetColorType(new_dib) == FIC_PALETTE) {
+			// Build a monochrome palette
+			RGBQUAD *pal = FreeImage_GetPalette(new_dib);
+			pal[0].rgbRed = pal[0].rgbGreen = pal[0].rgbBlue = 0;
+			pal[1].rgbRed = pal[1].rgbGreen = pal[1].rgbBlue = 255;
+		}
+		return new_dib;
+	}
+
+	// Convert the input dib to a 8-bit greyscale dib
+	//
+	switch(bpp) {
+		case 8:
+			if(FreeImage_GetColorType(dib) == FIC_MINISBLACK) {
+				input = dib;
+			} else {
+				input = FreeImage_ConvertToGreyscale(dib);
+			} 
+			break;
+		case 4:
+		case 16:
+		case 24:
+		case 32:
+			input = FreeImage_ConvertToGreyscale(dib);
+			break;			
+	}
+	if(NULL == input) return NULL;
+
+	// Apply the dithering algorithm
+	switch(algorithm) {
+		case FID_FS:
+			dib8 = FloydSteinberg(input);
+			break;
+		case FID_BAYER4x4:
+			dib8 = OrderedDispersedDot(input, 2);
+			break;
+		case FID_BAYER8x8:
+			dib8 = OrderedDispersedDot(input, 3);
+			break;
+		case FID_BAYER16x16:
+			dib8 = OrderedDispersedDot(input, 4);
+			break;
+		case FID_CLUSTER6x6:
+			dib8 = OrderedClusteredDot(input, 3);
+			break;
+		case FID_CLUSTER8x8:
+			dib8 = OrderedClusteredDot(input, 4);
+			break;
+		case FID_CLUSTER16x16:
+			dib8 = OrderedClusteredDot(input, 8);
+			break;
+	}
+	if(input != dib) {
+		FreeImage_Unload(input);
+	}
+
+	// Build a greyscale palette (needed by threshold)
+	RGBQUAD *grey_pal = FreeImage_GetPalette(dib8);
+	for(int i = 0; i < 256; i++) {
+		grey_pal[i].rgbRed	= (BYTE)i;
+		grey_pal[i].rgbGreen = (BYTE)i;
+		grey_pal[i].rgbBlue	= (BYTE)i;
+	}
+
+	// Convert to 1-bit
+	FIBITMAP *new_dib = FreeImage_Threshold(dib8, 128);
+	FreeImage_Unload(dib8);
+
+	// copy metadata from src to dst
+	FreeImage_CloneMetadata(new_dib, dib);
+
+	return new_dib;
+}
+
+// ==========================================================
+// Thresholding function
+//
+FIBITMAP * DLL_CALLCONV
+FreeImage_Threshold(FIBITMAP *dib, BYTE T) {
+	FIBITMAP *dib8 = NULL;
+
+	if(NULL == dib) return NULL;
+
+	const unsigned bpp = FreeImage_GetBPP(dib);
+
+	if(bpp == 1) {
+		// Just clone the dib and adjust the palette if needed
+		FIBITMAP *new_dib = FreeImage_Clone(dib);
+		if(NULL == new_dib) return NULL;
+		if(FreeImage_GetColorType(new_dib) == FIC_PALETTE) {
+			// Build a monochrome palette
+			RGBQUAD *pal = FreeImage_GetPalette(new_dib);
+			pal[0].rgbRed = pal[0].rgbGreen = pal[0].rgbBlue = 0;
+			pal[1].rgbRed = pal[1].rgbGreen = pal[1].rgbBlue = 255;
+		}
+		return new_dib;
+	}
+
+	// Convert the input dib to a 8-bit greyscale dib
+	//
+	switch(bpp) {
+		case 8:
+			if(FreeImage_GetColorType(dib) == FIC_MINISBLACK) {
+				dib8 = dib;
+			} else {
+				dib8 = FreeImage_ConvertToGreyscale(dib);
+			} 
+			break;
+		case 4:
+		case 16:
+		case 24:
+		case 32:
+			dib8 = FreeImage_ConvertToGreyscale(dib);
+			break;			
+	}
+	if(NULL == dib8) return NULL;
+
+	// Allocate a new 1-bit DIB
+	int width = FreeImage_GetWidth(dib);
+	int height = FreeImage_GetHeight(dib);
+	FIBITMAP *new_dib = FreeImage_Allocate(width, height, 1);
+	if(NULL == new_dib) return NULL;
+	// Build a monochrome palette
+	RGBQUAD *pal = FreeImage_GetPalette(new_dib);
+	pal[0].rgbRed = pal[0].rgbGreen = pal[0].rgbBlue = 0;
+	pal[1].rgbRed = pal[1].rgbGreen = pal[1].rgbBlue = 255;
+
+	// Perform the thresholding
+	//
+	for(int y = 0; y < height; y++) {
+		BYTE *bits8 = FreeImage_GetScanLine(dib8, y);
+		BYTE *bits1 = FreeImage_GetScanLine(new_dib, y);
+		for(int x = 0; x < width; x++) {
+			if(bits8[x] < T) {
+				// Set bit(x, y) to 0
+				bits1[x >> 3] &= (0xFF7F >> (x & 0x7));
+			} else {
+				// Set bit(x, y) to 1
+				bits1[x >> 3] |= (0x80 >> (x & 0x7));
+			}
+		}
+	}
+	if(dib8 != dib) {
+		FreeImage_Unload(dib8);
+	}
+
+	// copy metadata from src to dst
+	FreeImage_CloneMetadata(new_dib, dib);
+
+	return new_dib;
+}
+
diff --git a/Source/FreeImage/J2KHelper.cpp b/Source/FreeImage/J2KHelper.cpp
new file mode 100644
index 0000000..786eccb
--- /dev/null
+++ b/Source/FreeImage/J2KHelper.cpp
@@ -0,0 +1,493 @@
+// ==========================================================
+// JPEG2000 helpers
+//
+// Design and implementation by
+// - Hervé Drolon (drolon@infonie.fr)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#include "FreeImage.h"
+#include "Utilities.h"
+#include "../LibOpenJPEG/openjpeg.h"
+
+/**
+Divide an integer by a power of 2 and round upwards
+@return Returns a divided by 2^b
+*/
+static int int_ceildivpow2(int a, int b) {
+	return (a + (1 << b) - 1) >> b;
+}
+
+/**
+Convert a OpenJPEG image to a FIBITMAP
+@param format_id Plugin ID
+@param image OpenJPEG image
+@return Returns the converted image if successful, returns NULL otherwise
+*/
+FIBITMAP* J2KImageToFIBITMAP(int format_id, const opj_image_t *image) {
+	FIBITMAP *dib = NULL;
+
+	try {
+		// compute image width and height
+
+		//int w = int_ceildiv(image->x1 - image->x0, image->comps[0].dx);
+		int wr = image->comps[0].w;
+		int wrr = int_ceildivpow2(image->comps[0].w, image->comps[0].factor);
+		
+		//int h = int_ceildiv(image->y1 - image->y0, image->comps[0].dy);
+		//int hr = image->comps[0].h;
+		int hrr = int_ceildivpow2(image->comps[0].h, image->comps[0].factor);
+
+		// check the number of components
+
+		int numcomps = image->numcomps;
+
+		BOOL bIsValid = TRUE;
+		for(int c = 0; c < numcomps - 1; c++) {
+			if(	(image->comps[c].dx == image->comps[c+1].dx) && 
+				(image->comps[c].dy == image->comps[c+1].dy) &&
+				(image->comps[c].prec == image->comps[c+1].prec) ) {
+				continue;
+			} else {
+				bIsValid = FALSE;
+				break;
+			}
+		}
+		bIsValid &= ((numcomps == 1) || (numcomps == 3) || (numcomps == 4));
+		if(!bIsValid) {
+			if(numcomps) {
+				FreeImage_OutputMessageProc(format_id, "Warning: image contains %d greyscale components. Only the first will be loaded.\n", numcomps);
+				numcomps = 1;
+			} else {
+				// unknown type
+				throw FI_MSG_ERROR_UNSUPPORTED_FORMAT;
+			}
+		}
+
+		// create a new DIB
+
+		if(image->comps[0].prec <= 8) {
+			switch(numcomps) {
+				case 1:
+					dib = FreeImage_Allocate(wrr, hrr, 8);
+					break;
+				case 3:
+					dib = FreeImage_Allocate(wrr, hrr, 24, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
+					break;
+				case 4:
+					dib = FreeImage_Allocate(wrr, hrr, 32, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
+					break;
+			}
+		} else if(image->comps[0].prec <= 16) {
+			switch(numcomps) {
+				case 1:
+					dib = FreeImage_AllocateT(FIT_UINT16, wrr, hrr);
+					break;
+				case 3:
+					dib = FreeImage_AllocateT(FIT_RGB16, wrr, hrr);
+					break;
+				case 4:
+					dib = FreeImage_AllocateT(FIT_RGBA16, wrr, hrr);
+					break;
+			}
+		} else {
+			throw FI_MSG_ERROR_UNSUPPORTED_FORMAT;
+		}
+		if(!dib) {
+			throw FI_MSG_ERROR_DIB_MEMORY;
+		}
+		
+		if(image->comps[0].prec <= 8) {
+			if(numcomps == 1) {
+				// 8-bit greyscale
+				// ----------------------------------------------------------
+
+				// build a greyscale palette
+				
+				RGBQUAD *pal = FreeImage_GetPalette(dib);
+				for (int i = 0; i < 256; i++) {
+					pal[i].rgbRed	= (BYTE)i;
+					pal[i].rgbGreen = (BYTE)i;
+					pal[i].rgbBlue	= (BYTE)i;
+				}
+
+				// load pixel data
+
+				unsigned pixel_count = 0;
+
+				for(int y = 0; y < hrr; y++) {		
+					BYTE *bits = FreeImage_GetScanLine(dib, hrr - 1 - y);
+
+					for(int x = 0; x < wrr; x++) {
+						const unsigned pixel_pos = pixel_count / wrr * wr + pixel_count % wrr;
+
+						int index = image->comps[0].data[pixel_pos];
+						index += (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
+
+						bits[x] = (BYTE)index;
+
+						pixel_count++;
+					}
+				}
+			}
+			else if(numcomps == 3) {
+
+				// 24-bit RGB
+				// ----------------------------------------------------------	
+				
+				// load pixel data
+
+				unsigned pixel_count = 0;
+
+				for(int y = 0; y < hrr; y++) {		
+					BYTE *bits = FreeImage_GetScanLine(dib, hrr - 1 - y);
+
+					for(int x = 0; x < wrr; x++) {
+						const unsigned pixel_pos = pixel_count / wrr * wr + pixel_count % wrr;
+
+						int r = image->comps[0].data[pixel_pos];
+						r += (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
+						
+						int g = image->comps[1].data[pixel_pos];
+						g += (image->comps[1].sgnd ? 1 << (image->comps[1].prec - 1) : 0);
+						
+						int b = image->comps[2].data[pixel_pos];
+						b += (image->comps[2].sgnd ? 1 << (image->comps[2].prec - 1) : 0);
+
+						bits[FI_RGBA_RED]   = (BYTE)r;
+						bits[FI_RGBA_GREEN] = (BYTE)g;
+						bits[FI_RGBA_BLUE]  = (BYTE)b;
+						bits += 3;
+
+						pixel_count++;
+					}
+				}
+			}
+			else if(numcomps == 4) {
+
+				// 32-bit RGBA
+				// ----------------------------------------------------------	
+				
+				// load pixel data
+
+				unsigned pixel_count = 0;
+
+				for(int y = 0; y < hrr; y++) {		
+					BYTE *bits = FreeImage_GetScanLine(dib, hrr - 1 - y);
+
+					for(int x = 0; x < wrr; x++) {
+						const unsigned pixel_pos = pixel_count / wrr * wr + pixel_count % wrr;
+
+						int r = image->comps[0].data[pixel_pos];
+						r += (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
+						
+						int g = image->comps[1].data[pixel_pos];
+						g += (image->comps[1].sgnd ? 1 << (image->comps[1].prec - 1) : 0);
+						
+						int b = image->comps[2].data[pixel_pos];
+						b += (image->comps[2].sgnd ? 1 << (image->comps[2].prec - 1) : 0);
+
+						int a = image->comps[3].data[pixel_pos];
+						a += (image->comps[3].sgnd ? 1 << (image->comps[3].prec - 1) : 0);
+
+						bits[FI_RGBA_RED]   = (BYTE)r;
+						bits[FI_RGBA_GREEN] = (BYTE)g;
+						bits[FI_RGBA_BLUE]  = (BYTE)b;
+						bits[FI_RGBA_ALPHA] = (BYTE)a;
+						bits += 4;
+
+						pixel_count++;
+					}
+				}
+			}
+		}
+		else if(image->comps[0].prec <= 16) {
+			if(numcomps == 1) {
+				// 16-bit greyscale
+				// ----------------------------------------------------------
+
+				// load pixel data
+
+				unsigned pixel_count = 0;
+
+				for(int y = 0; y < hrr; y++) {		
+					unsigned short *bits = (unsigned short*)FreeImage_GetScanLine(dib, hrr - 1 - y);
+
+					for(int x = 0; x < wrr; x++) {
+						const unsigned pixel_pos = pixel_count / wrr * wr + pixel_count % wrr;
+
+						int index = image->comps[0].data[pixel_pos];
+						index += (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
+
+						bits[x] = (unsigned short)index;
+
+						pixel_count++;
+					}
+				}
+			}
+			else if(numcomps == 3) {
+
+				// 48-bit RGB
+				// ----------------------------------------------------------	
+				
+				// load pixel data
+
+				unsigned pixel_count = 0;
+
+				for(int y = 0; y < hrr; y++) {		
+					FIRGB16 *bits = (FIRGB16*)FreeImage_GetScanLine(dib, hrr - 1 - y);
+
+					for(int x = 0; x < wrr; x++) {
+						const unsigned pixel_pos = pixel_count / wrr * wr + pixel_count % wrr;
+
+						int r = image->comps[0].data[pixel_pos];
+						r += (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
+						
+						int g = image->comps[1].data[pixel_pos];
+						g += (image->comps[1].sgnd ? 1 << (image->comps[1].prec - 1) : 0);
+						
+						int b = image->comps[2].data[pixel_pos];
+						b += (image->comps[2].sgnd ? 1 << (image->comps[2].prec - 1) : 0);
+
+						bits[x].red   = (WORD)r;
+						bits[x].green = (WORD)g;
+						bits[x].blue  = (WORD)b;
+
+						pixel_count++;
+					}
+				}
+			}
+			else if(numcomps == 4) {
+
+				// 64-bit RGBA
+				// ----------------------------------------------------------	
+				
+				// load pixel data
+
+				unsigned pixel_count = 0;
+
+				for(int y = 0; y < hrr; y++) {		
+					FIRGBA16 *bits = (FIRGBA16*)FreeImage_GetScanLine(dib, hrr - 1 - y);
+
+					for(int x = 0; x < wrr; x++) {
+						const unsigned pixel_pos = pixel_count / wrr * wr + pixel_count % wrr;
+
+						int r = image->comps[0].data[pixel_pos];
+						r += (image->comps[0].sgnd ? 1 << (image->comps[0].prec - 1) : 0);
+						
+						int g = image->comps[1].data[pixel_pos];
+						g += (image->comps[1].sgnd ? 1 << (image->comps[1].prec - 1) : 0);
+						
+						int b = image->comps[2].data[pixel_pos];
+						b += (image->comps[2].sgnd ? 1 << (image->comps[2].prec - 1) : 0);
+
+						int a = image->comps[3].data[pixel_pos];
+						a += (image->comps[3].sgnd ? 1 << (image->comps[3].prec - 1) : 0);
+
+						bits[x].red   = (WORD)r;
+						bits[x].green = (WORD)g;
+						bits[x].blue  = (WORD)b;
+						bits[x].alpha = (WORD)a;
+
+						pixel_count++;
+					}
+				}
+			}
+		}
+
+		return dib;
+
+	} catch(const char *text) {
+		if(dib) FreeImage_Unload(dib);
+		FreeImage_OutputMessageProc(format_id, text);
+		return NULL;
+	}
+
+}
+
+/**
+Convert a FIBITMAP to a OpenJPEG image
+@param format_id Plugin ID
+@param dib FreeImage image
+@param parameters Compression parameters
+@return Returns the converted image if successful, returns NULL otherwise
+*/
+opj_image_t* FIBITMAPToJ2KImage(int format_id, FIBITMAP *dib, const opj_cparameters_t *parameters) {
+	int prec, numcomps, x, y, index;
+	OPJ_COLOR_SPACE color_space;
+	opj_image_cmptparm_t cmptparm[4];	// maximum of 4 components 
+	opj_image_t *image = NULL;			// image to encode
+
+	try {
+		int w = FreeImage_GetWidth(dib);
+		int h = FreeImage_GetHeight(dib);
+
+		// get image characteristics
+		FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(dib);
+
+		if(image_type == FIT_BITMAP) {
+			// standard image ...
+			prec = 8;
+			switch(FreeImage_GetColorType(dib)) {
+				case FIC_MINISBLACK:
+					numcomps = 1;
+					color_space = CLRSPC_GRAY;
+					break;
+				case FIC_RGB:
+					numcomps = 3;
+					color_space = CLRSPC_SRGB;
+					break;
+				case FIC_RGBALPHA:
+					numcomps = 4;
+					color_space = CLRSPC_SRGB;
+					break;
+				default:
+					return NULL;
+			}
+		} else {
+			// HDR image ...
+			prec = 16;
+			switch(image_type) {
+				case FIT_UINT16:
+					numcomps = 1;
+					color_space = CLRSPC_GRAY;
+					break;
+				case FIT_RGB16:
+					numcomps = 3;
+					color_space = CLRSPC_SRGB;
+					break;
+				case FIT_RGBA16:
+					numcomps = 4;
+					color_space = CLRSPC_SRGB;
+					break;
+				default:
+					return NULL;
+			}
+		}
+
+		// initialize image components 
+		memset(&cmptparm[0], 0, 4 * sizeof(opj_image_cmptparm_t));
+		for(int i = 0; i < numcomps; i++) {
+			cmptparm[i].dx = parameters->subsampling_dx;
+			cmptparm[i].dy = parameters->subsampling_dy;
+			cmptparm[i].w = w;
+			cmptparm[i].h = h;
+			cmptparm[i].prec = prec;
+			cmptparm[i].bpp = prec;
+			cmptparm[i].sgnd = 0;
+		}
+		// create the image 
+		image = opj_image_create(numcomps, &cmptparm[0], color_space);
+		if(!image) {
+			throw FI_MSG_ERROR_DIB_MEMORY;
+		}
+
+		// set image offset and reference grid 
+		image->x0 = parameters->image_offset_x0;
+		image->y0 = parameters->image_offset_y0;
+		image->x1 = parameters->image_offset_x0 + (w - 1) *	parameters->subsampling_dx + 1;
+		image->y1 = parameters->image_offset_y0 + (h - 1) *	parameters->subsampling_dy + 1;
+
+		// set image data 
+		if(prec == 8) {
+			switch(numcomps) {
+				case 1:
+					index = 0;
+					for(y = 0; y < h; y++) {
+						BYTE *bits = FreeImage_GetScanLine(dib, h - 1 - y);
+						for(x = 0; x < w; x++) {
+							image->comps[0].data[index] = bits[x];
+							index++;
+						}
+					}
+					break;
+				case 3:
+					index = 0;
+					for(y = 0; y < h; y++) {
+						BYTE *bits = FreeImage_GetScanLine(dib, h - 1 - y);
+						for(x = 0; x < w; x++) {
+							image->comps[0].data[index] = bits[FI_RGBA_RED];
+							image->comps[1].data[index] = bits[FI_RGBA_GREEN];
+							image->comps[2].data[index] = bits[FI_RGBA_BLUE];
+							bits += 3;
+							index++;
+						}
+					}
+					break;
+				case 4:
+					index = 0;
+					for(y = 0; y < h; y++) {
+						BYTE *bits = FreeImage_GetScanLine(dib, h - 1 - y);
+						for(x = 0; x < w; x++) {
+							image->comps[0].data[index] = bits[FI_RGBA_RED];
+							image->comps[1].data[index] = bits[FI_RGBA_GREEN];
+							image->comps[2].data[index] = bits[FI_RGBA_BLUE];
+							image->comps[3].data[index] = bits[FI_RGBA_ALPHA];
+							bits += 4;
+							index++;
+						}
+					}
+					break;
+			}
+		}
+		else if(prec == 16) {
+			switch(numcomps) {
+				case 1:
+					index = 0;
+					for(y = 0; y < h; y++) {
+						WORD *bits = (WORD*)FreeImage_GetScanLine(dib, h - 1 - y);
+						for(x = 0; x < w; x++) {
+							image->comps[0].data[index] = bits[x];
+							index++;
+						}
+					}
+					break;
+				case 3:
+					index = 0;
+					for(y = 0; y < h; y++) {
+						FIRGB16 *bits = (FIRGB16*)FreeImage_GetScanLine(dib, h - 1 - y);
+						for(x = 0; x < w; x++) {
+							image->comps[0].data[index] = bits[x].red;
+							image->comps[1].data[index] = bits[x].green;
+							image->comps[2].data[index] = bits[x].blue;
+							index++;
+						}
+					}
+					break;
+				case 4:
+					index = 0;
+					for(y = 0; y < h; y++) {
+						FIRGBA16 *bits = (FIRGBA16*)FreeImage_GetScanLine(dib, h - 1 - y);
+						for(x = 0; x < w; x++) {
+							image->comps[0].data[index] = bits[x].red;
+							image->comps[1].data[index] = bits[x].green;
+							image->comps[2].data[index] = bits[x].blue;
+							image->comps[3].data[index] = bits[x].alpha;
+							index++;
+						}
+					}
+					break;
+			}
+		}
+
+		return image;
+
+	} catch (const char *text) {
+		if(image) opj_image_destroy(image);
+		FreeImage_OutputMessageProc(format_id, text);
+		return NULL;
+	}
+}
diff --git a/Source/FreeImage/MemoryIO.cpp b/Source/FreeImage/MemoryIO.cpp
new file mode 100644
index 0000000..1d6a002
--- /dev/null
+++ b/Source/FreeImage/MemoryIO.cpp
@@ -0,0 +1,234 @@
+// ==========================================================
+// Memory Input/Output functions
+//
+// Design and implementation by
+// - Ryan Rubley <ryan@lostreality.org> 
+// - Hervé Drolon (drolon@infonie.fr)
+//
+// This file is part of FreeImage 3
+//
+// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
+// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
+// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
+// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
+// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
+// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
+// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
+// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
+// THIS DISCLAIMER.
+//
+// Use at your own risk!
+// ==========================================================
+
+#include "FreeImage.h"
+#include "Utilities.h"
+#include "FreeImageIO.h"
+
+// =====================================================================
+
+
+// =====================================================================
+// Open and close a memory handle
+// =====================================================================
+
+FIMEMORY * DLL_CALLCONV 
+FreeImage_OpenMemory(BYTE *data, DWORD size_in_bytes) {
+	// allocate a memory handle
+	FIMEMORY *stream = (FIMEMORY*)malloc(sizeof(FIMEMORY));
+	if(stream) {
+		stream->data = (BYTE*)malloc(sizeof(FIMEMORYHEADER));
+
+		if(stream->data) {
+			FIMEMORYHEADER *mem_header = (FIMEMORYHEADER*)(stream->data);
+
+			// initialize the memory header
+			memset(mem_header, 0, sizeof(FIMEMORYHEADER));
+			
+			if(data && size_in_bytes) {
+				// wrap a user buffer
+				mem_header->delete_me = FALSE;
+				mem_header->data = (BYTE*)data;
+				mem_header->datalen = mem_header->filelen = size_in_bytes;
+			} else {
+				mem_header->delete_me = TRUE;
+			}
+
+			return stream;
+		}
+		free(stream);
+	}
+
+	return NULL;
+}
+
+
+void DLL_CALLCONV
+FreeImage_CloseMemory(FIMEMORY *stream) {
+	FIMEMORYHEADER *mem_header = (FIMEMORYHEADER*)(stream->data);
+	if(mem_header->delete_me) 
+		free(mem_header->data);
+	free(mem_header);
+	free(stream);
+}
+
+// =====================================================================
+// Memory stream load/save functions
+// =====================================================================
+
+FIBITMAP * DLL_CALLCONV
+FreeImage_LoadFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags) {
+	if (stream && stream->data) {
+		FreeImageIO io;
+		SetMemoryIO(&io);
+
+		return FreeImage_LoadFromHandle(fif, &io, (fi_handle)stream, flags);
+	}
+
+	return NULL;
+}
+
+
+BOOL DLL_CALLCONV
+FreeImage_SaveToMemory(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FIMEMORY *stream, int flags) {
+	if (stream) {
+		FreeImageIO io;
+		SetMemoryIO(&io);
+
+		FIMEMORYHEADER *mem_header = (FIMEMORYHEADER*)(stream->data);
+
+		if(mem_header->delete_me == TRUE) {
+			return FreeImage_SaveToHandle(fif, dib, &io, (fi_handle)stream, flags);
+		} else {
+			// do not save in a user buffer
+			FreeImage_OutputMessageProc(fif, "Memory buffer is read only");
+		}
+	}
+
+	return FALSE;
+}
+
+// =====================================================================
+// Memory stream buffer access
+// =====================================================================
+
+BOOL DLL_CALLCONV
+FreeImage_AcquireMemory(FIMEMORY *stream, BYTE **data, DWORD *size_in_bytes) {
+	if (stream) {
+		FIMEMORYHEADER *mem_header = (FIMEMORYHEADER*)(stream->data);
+
+		*data = (BYTE*)mem_header->data;
+		*size_in_bytes = mem_header->filelen;
+		return TRUE;
+	}
+
+	return FALSE;
+}
+
+// =====================================================================
+// Memory stream file type access
+// =====================================================================
+
+FREE_IMAGE_FORMAT DLL_CALLCONV
+FreeImage_GetFileTypeFromMemory(FIMEMORY *stream, int size) {
+	FreeImageIO io;
+	SetMemoryIO(&io);
+
+	if (stream != NULL) {
+		return FreeImage_GetFileTypeFromHandle(&io, (fi_handle)stream, size);
+	}
+
+	return FIF_UNKNOWN;
+}
+
+// =====================================================================
+// Seeking in Memory stream
+// =====================================================================
+
+/**
+Moves the memory pointer to a specified location
+@param stream Pointer to FIMEMORY structure
+@param offset Number of bytes from origin
+@param origin Initial position
+@return Returns TRUE if successful, returns FALSE otherwise
+*/
+BOOL DLL_CALLCONV
+FreeImage_SeekMemory(FIMEMORY *stream, long offset, int origin) {
+	FreeImageIO io;
+	SetMemoryIO(&io);
+
+	if (stream != NULL) {
+		int success = io.seek_proc((fi_handle)stream, offset, origin);
+		return (success == 0) ? TRUE : FALSE;
+	}
+
+	return FALSE;
+}
+
+/**
+Gets the current position of a memory pointer
+@param stream Target FIMEMORY structure
+@return Returns the current file position if successful, -1 otherwise
+*/
+long DLL_CALLCONV
+FreeImage_TellMemory(FIMEMORY *stream) {
+	FreeImageIO io;
+	SetMemoryIO(&io);
+
+	if (stream != NULL) {
+		return io.tell_proc((fi_handle)stream);
+	}
+