Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some png files when resized with png.quality results as empty/transparent png file #613

Closed
tvatavuk opened this issue Nov 15, 2022 · 5 comments

Comments

@tvatavuk
Copy link

We need to resize this demo.png image.

image

Issue happens with parameters: demo.png?w=1230&h=760&png.quality=75&mode=crop&scale=both

image

If we append png.lossless=true than resized image looks OK,
except that we can not control quality demo.png?w=1230&h=760&png.quality=75&mode=crop&scale=both&png.lossless=true

image

Issue happens with code that is using following dependencies:

  • Imageflow.Net (0.8.5)
  • Imazen.HybridCache (0.7.7)
  • Imazen.Common (0.7.7)
  • Imageflow.NativeRuntime.win-x86 (1.7.3-rc67)
  • Imageflow.NativeRuntime.win-x86_64 (1.7.3-rc67)

Same code works as expected with older version of dependencies:

  • Imageflow.Net (0.7.24)
  • Imazen.HybridCache (0.5.10)
  • Imazen.Common (0.5.10)
  • Imageflow.NativeRuntime.win-x86 (1.5.8-rc62)
  • Imageflow.NativeRuntime.win-x86_64 (1.5.8-rc62)

Same issue is tracked here: 2sic/2sxc#2932

Please check 2sic/2sxc#2932 (comment)

@tvatavuk tvatavuk changed the title on some png files resizing with png.quality results in transparent png file Some png files when resized with png.quality results as empty/transparent png file Nov 15, 2022
@lilith
Copy link
Member

lilith commented Nov 18, 2022

So, I created an integration test on the latest version - but it works on my machine. Can you verify this is the correct input file? Maybe GitHub reencoded it?
https://imageflow-resources.s3.us-west-2.amazonaws.com/test_inputs/png_turns_empty.png

Using w=1230&h=760&png.quality=75&mode=crop&scale=both, I get https://imageflow-resources.s3.us-west-2.amazonaws.com/visual_test_checksums/0E5E63543D35A149D.png

lilith added a commit that referenced this issue Nov 18, 2022
@lilith
Copy link
Member

lilith commented Nov 18, 2022

Hmm, this is failing on windows but not linux.

@lilith
Copy link
Member

lilith commented Nov 18, 2022

And yet even on windows the result looks correct, despite being compressed differently. Can the problem image be emailed to lilith@imazen.io to make sure GitHub isn't 'repairing' it? Also, can you try with the very latest Imageflow release? This was listed as being in an older version.

@lilith
Copy link
Member

lilith commented Nov 21, 2022

So, GitHub apparently re-compresses images. The image you e-mailed me is a 24-bit PNG, 18.4KB, and the image GitHub lets me access is a 32-bit PNG, 27.5KB

@lilith lilith closed this as completed in d5f439c Nov 21, 2022
@lilith
Copy link
Member

lilith commented Nov 21, 2022

This was specific to PNG files with a zero alpha channel, encoded when using lossy PNG, and when no transparency-inducing operations are performed. Thank you for e-mailing the problematic file, that allowed me to diagnose the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants