TIEGlobalSettings.AutoSetBitDepth
Declaration
property AutoSetBitDepth: Boolean;
Description
When enabled,
PixelFormat is used as the authoritative source of bit depth, and sets
SamplesPerPixel/
BitsPerSample where they are not valid for that PixelFormat.
If enabled, it is suggested to set following properties:
ImageEnView1.LegacyBitmap := False; // Do not use TBitmap (this is the default)
ImageEnView1.IO.NativePixelFormat := True; // Use the original pixel format
The following properties may be affected by AutoSetBitDepth:
◼SamplesPerPixel◼BitsPerSample◼JPEG_ColorSpace◼J2000_ColorSpace◼TIFF_PhotometInterpret◼TIFF_JPEGColorSpaceNote: You can manually update bit depth using
UpdateBitDepthDefault: False
// load a PNG and save a JPEG: don't care about pixel formats incompatibilities between file formats,
// for example when input.png is a 256 colors palette image, it will be converted to true RGB jpeg image.
IEGlobalSettings().AutoSetBitDepth := True;
ImageEnView.IO.LoadFromFile('input.png');
ImageEnView.IO.SaveToFile('output.jpeg');
// Convert a 32bit PNG file to an 8bit PNG (without transparency)
ImageEnView1.IO.LoadFromFile( 'D:\Alpha.png');
// Remove alpha channel and make background white
ImageEnView1.IEBitmap.RemoveAlphaChannel( True, clWhite );
// Set PixelFormat to 8bit
ImageEnView1.IEBitmap.PixelFormat := ie8p;
// Use PixelFormat as authoritative source of bit-depth
IEGlobalSettings().AutoSetBitDepth := True;
ImageEnView1.IO.SaveToFile('D:\No-Alpha.png');