POV-Ray : Newsgroups : povray.general : Good JPEG compression with minimal artifacts (was: Shocked Fish. (~160k)) : Good JPEG compression with minimal artifacts (was: Shocked Fish. (~160k)) Server Time
8 Aug 2024 16:21:11 EDT (-0400)
  Good JPEG compression with minimal artifacts (was: Shocked Fish. (~160k))  
From: Peter J  Holzer
Date: 11 Nov 2000 18:01:27
Message: <slrn90ri95.u9c.hjp-usenet@teal.h.hjp.at>
[Crossposted to povray.general and Followup-To set]

On Sun, 05 Nov 2000 19:44:14 -0800, Thomas Lake wrote:
>Some may remember the fish tank. Sorry for the file size but anything
>bellow 2% compression and artifacts started to eat away at it.

Since this problem comes up so often in this group, I think this calls
for inclusion in Warp's VFAQ. Here is a draft entry:

    How can I avoid artifacts and still get good JPEG compression?

    First, you have to know a little bit about how a picture is stored
    in JPEG format.
    
    Unlike most image formats it doesn't store RGB values, but YUV
    values (1 grayscale value and two "color difference" values) just
    like they are used in a color TV signal. Since the human eye uses
    mostly the gray values to detect edges, one can usually get away
    with storing the color information at a lower resolution - an
    800x600 JPEG typically has only grayscale information at 800x600,
    but color information at 400x300. This is called supersampling.
    
    For each color channel separately, the picture is then divided into
    little squares and the cosine transform of each square is computed.
    A neat feature of this transformation is that if you throw away only
    a few of the values, the quality will degrade very little, but the
    image will compress a lot better. The percentage of values stored is
    called the quality.

    Finally, the data is compressed.

    Most programs only let you change the quality setting. This is fine
    for photos and photorealistic renderings of "natural" scenes.
    Generally, quality values around 75% give be best compromise between
    quality and image size. 

    However, for images which contain very saturated colors, the lower
    resolution of the color channels causes visible artifacts which are
    very similar to those caused by low quality settings. They can be
    minimized by setting an extremely high quality (close to 100%), but
    this will dramatically increase the file size, and often the
    artifacts are still visible.

    A better method is to turn off supersampling. The higher resolution
    will cause only a modest increase in file size, which is more than
    offset by the ability to use a lower quality setting.

    The cjpeg command line utility (which should be available for all
    systems which have a command line, e.g., Linux, MS-DOS, Unix, ...)
    has an "-sample" to set the sampling factors for all passes.

	cjpeg -sample 1x1,1x1,1x1 -quality 75 

    should be good default values which have to be changed only rarely.

Comments? Improvements? Recommendations for Windows or Mac tools?

	hp

-- 


| |   | hjp### [at] wsracat      |    -- Lutz Donnerhacke in dasr.
__/   | http://www.hjp.at/ |


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.