Ugly Hedgehog - Photography Forum
Home Active Topics Newest Pictures Search Login Register
Main Photography Discussion
What is JPEG??? (simplified)
Page 1 of 10 next> last>>
Jan 31, 2023 11:21:03   #
rlv567 Loc: Baguio City, Philippines
 
I have excerpted a few salient points from a very long Wikipedia article referenced in the “Why I shoot RAW” post, here, in order to simplify and make very clear the information about JPEG. The net of the whole article, simply put, is that JPEG is a means of reducing picture file size without degrading the resultant image too much – varying from imperceptible to the human eye, to unusable. It always selectively discards some of the original file’s information, that being done with regard to the perceptive capability of human vision. The resulting JPEG image, then, is not what actually was being “pictured”, but what the average human eye would “see”. This can be accomplished at varying (chosen) levels of degradation/picture quality.

“JPEG is a commonly used method of compression for digital images, particularly for those images produced by digital photography. The degree of compression can be adjusted, allowing a selectable tradeoff between storage size and image quality. JPEG typically achieves 10:1 compression with little perceptible loss in image quality.

JPEG uses a lossy form of compression based on the discrete cosine transform (DCT). This mathematical operation converts each frame/field of the video source from the spatial (2D) domain into the frequency domain (a.k.a. transform domain). A perceptual model based loosely on the human psychovisual system discards high-frequency information, i.e. sharp transitions in intensity, and color hue. In the transform domain, the process of reducing information is called quantization. In simpler terms, quantization is a method for optimally reducing a large number scale (with different occurrences of each number) into a smaller one, and the transform-domain is a convenient representation of the image because the high-frequency coefficients, which contribute less to the overall picture than other coefficients, are characteristically small-values with high compressibility. The quantized coefficients are then sequenced and losslessly packed into the output bitstream. Nearly all software implementations of JPEG permit user control over the compression ratio (as well as other optional parameters), allowing the user to trade off picture-quality for smaller file size.

The compression method is usually lossy, meaning that some original image information is lost and cannot be restored, possibly affecting image quality. There is an optional lossless mode defined in the JPEG standard. However, this mode is not widely supported in products.

Several alterations to a JPEG image can be performed losslessly (that is, without recompression and the associated quality loss) as long as the image size is a multiple of 1 MCU block (Minimum Coded Unit) (usually 16 pixels in both directions, for 4:2:0 chroma subsampling). Utilities that implement this include:
• IrfanView using "JPG Lossless Crop (PlugIn)" and "JPG Lossless Rotation (PlugIn)", which require installing the JPG_TRANSFORM plugin.
• FastStone Image Viewer using "Lossless Crop to File" and "JPEG Lossless Rotate".
• XnViewMP using "JPEG lossless transformations".
• ACDSee supports lossless rotation (but not lossless cropping) with its "Force lossless JPEG operations" option.

Image files that employ JPEG compression are commonly called "JPEG files", and are stored in variants of the JIF image format. Most image capture devices (such as digital cameras) that output JPEG are actually creating files in the Exif format, the format that the camera industry has standardized on for metadata interchange. On the other hand, since the Exif standard does not allow color profiles, most image editing software stores JPEG in JFIF format, and also includes the APP1 segment from the Exif file to include the metadata in an almost-compliant way; the JFIF standard is interpreted somewhat flexibly.

Many JPEG files embed an ICC color profile (color space). Commonly used color profiles include sRGB and Adobe RGB. Because these color spaces use a non-linear transformation, the dynamic range of an 8-bit JPEG file is about 11 stops.

If the image doesn't specify color profile information (untagged), the color space is assumed to be sRGB for the purposes of display on webpages.

Many of the options in the JPEG standard are not commonly used, and most image software uses the simpler JFIF format when creating a JPEG file, which among other things specifies the encoding method. Here is a brief description of one of the more common methods of encoding when applied to an input that has 24 bits per pixel (eight each of red, green, and blue). This particular option is a lossy data compression method.

First, the image should be converted from RGB (by default sRGB, but other color spaces are possible) into a different color space called Y′CBCR (or, informally, YCbCr). It has three components Y', CB and CR: the Y' component represents the brightness of a pixel, and the CB and CR components represent the chrominance (split into blue and red components).

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.

Due to the densities of color and brightness-sensitive receptors in the human eye, humans can see considerably more fine detail in the brightness of an image (the Y' component) than in the hue and color saturation of an image (the Cb and Cr components). Using this knowledge, encoders can be designed to compress images more efficiently.

The transformation into the Y′CBCR color model enables the next usual step, which is to reduce the spatial resolution of the Cb and Cr components (called "downsampling" or "chroma subsampling").
The human eye is good at seeing small differences in brightness over a relatively large area, but not so good at distinguishing the exact strength of a high frequency brightness variation. This allows one to greatly reduce the amount of information in the high frequency components.

Since the quantization stage always results in a loss of information, JPEG standard is always a lossy compression codec. (Information is lost both in quantizing and rounding of the floating-point numbers.) Even if the quantization matrix is a matrix of ones, information will still be lost in the rounding step.

Those who use the World Wide Web may be familiar with the irregularities known as compression artifacts that appear in JPEG images, which may take the form of noise around contrasting edges (especially curves and corners), or "blocky" images.

Ten to one compression usually results in an image that cannot be distinguished by eye from the original. A compression ratio of 100:1 is usually possible, but will look distinctly artifacted compared to the original. The appropriate level of compression depends on the use to which the image will be put.

In the last few years, due to the growing use of stereoscopic images, much effort has been spent by the scientific community to develop algorithms for stereoscopic image compression.”

Loren – in Beautiful Baguio City

Reply
Jan 31, 2023 11:28:25   #
Rongnongno Loc: FL
 
And? We are all well aware what a JPG is, it advantages and its pitfalls.

Reply
Jan 31, 2023 11:42:46   #
BigDaddy Loc: Pittsburgh, PA
 
Rongnongno wrote:
And? We are all well aware what a JPG is, it advantages and its pitfalls.

Judging from many of the opinions posted on the hog, (and all over the internet) I don't think the advantages and pitfalls are all that well known, and a LOT of what is "known" is false or massive exaggeration.

Reply
 
 
Jan 31, 2023 11:45:00   #
frankraney Loc: Clovis, Ca.
 
Rongnongno wrote:
And? We are all well aware what a JPG is, it advantages and its pitfalls.


It would not keep coming up if all was aware of what ajpeg is, it's advantages and disadvantages.

This is a very good article for those that have questions and want to learn. Is that not the purpose of uhh?

Smile a little, smell the coffee, and quit being so grumpy all the time.


Reply
Jan 31, 2023 11:46:31   #
Longshadow Loc: Audubon, PA, United States
 
BigDaddy wrote:
Judging from many of the opinions posted on the hog, (and all over the internet) I don't think the advantages and pitfalls are all that well known, and a LOT of what is "known" is false or massive exaggeration.


Reply
Jan 31, 2023 11:49:29   #
David Martin Loc: Cary, NC
 
rlv567 wrote:
It always selectively discards some of the original file’s information, that being done with regard to the perceptive capability of human vision. The resulting JPEG image, then, is not what actually was being “pictured”, but what the average human eye would “see”.

The JPEG would not be what the average human eye would see. Because the human eye and brain possess a greater dynamic range and would selectively adjust for dark and brightness in real time at the moment.

The human eye would see much more detail than the jpeg would contain: more detail in the highlights, more detail in the shadows, potentially a greater color range, and potentially a different white balance often most evident in the skin tones.

Though often irretrievably lost in the jpeg, the raw file still contains this information, which may be rescued by using post-processing software.

Reply
Jan 31, 2023 11:49:56   #
Retired CPO Loc: Travel full time in an RV
 
Thanks for the post, Loren. I knew the basics but not all the details. And this is the simplified version??? :-).

Reply
 
 
Jan 31, 2023 11:53:41   #
Bill_de Loc: US
 
BigDaddy wrote:
Judging from many of the opinions posted on the hog, (and all over the internet) I don't think the advantages and pitfalls are all that well known, and a LOT of what is "known" is false or massive exaggeration.




Know it alls assume everybody knows it all.

---

Reply
Jan 31, 2023 11:59:34   #
Longshadow Loc: Audubon, PA, United States
 
Retired CPO wrote:
Thanks for the post, Loren. I knew the basics but not all the details. And this is the simplified version??? :-).


Reply
Jan 31, 2023 12:04:27   #
frankraney Loc: Clovis, Ca.
 
Bill_de wrote:


Know it alls assume everybody knows it all.

---



Reply
Jan 31, 2023 12:17:47   #
BigDaddy Loc: Pittsburgh, PA
 
rlv567 wrote:
...
"Many JPEG files embed an ICC color profile (color space). Commonly used color profiles include sRGB and Adobe RGB. Because these color spaces use a non-linear transformation, the dynamic range of an 8-bit JPEG file is about 11 stops. "

Loren – in Beautiful Baguio City

This statement caught my eye. Anybody care to explain in more detail in a photographers level, not a light physicists?
11 stops of "dynamic range" seems a lot for a jpg, but I'm betting 11 stops is not the same 11 stops that come to my mind.

Perhaps one who already understands all there is to jpeg encoding?

Reply
 
 
Jan 31, 2023 16:40:59   #
CHG_CANON Loc: the Windy City
 
Shooting in JPEG is nothing to be ashamed of, but do it in private and wash your hands afterwards.

Reply
Jan 31, 2023 23:32:01   #
Rongnongno Loc: FL
 
 



Reply
Feb 1, 2023 04:45:44   #
... meanwhile somewhere in Norway Loc: none
 
CHG_CANON wrote:
Shooting in JPEG is nothing to be ashamed of, but do it in private and wash your hands afterwards.


Awesome reply! ... and for best results be sure to clean the bugs off of your UV filter...

Reply
Feb 1, 2023 07:30:30   #
Dalek Loc: Detroit, Miami, Goffstown
 
rlv567 wrote:
I have excerpted a few salient points from a very long Wikipedia article referenced in the “Why I shoot RAW” post, here, in order to simplify and make very clear the information about JPEG. The net of the whole article, simply put, is that JPEG is a means of reducing picture file size without degrading the resultant image too much – varying from imperceptible to the human eye, to unusable. It always selectively discards some of the original file’s information, that being done with regard to the perceptive capability of human vision. The resulting JPEG image, then, is not what actually was being “pictured”, but what the average human eye would “see”. This can be accomplished at varying (chosen) levels of degradation/picture quality.

“JPEG is a commonly used method of compression for digital images, particularly for those images produced by digital photography. The degree of compression can be adjusted, allowing a selectable tradeoff between storage size and image quality. JPEG typically achieves 10:1 compression with little perceptible loss in image quality.

JPEG uses a lossy form of compression based on the discrete cosine transform (DCT). This mathematical operation converts each frame/field of the video source from the spatial (2D) domain into the frequency domain (a.k.a. transform domain). A perceptual model based loosely on the human psychovisual system discards high-frequency information, i.e. sharp transitions in intensity, and color hue. In the transform domain, the process of reducing information is called quantization. In simpler terms, quantization is a method for optimally reducing a large number scale (with different occurrences of each number) into a smaller one, and the transform-domain is a convenient representation of the image because the high-frequency coefficients, which contribute less to the overall picture than other coefficients, are characteristically small-values with high compressibility. The quantized coefficients are then sequenced and losslessly packed into the output bitstream. Nearly all software implementations of JPEG permit user control over the compression ratio (as well as other optional parameters), allowing the user to trade off picture-quality for smaller file size.

The compression method is usually lossy, meaning that some original image information is lost and cannot be restored, possibly affecting image quality. There is an optional lossless mode defined in the JPEG standard. However, this mode is not widely supported in products.

Several alterations to a JPEG image can be performed losslessly (that is, without recompression and the associated quality loss) as long as the image size is a multiple of 1 MCU block (Minimum Coded Unit) (usually 16 pixels in both directions, for 4:2:0 chroma subsampling). Utilities that implement this include:
• IrfanView using "JPG Lossless Crop (PlugIn)" and "JPG Lossless Rotation (PlugIn)", which require installing the JPG_TRANSFORM plugin.
• FastStone Image Viewer using "Lossless Crop to File" and "JPEG Lossless Rotate".
• XnViewMP using "JPEG lossless transformations".
• ACDSee supports lossless rotation (but not lossless cropping) with its "Force lossless JPEG operations" option.

Image files that employ JPEG compression are commonly called "JPEG files", and are stored in variants of the JIF image format. Most image capture devices (such as digital cameras) that output JPEG are actually creating files in the Exif format, the format that the camera industry has standardized on for metadata interchange. On the other hand, since the Exif standard does not allow color profiles, most image editing software stores JPEG in JFIF format, and also includes the APP1 segment from the Exif file to include the metadata in an almost-compliant way; the JFIF standard is interpreted somewhat flexibly.

Many JPEG files embed an ICC color profile (color space). Commonly used color profiles include sRGB and Adobe RGB. Because these color spaces use a non-linear transformation, the dynamic range of an 8-bit JPEG file is about 11 stops.

If the image doesn't specify color profile information (untagged), the color space is assumed to be sRGB for the purposes of display on webpages.

Many of the options in the JPEG standard are not commonly used, and most image software uses the simpler JFIF format when creating a JPEG file, which among other things specifies the encoding method. Here is a brief description of one of the more common methods of encoding when applied to an input that has 24 bits per pixel (eight each of red, green, and blue). This particular option is a lossy data compression method.

First, the image should be converted from RGB (by default sRGB, but other color spaces are possible) into a different color space called Y′CBCR (or, informally, YCbCr). It has three components Y', CB and CR: the Y' component represents the brightness of a pixel, and the CB and CR components represent the chrominance (split into blue and red components).

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.

Due to the densities of color and brightness-sensitive receptors in the human eye, humans can see considerably more fine detail in the brightness of an image (the Y' component) than in the hue and color saturation of an image (the Cb and Cr components). Using this knowledge, encoders can be designed to compress images more efficiently.

The transformation into the Y′CBCR color model enables the next usual step, which is to reduce the spatial resolution of the Cb and Cr components (called "downsampling" or "chroma subsampling").
The human eye is good at seeing small differences in brightness over a relatively large area, but not so good at distinguishing the exact strength of a high frequency brightness variation. This allows one to greatly reduce the amount of information in the high frequency components.

Since the quantization stage always results in a loss of information, JPEG standard is always a lossy compression codec. (Information is lost both in quantizing and rounding of the floating-point numbers.) Even if the quantization matrix is a matrix of ones, information will still be lost in the rounding step.

Those who use the World Wide Web may be familiar with the irregularities known as compression artifacts that appear in JPEG images, which may take the form of noise around contrasting edges (especially curves and corners), or "blocky" images.

Ten to one compression usually results in an image that cannot be distinguished by eye from the original. A compression ratio of 100:1 is usually possible, but will look distinctly artifacted compared to the original. The appropriate level of compression depends on the use to which the image will be put.

In the last few years, due to the growing use of stereoscopic images, much effort has been spent by the scientific community to develop algorithms for stereoscopic image compression.”

Loren – in Beautiful Baguio City
I have excerpted a few salient points from a very ... (show quote)


After reading this, did I earn any college credits?

Reply
Page 1 of 10 next> last>>
If you want to reply, then register here. Registration is free and your account is created instantly, so you can post right away.
Main Photography Discussion
UglyHedgehog.com - Forum
Copyright 2011-2024 Ugly Hedgehog, Inc.