Page 1 of 1

Saving a lossless JPEG

Posted: Wed Mar 09, 2016 9:12 pm
by kliefoth
I have a few JPEGs, 30-50MB each, that want to make alterations to, then save without losing too much data. Each time I save them after making minimal alterations (color, levels, no cropping), the file goes from very large to about 20-30% of its original size in MBs. Why is that? If the file is close the same quality as the original (these are hi-res film scans), shouldn't the size be approximately the same? They even seem to fail the eye test, though that's subject to doubt.

I'm happy to save as a another type of file, but after trying a couple (JPEG 2000; RAW), they wouldn't open again after I saved them. Help!

Thanks,
Eric

Re: Saving a lossless JPEG

Posted: Wed Mar 09, 2016 10:53 pm
by cday
kliefoth wrote:I have a few JPEGs, 30-50MB each, that want to make alterations to, then save without losing too much data. Each time I save them after making minimal alterations (color, levels, no cropping), the file goes from very large to about 20-30% of its original size in MBs. Why is that? If the file is close the same quality as the original (these are hi-res film scans), shouldn't the size be approximately the same? They even seem to fail the eye test, though that's subject to doubt.
JPEG is a lossy file format but for photographic images which generally have continuous tones, as opposed to for example scans of text which has sharp edges, it is often possible to obtain a substantial reduction in file size with little or no perceptible loss of quality, although there is a limit, of course.

If you are opening the images in XnView Classic and then saving them, the compression used is set in the dialog displayed when the Options button in the save dialog is clicked:

Image.png
There is quite a lot of information available online and from searching the forum on understanding and using the JPEG file format.
kliefoth wrote:I'm happy to save as a another type of file, but after trying a couple (JPEG 2000; RAW), they wouldn't open again after I saved them. Help!
That's a different question, but if you research JPEG compression a bit you will likely find that, suitable applied, it will meet your needs! :wink:

Re: Saving a lossless JPEG

Posted: Fri Mar 11, 2016 4:46 am
by kliefoth
Thanks for your help. Is there a suffix/file type in XNView that's lossless? to which I can convert a jpeg of 30-50MB? I feel like the shrinkage is beyond the limit, as you put it, perceptible to my naked eye.

Can't a jpeg convert to something else? How come those other files I saved as JPEG 2000 and RAW won't open? Sorry, I'm pretty technologically unsavvy.

Re: Saving a lossless JPEG

Posted: Fri Mar 11, 2016 8:07 am
by cday
You have JPEG files that are 30-50MB and want to edit them, and then save the files without visible loss of quality: is the size of the new files created an issue for you?

You should understand that although data is indeed lost when an image is saved in a lossy format such as JPEG, there is no direct correlation between file size and the visible quality of the saved image: the JPEG format is designed to exploit the characteristics of the eye so as to reduce file size, often dramatically, with no or minimal perceptible loss of quality. That is explained in this Wikipedia link, for example.

If file size is a consideration, your best option is probably to experiment with saving the edited images at different JPEG compression levels, as explained in my first post, and assess the quality of the images obtained. Depending on the intended use of the edited images, for example viewing on a screen when screen resolutions may increase in the future, or printing possibly at a large size, you may want to be conservative and leave some margin, and you may wish to archive the original large files in case they are ever needed again.

If file size is not a consideration, then sure, you can save the edited images using a lossless format, for example PNG or TIFF (not using the lossy JPEG compression option...) but you may find that the resulting files (assuming the images are in colour or grayscale) are very large, which is why JPEG is the commonly used format for saving...

Re: Saving a lossless JPEG

Posted: Mon Mar 14, 2016 4:45 pm
by XnTriq
To minimize so-called generation loss associated with the JPEG format, it usually is recommended to resave the image with the same settings that were used when the file was created.
The most important settings are quality factor (ranging from 0 to 100) and chroma subsampling.

Retrieving extended properties from a JPEG file:
  1. Download JPEGDUMP.ZIP and extract it to a new folder (e.g. X:\Test\).
  2. Copy the JPEG file in question (e.g. sample.jpg) to X:\Test\.
  3. Hit Win+R on your keyboard to open the Run dialog.
  4. Type cmd and hit Enter to get to the command prompt.
  5. At the command prompt, type X:\Test\JPEGDUMP.EXE "X:\Test\sample.jpg" >X:\Test\jpegdump.log and hit Enter.
Based on the contents of jpegdump.log, we can tell you which settings to use for resaving the JPEG with XnView.

Re: Saving a lossless JPEG

Posted: Wed May 04, 2016 1:18 pm
by pxs
Hello,

this is perhaps interesting, FLIF-Support has just been added:

> ____ 2.36 Changelog
> FLIF format added
with Plugin http://newsgroup.xnview.com/viewtopic.php?f=35&t=11715

Free Lossless Image Format: http://flif.info

It's also possible to use is lossy, but without Generation Loss: http://flif.info/lossy.html
Comparision of Generation loss: FLIF vs WebP vs BPG vs JPEG: https://youtu.be/_h5gC3EzlJg