Tom_Eagle is having trouble uploading a PNG file to fix an API problem. Despite trying different settings, the PNG file is automatically converted to JPG. pfaffman notes that there are times when PNG is used for a specific reason, and Tom_Eagle confirms that he wants to use PNG but can’t.
lhkjacky suggests reducing the size of the PNG icon using TinyPNG, which Tom_Eagle confirms works. simon explains that the issue might be due to copying and pasting the PNG image into the editor, and suggests using the editor’s upload button instead. He also notes that the png to jpg quality and recompress original jpg quality settings need to be set to 100 to prevent PNG conversion.
codinghorror suggests that the setting descriptions should be made more obvious to prevent this issue. simon and sam agree that PNGs should not be converted to JPGs when uploading site settings images. This issue is now fixed by techAPJ through a GitHub commit.
Use TinyPNG to reduce the size of the PNG icon will fix the problem.
I have the same problem before, I spent hours to debug and searched for solution. Finally I found out that it was caused by the size of the icon. Reduce the PNG size (by reduce resolution or bit depth) will fix the problem.
The settings from your screenshot look correct. I’m fairly sure that if you copy/paste a PNG image into the editor, Discourse automatically converts it to a JPG. If that’s how you have been adding the image, try using the editor’s upload button to add the image and see if that makes a difference.
I don’t think the image preview jpg quality setting is relavant to the issue, but both the png to jpg quality and recompress original jpg quality settings need to be set to 100 to prevent PNGs from being converted to JPGs. Questions about conversion of PNG images have come up a few times. It would be good to find a way to make the settings that control this behaviour more obvious.
If you’d like to check in a copyedit to the setting descriptions that makes this clear, that’d be great! WARNING: mostly-lossless PNGs take many times more storage space than lossy JPGs.
FYI (I’m with Thomas) regarding our use case – this has never been an issue for us except recently, because this JPG broke our PWA (as discussed here).