In This Topic
Applies a color-remap table to a GdPicture image.
Syntax
Parameters
- ImageID
- GdPicture image identifier.
- RemapTable
- Array which specifies the color remap table. Each entry is a
Imaging.ColorMap oGdPictureImaging.
Return Value
A member of the GdPictureStatus enumeration.
Example
Replacing shades of red by shades of blue within a an image.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.bmp");
// Create the table.
System.Drawing.Imaging.ColorMap[] RemapTable = new System.Drawing.Imaging.ColorMap[256];
for (int index = 0; index < 256; index++)
{
System.Drawing.Imaging.ColorMap remap = new System.Drawing.Imaging.ColorMap();
remap.NewColor = Color.FromArgb(0, 0, index);
remap.OldColor = Color.FromArgb(index, 0, 0);
RemapTable[index] = remap;
}
// Apply the table.
gdpictureImaging.SetColorRemap(imageID, RemapTable);
gdpictureImaging.SaveAsJPEG(imageID, "image.jpg", 75);
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
Example
Replacing shades of red by shades of blue within a an image.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.bmp");
// Create the table.
System.Drawing.Imaging.ColorMap[] RemapTable = new System.Drawing.Imaging.ColorMap[256];
for (int index = 0; index < 256; index++)
{
System.Drawing.Imaging.ColorMap remap = new System.Drawing.Imaging.ColorMap();
remap.NewColor = Color.FromArgb(0, 0, index);
remap.OldColor = Color.FromArgb(index, 0, 0);
RemapTable[index] = remap;
}
// Apply the table.
gdpictureImaging.SetColorRemap(imageID, RemapTable);
gdpictureImaging.SaveAsJPEG(imageID, "image.jpg", 75);
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also