POV-Ray : Newsgroups : povray.general : Good JPEG compression with minimal artifacts (was: Shocked Fish. (~160k)) Server Time
31 Oct 2024 22:22:52 EDT (-0400)
  Good JPEG compression with minimal artifacts (was: Shocked Fish. (~160k)) (Message 1 to 7 of 7)  
From: Peter J  Holzer
Subject: Good JPEG compression with minimal artifacts (was: Shocked Fish. (~160k))
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

From: Margus Ramst
Subject: Re: Good JPEG compression with minimal artifacts (was: Shocked Fish. (~160k))
Date: 11 Nov 2000 21:29:27
Message: <3A0E00AD.2D0FC1EE@peak.edu.ee>
"Peter J. Holzer" wrote:
> 
> 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:
> 

Thanks, this looks very informative.
It might be useful to mention a few links such as:
http://www.jpeg.org
http://www.ijg.org
http://www.faqs.org/faqs/jpeg-faq/

-- 
Margus Ramst

Personal e-mail: mar### [at] peakeduee
TAG (Team Assistance Group) e-mail: mar### [at] tagpovrayorg


Post a reply to this message

From: Thomas Lake
Subject: Re: Good JPEG compression with minimal artifacts (was: Shocked Fish. (~160k))
Date: 11 Nov 2000 22:30:29
Message: <3A0E0EE2.6B45A070@home.com>
Thanks for this. I know a little about Jpeg compression but I learned a lot
from reading this.

"Peter J. Holzer" wrote:

> [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

From: Jamie Davison
Subject: Re: Good JPEG compression with minimal artifacts (was: Shocked Fish. (~160k))
Date: 12 Nov 2000 07:45:50
Message: <MPG.1478a04a70609ae498983e@news.povray.org>
On Sat, 11 Nov 2000 23:33:09 +0100, Peter J. Holzer wrote...
[much snippage]

> Comments? Improvements? Recommendations for Windows or Mac tools?

Not specifically a windows util, but Sea 1.3 for DOS can perform 1x1x1 
sampling for jpeg compression.  And it tuns quite happily under Win98 on 
my box.

Unfortunately, I can't remember the current URL for it... (I downloaded 
it a good two or three years ago)

Bye for now,
     Jamie.


Post a reply to this message

From: Chris Huff
Subject: Re: Good JPEG compression with minimal artifacts (was: Shocked Fish. (~160k))
Date: 12 Nov 2000 09:23:12
Message: <chrishuff-520F86.09232212112000@news.povray.org>
In article <slr### [at] tealhhjpat>, 
hjp### [at] SiKituwsracat (Peter J. Holzer) wrote:

> Recommendations for Windows or Mac tools?

A nice looking Mac drag-and-drop program:

"To JPEG uses a free JPEG library written by the Independent JPEG Group; 
it's essentially a Macintosh port of the cjpeg program included in that 
library."
http://iagu.on.net/jsam/to-jpeg/to-jpeg.html

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Chris Huff
Subject: Re: Good JPEG compression with minimal artifacts (was: Shocked Fish. (~160k))
Date: 12 Nov 2000 09:23:28
Message: <chrishuff-43570A.09233812112000@news.povray.org>
In article <MPG.1478a04a70609ae498983e@news.povray.org>, 
jam### [at] dh70qdu-netcom (Jamie Davison) wrote:

> Not specifically a windows util, but Sea 1.3 for DOS can perform 1x1x1 
> sampling for jpeg compression.  And it tuns quite happily under Win98 on 
> my box.
> 
> Unfortunately, I can't remember the current URL for it... (I downloaded 
> it a good two or three years ago)

http://www.photodex.com/downloads/platforms/dos.html

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Warp
Subject: Re: Good JPEG compression with minimal artifacts
Date: 13 Nov 2000 07:09:19
Message: <3a0fd9ef@news.povray.org>
I added this to the VFAQ. Thanks for the extensive (and great) answer.

  (Btw, I took the liberty of adding the option "-optimize" to your cjpeg
command.)

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

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