image icon indicating copy to clipboard operation
image copied to clipboard

`save` method result's in a all white 100% transparent image

Open jkoking opened this issue 2 years ago • 1 comments

Expected

DynamicImage is saved to the file system.

Actual behaviour

save's a all white 100% transparent image to the file system.

Reproduction steps

https://github.com/jkoking/image-rs-issue-1867

My original discussions post

#1865

jkoking avatar Mar 01 '23 05:03 jkoking

It seems that we're producing corrupt TIFFs and the color type is Rgba8 so not even anything exotic:

$ tiffinfo ocr.tiff
TIFFReadDirectory: Warning, Sum of Photometric type-related color channels and ExtraSamples doesn't match SamplesPerPixel. Defining non-color channels as ExtraSamples..
=== TIFF directory 0 ===
TIFF Directory at offset 0x1fa4130 (33177904)
  Image Width: 3840 Image Length: 2160
  Resolution: 1, 1 (unitless)
  Bits/Sample: 8
  Sample Format: unsigned integer
  Compression Scheme: None
  Photometric Interpretation: RGB color
  Samples/Pixel: 4
  Rows/Strip: 66
  Planar Configuration: single image plane

@jkoking If you are just looking for a workaround, either removing the alpha channel (img.to_rgb8().save("ocr.tiff")) or picking a different file format (img.save("ocr.png")) should work. However, this case really should be fixed...

fintelia avatar Mar 01 '23 07:03 fintelia