OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Applications => Topic started by: Dariusz Piatkowski on November 14, 2020, 06:53:09 pm

Title: PMView - colour vibrancy gone after save?
Post by: Dariusz Piatkowski on November 14, 2020, 06:53:09 pm
This one is hard to illustrate since saving the as-is image will clearly strip the "vibrancy" off of it...LOL, but for the sake of comparisong I've attached the JPEG and PNG images or the same content (CPU monitor).

But here is what I'm seeing: capturing any images on my machine with PMView 3.82 (which I believe is the latest version) shows a perfectly matching colour intensity to the original image. However, saving it and re-openning now shows a much more toned down image. The vibrancy is gone.

This only happens with JPEG format (even if but using 100% quality), saving in GIF or PNG does not show this behaviour.

Has anyone seen this?
Title: Re: PMView - colour vibrancy gone after save?
Post by: Dariusz Piatkowski on November 16, 2020, 02:37:53 pm
I reached out to Peter Nielsen - the author of PMView - regarding this. We exchanged a couple of emails, I researched the different formats in parallel to understand this better. In the end, I felt like Peter's final email pretty much summed up the issue very nicely. I asked him to OK me posting his response to the list here, he agreed.

Quote
Subject: Re: PMView - image colour vibrancy gone after save
To: Dariusz Piatkowski
From: Peter Nielsen
Date: Sun, 15 Nov 2020 14:20:55 -0500

Hi Dariusz,

PNG can use a palette (color lookup table) or true color values. In 8-bit mode, a 256 entry palette will be used. GIF always uses a palette, even for gray scale images.

JPEG can only use true color values. You need to read an article or technical paper to understand how it works, but in short, the procedure affects pixel data and reduces information.

Images with sharp contrast (like computer generated images) are generally not suited for JPEG because you will see artifacts because of the lossy algorith,. Also, even more important if you don't have many colors: JPEG is always true color (24 bits for each pixel), it does not have a palette. If you have an image with 256 colors, it can be stored in 8 bits per pixel. If you only have 8 colors, you only need 3 bits per pixel, etc. PNG and GIF may produce smaller images than JPEG in this case, while keeping the image unaltered.

>So am I understanding correctly that due to JPEG's algorithm and compression processing, the colours >eventually arrived at are the post-compression values and therefore this is why they do NOT match those >of the originals?

Yes. The JPEG algorithm is *extremely* unsuitable for computer generated images with "on/off contrast". This is where the algorithm performs the worst. JPEG is good for photographic images but should generally be avoided for any computer generated data.

>Is this taking place because the original used so few colours to start off with?

No. It's because of the sharp pixel-to-pixel contrast in the data. If I recall correctly, JPEG stores data in 8x8 blocks. If you resize the file by 8 times, and then save as JPEG you can expect a better looking result.

Thanks,

Peter

I am satisfied with this explanation, the key there being the extremely small number of colours in the sample images I encountered the issue with.

Thanks everyone,
-Dariusz
Title: Re: PMView - colour vibrancy gone after save?
Post by: Andreas Schnellbacher on November 16, 2020, 06:34:43 pm
Nothing new here. In other words, lossless compression for JPEG doesn't exist. Hence the well-known JPEG artifacts.

A rule of thumb: JPEG for photos and PNG for graphics.
Title: Re: PMView - colour vibrancy gone after save?
Post by: Dave Yeo on November 16, 2020, 06:51:28 pm
Even then, that picture of the trp screen is better being a png.
Title: Re: PMView - colour vibrancy gone after save?
Post by: Joop on November 16, 2020, 10:51:41 pm
No, that's not the whole story with JPEG. You can save JPEG almost without artifacts. PMView has a very nice feature when JPEG is selected. Choose Save as and then the button Options. Set quality at 100 and smoothing at 0. Check the box save exif information. Now your image is saved as the original. If you need an image for an internetpage then you change quality to 80 and smoothing to 2...5. Always sharpen the image with mild or moderate. Always use steps and never go in one time to the end result with everything you do with a picture. In this case the lossy algorithm is working in favour.
With the combination of Embellish and PMView you can do about everything other (big?) programs can do, sometimes even with better results. Remind, you can always sharpen an image but not blur it. So if you take a picture with your camera always not on end sharpness. In post you can always sharpen it, but not unsharpen (blur) it without severe consequences. 
Title: Re: PMView - colour vibrancy gone after save?
Post by: Dariusz Piatkowski on November 16, 2020, 11:50:46 pm
Hi Joop,

No, that's not the whole story with JPEG. You can save JPEG almost without artifacts. PMView has a very nice feature when JPEG is selected. Choose Save as and then the button Options. Set quality at 100 and smoothing at 0. Check the box save exif information. Now your image is saved as the original...

Unfortunately given my use-case that approach simply does not work. Try it using one of my PNG images as as source. There simply is no way to preserve the original colours in JPEG no matter what compression (quality) you choose. Embellish showed the same behaviour, as did a couple of other programs I tried.
Title: Re: PMView - colour vibrancy gone after save?
Post by: Joop on November 17, 2020, 04:44:45 pm
Like this...
All done with only PMView.
Title: Re: PMView - colour vibrancy gone after save?
Post by: Alex Taylor on November 23, 2020, 04:57:41 am
My understanding is that saving as JPEG (more accurately, JFIF) with "100%" quality does not mean lossless compression.  It means (approximately speaking) 100% of the possible fidelity available using the lossy JPEG compression.  Or, to put it another way, "the least amount of loss possible". You will still lose image quality. (You may also quite possibly end up with a larger image than you would have using PNG.)

That said, there is apparently a (non-JFIF) JPEG standard for lossless compression, but AIUI it uses a different file format and is not commonly used or implemented.