imgbot / Imgbot

An Azure Function solution to crawl through all of your image files in GitHub and losslessly compress them. This will make the file size go down, but leave the dimensions and quality untouched. Once it's done, ImgBot will open a pull request for you to review and merge. help@imgbot.net
https://imgbot.net/
MIT License
1.24k stars 270 forks source link

Changing image background #815

Open IlanCosman opened 3 years ago

IlanCosman commented 3 years ago

Hi, I recently attempted to use imgbot (as I have before) on my images for my project. Unfortunately, the background color of all images (but not gifs) was changed. It may be relevant that the original background color is purposefully the same as github's background in dark mode (as of Dec 22 2020). This allows it to blend in perfectly. Here are the images:

Original:

Imgbot:

I'm happy to provide any other information that would be useful.

dlemstra commented 3 years ago

Those images are identical?

IlanCosman commented 3 years ago

I'm not sure what you're asking. The top image is what was fed into imgbot, and the bottom is what came out. They are visibly not identical.

dlemstra commented 3 years ago

They are identical. I am using ImageMagick to compare those images and those two images are the same.

IlanCosman commented 3 years ago

Fascinating. Do they look identical to you? I've viewed them on multiple machines and they are clearly not the same color.

IlanCosman commented 3 years ago

It can be very hard to see on GitHub, but just click on each of them to open them in new tabs, and then switch back and forth between them.

rosslh commented 3 years ago

I also see the color difference between those images in Firefox (84.0.2) and Chrome (87.0.4280.141). My system is Windows 10 Home 10.0.18363 Build 18363.

IlanCosman commented 3 years ago

Any update on this? I'd love to get back to using imgbot 🙏What a fascinating bug 😂

Yash-Singh1 commented 2 years ago

I think the background is different:

Lighter Screenshot from 2021-09-29 12-12-59

Darker Screenshot from 2021-09-29 12-13-03

andersk commented 2 years ago

Although the pixels in these images have identical numerical values, imgbot has added a number of PNG chunks that change the colorimetric interpretation of those numerical values:

$ pngcheck -v a.png b.png
File: a.png (21413 bytes)
  chunk IHDR at offset 0x0000c, length 13
    1004 x 324 image, 32-bit RGB+alpha, non-interlaced
  chunk sBIT at offset 0x00025, length 4
    red = 8 = 0x08, green = 8 = 0x08, blue = 8 = 0x08, alpha = 8 = 0x08
  chunk IDAT at offset 0x00035, length 8192
    zlib: deflated, 32K window, default compression
  chunk IDAT at offset 0x02041, length 8192
  chunk IDAT at offset 0x0404d, length 4932
  chunk IEND at offset 0x0539d, length 0
No errors detected in a.png (6 chunks, 98.4% compression).

File: b.png (15715 bytes)
  chunk IHDR at offset 0x0000c, length 13
    1004 x 324 image, 24-bit RGB, non-interlaced
  chunk gAMA at offset 0x00025, length 4: 0.45455
  chunk cHRM at offset 0x00035, length 32
    White x = 0.3127 y = 0.329,  Red x = 0.64 y = 0.33
    Green x = 0.3 y = 0.6,  Blue x = 0.15 y = 0.06
  chunk bKGD at offset 0x00061, length 6
    red = 0x00ff, green = 0x00ff, blue = 0x00ff
  chunk IDAT at offset 0x00073, length 15482
    zlib: deflated, 32K window, maximum compression
  chunk tEXt at offset 0x03cf9, length 37, keyword: date:create
  chunk tEXt at offset 0x03d2a, length 37, keyword: date:modify
  chunk IEND at offset 0x03d5b, length 0
No errors detected in b.png (8 chunks, 98.4% compression).

No errors were detected in 2 of the 2 files tested.

Deleting either or both of the gAMA and cHRM chunks from the imgbot output restores the original appearance.

Jaex commented 2 years ago

We also have same problem, you can see example images in this pull request:

https://github.com/ShareX/sharex.github.io/pull/43

Before (#2a2f38):

After (#252b35):

And I realized about this too late :( So I must find all images modified by Imgbot past one year and revert them to originals.

Morgy93 commented 2 weeks ago

"Same" issue here, even though it is not the background only.

It's this one: https://github.com/Morgy93/goecleanup/pull/2/files#diff-706ff17a872243dc0aa594a8368f0990148a14acf751f2446ffbe44d187cee87

Some examples:

image