XnView MP batch convert PNG files to JPG

Ask for help and post your question on how to use XnView MP.

Moderators: XnTriq, helmut, xnview

Post Reply
zoliky
Posts: 5
Joined: Sat Oct 02, 2021 1:50 pm

XnView MP batch convert PNG files to JPG

Post by zoliky »

Hi,
I would like to convert a couple of PNG file to JPG 90% quality. The PNG files are scanned covers of Audio CDs so there is no need to upload them to the web. I just want to view the resulting JPGs on my computer.

I've noticed that the JPG export comes with several options that can be selected and I'm confused about which ones to use.
a.png
a.png (40.24 KiB) Viewed 1600 times
User avatar
XnTriq
Moderator & Librarian
Posts: 6339
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: XnView MP batch convert PNG files to JPG

Post by XnTriq »

For your specific use case, I'd recommend the following settings:

p172639.png
p172639.png (11.94 KiB) Viewed 1557 times


Progressive
IJG* wrote:In this type of JPEG file, the data is stored in multiple scans of increasing quality. If the file is being transmitted over a slow communications link, the decoder can use the first scan to display a low-quality image very quickly, and can then improve the display with each subsequent scan. The final image is exactly equivalent to a standard JPEG file of the same quality setting, and the total file size is about the same – often a little smaller.
https://www.webfx.com/blog/web-design/jpeg-101-a-crash-course-guide-on-jpeg/ wrote:JPEG come in two flavors: baseline and progressive. Baseline JPEG is an image created using the JPEG compression algorithm that will start to display the image as the data is made available, line by line. In a web browser, you can see JPEG images that are in baseline format when you see it slowly showing up, from the top of the image, to the bottom of it.

Progressive JPEG displays an image in such a way that it shows a blurry/low-quality photo in its entirety, and then becomes clearer as the image’s data becomes more fully downloaded.

Progressive is good because the user gets an idea of what the image will be right from the start, even though it’s not as clear as the final image, which is great especially for people with slower Internet connections. This is a great way to enhance web design. The progressive JPEG format also enhances perceived web page performance because it doesn’t appear to be loading in increments, unlike baseline.
:arrow: See it in action


Optimize Huffman table
https://www.impulseadventure.com/photo/optimized-jpeg.html wrote:Does JPEG Optimization affect Image Quality?

No! The huffman table optimization is a lossless (reversible) process that has absolutely no effect on the resulting image quality. If one has the option, it is almost always best to enable JPEG optimization. The extra file size savings can't hurt. However, as it may potentially reduce compatibility with some bad JPEG decoders, this may be enough of a reason for you to disable it.

DCT Method
https://en.wikibooks.org/wiki/GIMP/Saving_as_JPEG wrote:Discrete Cosine Transform (DCT) is generally a mathematical method that helps reduce the amount of unnecessary detail and aids in lossy compression methods.
The “Floating” DCT method produces slightly better results than the “Integer” method with a slight cost to speed. “Fast Integer” should only be used where speed is imperative.

Smoothing factor
IJG* wrote:The -smooth option filters the input to eliminate fine-scale noise. This is often useful when converting dithered images to JPEG: a moderate smoothing factor of 10 to 50 gets rid of dithering patterns in the input file, resulting in a smaller JPEG file and a better-looking image. Too large a smoothing factor will visibly blur the image, however.

[…]

Color GIF files are not the ideal input for JPEG; JPEG is really intended for compressing full-color (24-bit) images. In particular, don't try to convert cartoons, line drawings, and other images that have only a few distinct colors. GIF works great on these, JPEG does not. If you want to convert a GIF to JPEG, you should experiment with cjpeg's -quality and -smooth options to get a satisfactory conversion. -smooth 10 or so is often helpful.

Subsampling factor
  • 2x2,1x1,1x1 (default) = 4:2:0 = ½ horizontal resolution, ½ vertical resolution
  • 2x1,1x1,1x1 = 4:2:2 = ½ horizontal resolution, full vertical resolution
  • 1x1,1x1,1x1 (best quality) = 4:4:4 = full horizontal resolution, full vertical resolution = no sub-sampling
https://www.impulseadventure.com/photo/chroma-subsampling.html wrote:It is widely known that we are much more sensitive to changes in luminance (brightness) than we are to chrominance (color) differences. Because of this, the JPEG format can discard a lot more color information than luminance in the compression process. To facilitate the different compression requirements of the two “channels” of image information, the JPEG file format translates 8-bit RGB data (Red, Green, Blue) into 8-bit YCbCr data (Luminance, Chroma Blue, Chroma Red). Now, with the brightness seperated into a separate data channel, it is much easier to change the compression algorithm used for one channel versus the others.

Chroma subsampling is the process whereby the color information in the image is sampled at a lower resolution than the original. The images below show various types of chroma subsampling (from 1x1 to 2x2) and the effect it has on reducing the color information. Pay special attention to the horizontal and vertical stripes.

* XnView's “JPEG functions are based in part on the work of the Independent JPEG Group”. The IJG is maintaining and publishing libjpeg which comes with command-line programs for JPEG image encoding, decoding, and transcoding. I'm citing the official usage instructions.
Post Reply