question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

LosslessCompress routine is making some PNGs grayscale

See original GitHub issue

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am using the latest version of Magick.NET
  • I have searched open and closed issues to ensure it has not already been reported

I just saw there is a new version of Magick.NET. I am going to update to the latest version of Magick.NET-Q16-AnyCPU now and see if we get another repro

Description

The LosslessCompress is intermittently destroying a set of PNGs

image

I took a look at the before and after for a specific image and noticed the alpha channel is lost and the color goes from RGB to grayscale after optimization. Here’s a screen grab of before and after comparison

image

I ran the same compression code in a loop on my laptop hundreds of times and was unable to reproduce the error. Is there anything you can think of that may be causing this? I am at a loss.

Here are the known repros of the issue:

https://github.com/nextcloud/nextcloud.com/pull/932 https://github.com/nextcloud/nextcloud.com/pull/920 https://github.com/dependabot/dependabot.github.io/pull/102 https://github.com/spences10/blog.scottspence.me/pull/614

interestingly for the dependabot case

/images/blog/auto-merge-2.png went from 97.98kb -> 81.75kb in https://github.com/dependabot/dependabot.github.io/pull/101 and then from 81.75kb -> 10.03kb in https://github.com/dependabot/dependabot.github.io/pull/102

This one had no alpha before or after, but the color space went from RGB and LCD to Gray

image

Steps to Reproduce

Run ImgBot’s call to LosslessCompress() see https://github.com/dabutvin/ImgBot/blob/master/CompressImagesFunction/CompressImages.cs#L120-L154

System Configuration

  • Magick.NET version: 7.5.0.1
  • Environment (Operating system, version and so on):
"os_name": "Windows Server 2016",
"os_build_lab_ex": "14393.2312.amd64fre.rs1_release(bryant).180609-2043",
"cores": 2
  • Additional information: This is an Azure functions environment running in consumption mode

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dlemstracommented, Aug 14, 2018

I wonder what happens when you try this with all the images from one of the repos that fails and optimize them in parallel. And do that in a loop until we optimize one of those images too much. And when we have a reproducible situation we can enable debug logging to get more information.

0reactions
dabutvincommented, Aug 21, 2018

👍 👍 👍 Awesome! Great news

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lossless compression of a sequence of similar grayscale ...
Method 2 - rotate and crush - 34%. I rotated your images through 90 degrees and crushed the result: magick input.png -rotate 90...
Read more >
How is PNG lossless given that it has a compression ...
As a result, PNG compression is completely lossless - that is, ... in grayscale and truecolor images, and it can help on some...
Read more >
Lossless WebP import does not make use of grayscale (L8/ ...
This can be worked around by enabling Force Png in the Project Settings then reimporting all textures that are imported with lossless ......
Read more >
Grayscale PNG larger file size than RGB
At its best (largest), it's a quick lossless compression, but at its worst (smallest), you lose time, as it doing far more work...
Read more >
Exclude selected images from compression on PDF export ...
In the Compression section of the PDF export, under the Grayscale Images settings, select "DO Not Downsample" and set Compression to "None.".
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found