printpdf
printpdf copied to clipboard
replace color_space field in `ImageXObject` with `color_type` field
ColorSpace is just a simplified version of ColorType
and is not used much in this library codebase.
Replacing it with the color_type
field in ImageXObject will give library users more information, in case they want to do some transformation with the field image_data
.
For example, some people reported that adding an image with the Alpha channel will result in a blank page (#84, #119).
This can be resolved by removing the alpha channel from ImageXObject::image_data (check this comment: https://github.com/fschutt/printpdf/issues/119#issuecomment-1120434233). However, for different color_type
, image_data
will have different formats. For ColorType::Rgba8
, image_data
will have format: [Red1, Green1, Blue1, Alpha1, ..., RedN, Green2, Blue2; AlphaN]
. But for ColorType::Rgba16
, the format will be [Red1a, Red1b, Green1a, Green1b, Blue1a, Blue1b, Alpha1a, Alpha1b, ...]
. Source: https://github.com/image-rs/image/issues/1711#issuecomment-1120450753