Closed vivadavid closed 1 year ago
If there's some kind of contradiction between choosing lossless and converting from PNG to JPEG
There is. The two options don't really make sense together, since converting can result in a loss of quality. The example you provided, from PNG to JPG is one of them. I should probably print a warning for this kind of combination, but still the output should always be in the desired format (JPG in your example). I'll take a look into it.
By the way I just tested your scenario and the output from a PNG is a JPG. I checked the file with file
on Linux and MediaInfo
on Windows.
If turning on Lossless on a PNG implies keeping the format, while I need to convert my image to JPEG, I guess the only thing I could is trying different quality percentages.
Would the opposite make thense? A scenario where I have a JPEG file, I turn on Lossless and I set Output to PNG.
If you select an output format different from the original the app does something like this:
Converting a JPG to a PNG will preserve the image as is, even though it will probably increase in size. The opposite is not true, because JPG is lossy by default and just the PNG -> JPG process will degrade the image, even so slightly.
Hope is more clear, feel free to ask anything else if you still have doubts.
Hi, @Lymphatus ,
Thank you for the explanation.
Despite not making much sense and despite the loss of quality, I think it'd still be nice if Caesium could apply lossless to a PNG image that could be converted to a JPEG. I'm thinking about a context where you absolutely need a JPEG as output but, at the same time, you want to get the best possible quality within some limits.
For the PNG -> JPG Caesium already performs a conversion with 100 quality applied and then goes for lossless optimization. Since the quality difference in the range 80-100 is usually very minimal, going for lossless after a conversion - in my personal opinion - will just give you a bigger image without any real gain in quality. It's counterintuitive, but converting PNG -> JPG with quality 80-90 can achieve very similar result as lossless with much much smaller image.
You can do some tests and see by yourself what's the best tradeoff for you.
In that case, I'll do that. Thanks, @Lymphatus !
Hi,
Sorry that I've reopened the thread, but I wanted to test the issue on 2.5.0.
Despite not being recommended, I've tried to convert a PNG file with Lossless on, Skip if output size is bigger than original on and Output set to JPG. The results seem contradictory:
Describe the bug If I add a PNG file, select Lossless and set Output to JPG, the file produced by Caesium has a JPG extension, but it's actually a PNG file as shown by MediaInfo or ExifTool.
Software version
Operating System information
To Reproduce
Expected behavior As Output is set to JPG, I expect to obtain a JPEG image. For my purposes, I need to get a JPEG file, but I also need, in some circunstances, to get the best quality as possible, and that's why I mark Lossless. If there's some kind of contradiction between choosing lossless and converting from PNG to JPEG, maybe Caesium should display some info. In any case, the converted file should have the extension that corresponds to the format it's using.
Application Log caesium-2023-07-25.log