Helpful Posts Helpful Posts:  0
Results 1 to 6 of 6

Thread: Technical question re: FastStone Image Viewer JPEG compression

  1. #1
    xpatUSA's Avatar
    Join Date
    Feb 2012
    Location
    Texas
    Posts
    3,098
    Real Name
    Ted

    Technical question re: FastStone Image Viewer JPEG compression

    I've been trying out various RAW converters that can open Sigma X3F raw files without too much faffing about. Sigma Photo Pro 5.1 can't crop images and ACR 5.4/PSE 6 can be tedious and it would be nice to buck the trend and dump Adobe (much as people flee from Explorer and MS Office).

    FastStone Image Viewer offers what I'm looking for all in package but it has me puzzled on it's JPEG compression method options:

    It defaults to "YCbCr" (with a choice three types of compression which I quess to be the chroma sub-sampling methods 4:4:4, 4:2:2 and one other which I won't even guess at) and, after some googling, I now know that YCbCr is yet another color space, used as an intrinsic step in the JPEG compression process.


    But, and here is my problem, the other option is "RGB" which grays out those three types of chroma sub-sampling. I can find no statement of why or when one would select "RGB" in preference to YCbCr.


    Can anyone help?

    -- hide signature --
    Best Regards,
    Ted.

    Last edited by xpatUSA; 10th June 2012 at 03:33 PM. Reason: getting old . . .

  2. #2
    herbert's Avatar
    Join Date
    Oct 2010
    Location
    Sussex, UK
    Posts
    471
    Real Name
    Alex

    Re: Technical question re: FastStone Image Viewer JPEG compression

    Hi Ted,

    YCrCb colour space is used for the advantages of image compression. Essentially you keep more information in the brightness channel (Y) and less in the two chroma channels. This still renders an image that is recognisable but uses less space. However the compression options are most often used with MPEG files for video. It is less common to use the compression for JPEG although it is supported in the standard.

    If you use 4:4:4 then you are not compressing anything and it will be just the same quality as using RGB. The numbers refer to the sampling width, the number of chroma samples on the first row and the number of samples on the second row. See this article for more details:

    http://en.wikipedia.org/wiki/Chroma_subsampling

    If you use 4:2:2 sampling then you will get a smaller image but with slightly worse colour rendition. It is usually most apparent on boundaries of block colour more like you see in text rather than natural images. But with video you have 25-30 frames per second and so averaging over the frames and your eyes filling in details makes it less noticeable.

    You cannot sub-sample RGB using a similar pattern and get a nice image since it would be like having 4 red values but only 2 blue and 2 green for 4 pixels. A better pattern for sampling would be the familiar 2 green and 1 red and 1 blue Bayer filter array. The image could be reconstructed by a routine demosaicing process. However I haven't seen software that saves images using a Bayer mosaic. Effectively you would be getting 3:1 compression which is much higher than 4:2:2 (3:2) or 4:2:0 (2:1). The images may look poor.

    One advantage of YCrCb is that you can use a lower bit depth for the chroma channels since the eye is less sensitive to this. E.g. Use 8-bit for the Y and only 4-bit for the chroma. This saves a lot of space and I think is used in TV broadcasting.

    In the end I would not worry about it and choose RGB unless file size is really important. In that case you adjust the quality factor for the JPEG. This feeds into the algorithm used to group similar colours together and refer to them with a master colour table. This can save space by storing colour approximations for your pixels. The quality factor controls the number of approximations used.

    Alex

  3. #3
    dje's Avatar
    Join Date
    May 2011
    Location
    Brisbane Australia
    Posts
    4,183
    Real Name
    Dave Ellis

    Re: Technical question re: FastStone Image Viewer JPEG compression

    That's an interesting point you raise Ted, one which I haven't thought about before. And I think Alex has given a pretty good explanation. I also believe that chroma sub-sampling is still commonly used in consumer video such as TV broadcasting and DVD's to conserve file size and or data rates.

    A couple of other points

    FastStone Viewer seems to use YCbCr as a default in the compression options but it gives you an indication of file size that will result when you select different compression options. In many ways, file size is not so important for still imaging (compared to video) except where you want to post something on the web.

    Just out of interest I googled to see what Adobe CS5 does with these sort of compression options and found this article. It claims that

    "What many people don't know is that there is a quirk in the way that Photoshop defines its quality range. As mentioned earlier, Quality level 6 is the last point in which chroma subsampling is used. At Quality level 7 and higher, no chroma subsampling is used at all. With the amount of color information encoded now doubled, the file size would have naturally increased significantly at this level versus the previous level.

    However, it is likely that Adobe decided to allocate the various quality levels with some relationship to the final compressed file size. Therefore, Adobe chose a poorer luminance and chrominance compression quality (i.e. higher level of compression) in Quality level 7 than Quality level 6! What this means is that the image quality of Quality level 7 is actually lower than Quality level 6 (at least from luminance detail perspective)."

    I found this interesting. Thanks for raising this issue.

    Dave

  4. #4
    xpatUSA's Avatar
    Join Date
    Feb 2012
    Location
    Texas
    Posts
    3,098
    Real Name
    Ted

    Re: Technical question re: FastStone Image Viewer JPEG compression

    Gentlemen,

    Thanks to you both for your informative replies. My needs are perhaps a little different to those of most folks, hence my original question. I post small (less than 800px wide) pictures on the web typically in watch fora which makes me interested in the minutea of close-up photography of wristwatches, ya gotta show all those scratches perfectly - unlike the denizens of eBay (except me of course).

    I did return to FastStone's Image Viewer and found, to my great delight, that before and after images are shown when you select the options button in the "save as" dialog box and that those images can be zoomed up to pixel-peeping size! So it got quick and easy to compare the effects of their options. I found that for my purposes, an image quality of 90% along with YCbCR set to 4:4:4 suited my purposes quite well.

    Still haven't found what their "RGB" option is supposed to do but it does seem to provide better-looking images at much lower setting of quality e.g. 60% and below. Perhaps this is the easy option for Adobe refugees to use without having to think about it?

    There's maybe a clue in the following, from http://www.jpeg.org/public/jfif.pdf:

    Y, Cb, and Cr are converted from R, G, and B as defined in CCIR Recommendation 601but are normalized so as to occupy the full 256 levels of a 8-bit binary encoding. More
    precisely:
    Y = 256 * E'y
    Cb = 256 * [ E'Cb ] + 128
    Cr = 256 * [ E'Cr ] + 128
    where the E'y, E'Cb and E'Cb are defined as in CCIR 601. Since values of E'y have a
    range of 0 to 1.0 and those for E'Cb and E'Cr have a range of -0.5 to +0.5, Y, Cb, and
    Cr must be clamped to 255 when they are maximum value.


    RGB to YCbCr Conversion
    YCbCr (256 levels) can be computed directly from 8-bit RGB as follows:
    Y = 0.299 R + 0.587 G + 0.114 B
    Cb = - 0.1687 R - 0.3313 G + 0.5 B + 128
    Cr = 0.5 R - 0.4187 G - 0.0813 B + 128
    The hint being that there are two ways to calculate YCbCr:

    Directly from (gamma-corrected) 8-bit RGB or, instead, from the raw data in the X3F file according to the dictates of Rec. ITU-R BT.601 (which quite frankly hurts my brain, big time).

    It was interested to dig into the JPEG thing - something that most folks use, more than any other format, without a clear understanding of what it does and how it does it. Watching color information being lost forever in real time was quite fun, too.

    all the best,

    Ted

  5. #5
    xpatUSA's Avatar
    Join Date
    Feb 2012
    Location
    Texas
    Posts
    3,098
    Real Name
    Ted

    Re: Technical question re: FastStone Image Viewer JPEG compression

    Quote Originally Posted by xpatUSA View Post
    Still haven't found what their "RGB" option is supposed to do but it does seem to provide better-looking images at much lower setting of quality e.g. 60% and below.
    This could be the answer, found in Wikipedia (where else?):

    A particular conversion to Y′CBCR is specified in the JFIF standard, and should be performed for the resulting JPEG file to have maximum compatibility. However, some JPEG implementations in "highest quality" mode do not apply this step and instead keep the color information in the RGB color model[citation needed], where the image is stored in separate channels for red, green and blue brightness components. This results in less efficient compression, and would not likely be used when file size is especially important.
    What do you think?

    Ted

  6. #6
    dje's Avatar
    Join Date
    May 2011
    Location
    Brisbane Australia
    Posts
    4,183
    Real Name
    Dave Ellis

    Re: Technical question re: FastStone Image Viewer JPEG compression

    Quote Originally Posted by xpatUSA View Post
    This could be the answer, found in Wikipedia (where else?):



    What do you think?

    Ted
    Ted I'm no expert on this subject but I would think that you have found your answer.

    Dave

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •