https://github.com/discourse/discourse/commit/70050a8ba365628394fbf7597daf75891328d991
I identified a situation where pngs would be converted to jpegs even when png_to_jpg_quality was set to 100, and merged in a fix just now. Hopefully this addresses the problem you had encountered.
Can you update your Discourse instance and let us know if the problem has been resolved?