A discussion about a bug where very small PNG images with transparent backgrounds are being incorrectly converted to JPEGs, losing transparency. robbyoconnor reported that a transparent logo uploaded via the new site logo interface was converted to a JPEG, resulting in a white background and lost text. codinghorror suggested the issue might be due to file size optimization, but testing showed the PNG was already small (around 12-13KB) and not optimized, making the JPEG conversion unexpected. sam acknowledged the issue and confirmed a fix was implemented in a code commit 86255faa, which prevents the conversion for small files. robbyoconnor confirmed the fix resolved the problem.
It appears that transparent logos are no longer possible…this has broken our logo on our site.
This is a transparent background with white text – uploaded one to imgur so I could show what it is supposed to be. It seems to be getting converted to JPEG
actual logo vs Uploaded below – note it’s a white-background so just right-click and save to see the bug:
If I upload a PNG, I’d like it to remain a PNG personally…and @codinghorror – I did actually reproduce it – see my original post – it is convertng to JPEG all images apparently
This usually implies the file is not optimized, and therefore far larger than it should be. Have you tried running the PNG through a lossless optimizer first?
I just grabbed it from the Assets for Site Design thread and uploaded it. I could do that and try again… could we just optimize the PNGs and not convert to JPEG so that we could preserve transparency?
I’m on vacation so it’s hard for me to test things at this time, but I strongly suspect that if you ran the PNG through a lossless optimizer (google for it, if you need to), you’ll get a much smaller image that won’t be converted due to size. I could be wrong, but this is my best technical guess based on what I know at this moment.
It’s filesize based, for the most part. If the image is wildly smaller as a jpg then that’s what we choose. Only a perversely egregious PNG would cause this to happen.
Edit: that does NOT appear to be the case (13kb PNG), so if this is happening, it is a different bug @sam
I think it’s because the jpg is only 5kb, so that’s viewed as a significant filesize savings (by percentage perhaps). We should disable this optimization step when the total size is under, say, 100kb?