2
using System.Collections.Generic;
9
static void Main(string[] args)
11
// Check if FreeImage.dll is available (can be in %path%).
12
if (!FreeImage.IsAvailable())
14
Console.WriteLine("FreeImage.dll seems to be missing. Aborting.");
18
Sample sample = new Sample();
19
// This example shows how to work with ICC-Profiles.
28
// Load the sample bitmap.
29
FIBITMAP dib = FreeImage.LoadEx("Sample.jpg");
34
Console.WriteLine("Sample.jpg could not be loaded. Aborting.");
38
// Get the bitmaps ICC-Profile.
39
FIICCPROFILE icc = FreeImage.GetICCProfileEx(dib);
41
// Print the profiles address.
42
Console.WriteLine("The profiles memory-address is : 0x{0}", icc.DataPointer.ToString("X"));
44
// Print the profiles size
45
Console.WriteLine("The profiles size is : {0} bytes", icc.Size);
47
// Create data for a new profile.
48
byte[] data = new byte[256];
49
for (int i = 0; i < data.Length; i++)
52
// Create the new profile
53
icc = new FIICCPROFILE(dib, data);
55
Console.WriteLine("The profiles memory-address is : 0x{0}", icc.DataPointer.ToString("X"));
56
Console.WriteLine("The profiles size is : {0} bytes", icc.Size);
58
// Create the new profile but only use the first 64 bytes
59
icc = new FIICCPROFILE(dib, data, 64);
61
Console.WriteLine("The profiles memory-address is : 0x{0}", icc.DataPointer.ToString("X"));
62
Console.WriteLine("The profiles size is : {0} bytes", icc.Size);
64
// CreateICCProfileEx(...) does the same as above
65
icc = FreeImage.CreateICCProfileEx(dib, data, 16);
67
Console.WriteLine("The profiles memory-address is : 0x{0}", icc.DataPointer.ToString("X"));
68
Console.WriteLine("The profiles size is : {0} bytes", icc.Size);
70
FreeImage.UnloadEx(ref dib);