Author Topic: JPEG Size  (Read 3163 times)

Offline bstich

  • Newcomer
  • *
  • Posts: 24
    • View Profile
JPEG Size
« on: October 17, 2022, 07:17:44 AM »
hello, one question : why are the jpeg file size so big ? Exemple for exactly the same photo (Frome a tiff file - resized 1800x1200 px)1800w1200 px ). "Save as" in photomechanic / Quality 50 = 1,3Mo. With photoshop - jpeg high quality 10 = 1 Mo. Fotostation JPEB "very high quality") = 1,2Mo? Thank you

Offline Bob Russell

  • Camera Bits Staff
  • Sr. Member
  • *****
  • Posts: 276
    • View Profile
    • Camera Bits, Inc.
Re: JPEG Size
« Reply #1 on: October 17, 2022, 09:41:46 AM »
Hello,

  Photo Mechanic's Save as jpeg has the additional Subsample Chroma option not present in most other photo processing apps. This box is typically checked when the quality slider is at 70 or less. Most cameras generate a high quality jpeg with an equivalent compression setting of Quality 60 with the Subsample Chroma box checked. Photo Mechanic's Save as utility will show the resulting file size of the image data, for the first selected jpeg. This will be under the right end of the Jpeg quality slider. The new jpeg could be about 10% larger than the displayed size, depending on the amount of embedded metadata.

--Bob

Offline bstich

  • Newcomer
  • *
  • Posts: 24
    • View Profile
Re: JPEG Size
« Reply #2 on: October 18, 2022, 01:59:44 AM »
Thank you,
but that doesn't seem to explain why jpeg file size at 50 on photomechanic (half the quality 50/100) is equivalent to size 10 on photoshop (maximum quality - 10/12)
Best, Benoît

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 25020
    • View Profile
    • Camera Bits, Inc.
Re: JPEG Size
« Reply #3 on: October 18, 2022, 09:09:28 AM »
Benoît,

but that doesn't seem to explain why jpeg file size at 50 on photomechanic (half the quality 50/100) is equivalent to size 10 on photoshop (maximum quality - 10/12)

Set the "Subsample Chroma" checkbox and the size should reduce by about 20%.  Photoshop on 11-12 does not subsample the chrominance data, at 10 and below it subsamples the chrominance data.

-Kirk

Offline bstich

  • Newcomer
  • *
  • Posts: 24
    • View Profile
Re: JPEG Size
« Reply #4 on: October 26, 2022, 02:19:37 AM »
Thank you to help me. I understood that the Chroma Subsample reduces the size of a JPEG.
But, for the same photo (A3 size) - without Subsample Chroma - in photomechanical Quality 80 - Size = 12,7 MB. In photoshop JPEG (without Subsample Chroma)  Maximum quality 11 - size = 9,0Mb.
In Photomechanic High Quality 100 = 19,26 Mo - photoshop Maximum qualité JPEG 12 = 13,3 Mo
So my question is : why ?
Best regards, Benoît

Offline dennis

  • President
  • Camera Bits Staff
  • Sr. Member
  • *****
  • Posts: 469
    • View Profile
    • Camera Bits, Inc.
Re: JPEG Size
« Reply #5 on: October 26, 2022, 11:48:01 AM »
The quality setting for JPEG in Photo Mechanic does not correspond to Photoshop's quality setting, so there is no direct comparison.

Photo Mechanic will not go as low quality as Photoshop, meaning the lowest quality setting in Photo Mechanic is higher quality (less compression) than the lowest quality setting in Photoshop.

Furthermore, a setting of 100 in Photo Mechanic is essentially "lossless" JPEG (assuming you also turn off chroma subsampling).  It isn't truly lossless because we still go through the YCC & DCT math that JPEG uses, and therefore there will be some occasional rounding errors.  But we are talking about a very small number of pixels having one of their RGB values changed by no more than one level (of 256 levels).  You will not be able to detect any compression artifacts and if you subtract a quality 100 (no chroma subsample) JPEG saved with PM with a TIFF file you will see they are nearly identical.  However, these JPEG files will be quite large (for a JPEG), especially if you start with an image that is noisy or already heavily compressed, because JPEG will reproduce every bit of that noise and original artifacting.  And if you start with a heavily compressed (e.g. mosquito noise) JPEG and apply a crop whose top-left origin does not align on an 8x8 boundary (especially if the offsets are odd), then this exacerbates the problem of exactly encoding those artifacts at quality 100.

The quality setting controls the quantization of the 12-bit intermediate YCC values.  This is essentially the divisor Q, and this number must be a whole number (i.e. 1, 2, 3, 4 etc not something like 1.2).  The lower the quality the larger the divisor, therefore the smaller the number that is recorded in Huffman encoding, therefore the fewer number of bits required to encode these values, therefore the smaller the file size.

PM uses the following quantization table based on quality setting:

   200, 175, 155, 140, 132, 123, 114, 105,  98,  93,   // 0-9
    86,  78,  70,  63,  56,  49,  43,  39,  35,  32,   // 10-19
    30,  29,  28,  27,  26,  25,  24,  23,  22,  21,   // 20-29
    20,  19,  19,  18,  18,  17,  17,  16,  16,  15,   // 30-39
    15,  14,  14,  13,  13,  12,  12,  11,  11,  10,   // 40-49
    10,   9,   9,   9,   8,   8,   8,   7,   7,   7,   // 50-59
     6,   6,   6,   6,   6,   5,   5,   5,   5,   5,   // 60-69
     4,   4,   4,   4,   4,   4,   4,   4,   4,   4,   // 70-79
     3,   3,   3,   3,   3,   3,   3,   3,   3,   3,   // 80-89
     2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   // 90-99

As you can see, quality settings 90-99 are all the same exact quality, and same with 80-89 and 70-79.  The quality setting of 100 is a divisor of 1 or no quantization (meaning we encode all 12 bit intermediate values without loss - the only "loss" being rounding errors).

Again, please don't make comparisons of JPEG quality between Photo Mechanic and Photoshop - they are different beasts.

HTH.

--dennis

Offline bstich

  • Newcomer
  • *
  • Posts: 24
    • View Profile
Re: JPEG Size
« Reply #6 on: October 27, 2022, 01:39:40 AM »
Thank you very much Dennis for this precise answer. Benoît