Migration Guide > Migration Guide > I. Features Introduced in OpenROAD 6.2 > Changes to Existing Features > BitmapObject.WriteToFile Method Now Supports PNG Bitmap Format
Was this helpful?
BitmapObject.WriteToFile Method Now Supports PNG Bitmap Format
The BitmapObject WriteToFile method is enhanced to support reading and writing bitmap files in PNG format. Bitmaps derived from PNG-format files can be transformed implicitly into the existing BitmapObject format, or an existing BitmapObject can be written to a file using the PNG format.
However, not all capabilities of the PNG format are supported, and in certain situations transformations must be performed to make PNG images compatible with the OpenROAD BitmapObject.
When reading a PNG format file into a BitmapObject:
Grayscale images (1-, 2-, 4-, 8-, and 16-bit depths) are converted to 24-bit RGB.
Indexed 8-bit images are unchanged. Other indexed images (1-, 2-, and 4-bit) are converted to 24-bit RGB.
8- and 16-bit-channel RGB images maintain their color type (RGB), but 16-bit channels are scaled down to 8-bit channels with minimal image color degradation because OpenROAD does not currently support 16-bit color channels.
RGBA format files remain 32-bit RGBA with an alpha channel compositing transformation applied.
RGBA (RGB with a transparency channel) images become 24-bit RGB.
When writing a PNG image file:
Image data is written in RGB or RGBA format with 8-bit channels.
Because the BitmapObject populated from reading a PNG format file may ignore non-critical chunks (which may describe information such as image histograms, pixel dimensions, and textual data), the file written may differ in length from the one originally read.
The BitmapObject populated from reading a PNG format file may have data transformations implicitly performed (grayscale to RGB, 16-bit colors to 8-bit, and so on). The file written may differ in length from the one originally read.
Last modified date: 06/25/2024