.jpg vs. .png

FloydV

Donating Member
Registered
I said in a former post that .jpeg pics suffer more loss every time the image is saved (not copied). Here is a bit about .png files that are loss less:

Comparison with JPEG
Composite image comparing JPEG and PNG: notice artifacts in JPEG versus solid PNG background.

JPEG (Joint Photography Experts Group) can produce a smaller file than PNG for photographic (and photo-like) images, since JPEG uses a lossy encoding method specifically designed for photographic image data. Using PNG instead of a high-quality JPEG for such images would result in a large increase in filesize (often 5–10 times) with negligible gain in quality.

PNG is a better choice than JPEG for storing images that contain text, line art, or other images with sharp transitions. Where an image contains both sharp transitions and photographic parts a choice must be made between the large but sharp PNG and a small JPEG with artifacts around sharp transitions. JPEG also does not support transparency.

JPEG is a worse choice for storing images that require further editing as it suffers from generation loss, whereas lossless formats do not. This makes PNG useful for saving temporary photographs that require successive editing. When the photograph is ready to be distributed, it can then be saved as a JPEG, and this limits the information loss to just one generation. That said, PNG does not provide a standard means of embedding Exif image data from sources such as digital cameras, which makes it problematic for use amongst photographers, especially professionals. TIFF does support it as a lossless format.

JPEG has historically been the format of choice for exporting images containing gradients, as it could handle the color depth much better than the GIF format. However, any compression by the JPEG would cause the gradient to become blurry, but a 24-bit PNG export of a gradient image often comes out identical to the rasterization of the source vector image, and at a small file size. As such, the PNG format is the optimal choice for exporting small, repeating gradients for web usage.
 
What does it mean when a digital photograph "suffers from generation loss"? I think I get the general idea, but what exactly happens to the photograph? Does it lose pixels?

When I take a photograph with my digital camera, do I have the ability to save it as something other than a JPEG?

Interesting read; where's it from?
 
I use the .busa format. It downloads and opens much quicker! Though most of it is a blur.
Posted via Mobile Device
 
What does it mean when a digital photograph "suffers from generation loss"? I think I get the general idea, but what exactly happens to the photograph? Does it lose pixels?

When I take a photograph with my digital camera, do I have the ability to save it as something other than a JPEG?

Interesting read; where's it from?

Yes. Information is lost in the form of fewer pixels. And JPEG continues to throw away more information each time you save it. So, if you touch up a photo and save it, and then decide to change something else and save it, each time more detail is lost. So, if you work on a file, say in Adobe Photoshop, you want to rename the file so you always have the original untouched. Then when you change your copy, you want to get all the changes into one file and save it once.

Most digital cameras have a RAW format which saves each picture as a huge file with all the information the camera can capture in it. What you give up is the number of photos that can be stored in camera memory. Also, you need a RAW editor to work on this format. That is usually bundled in the software that comes with the camera.

I learned about this in a Photoshop class. But, the info I posted is from wikapedia. You can look up JPEG or PNG and get a lot more information.
 
Last edited:
Compression uses predictability to replace longer strings of bits with shorter ones. Using text to illustrate a simple example:
"queen". we know by rule "q" is always followed by "u" so we do not need to store it. so if we store "qeen" we've reduced the storage by 20% (4 bites instead of 5) and have not lost any information since we will always add a "u" whenever we read a "q" from the file.

Low frequency images can also be compressed very well without loss. Take a picture of chess board with 10 pixel x 10 pixel squares for example. The first line of the white block can be represented as 10(White) which we can symbolize as "A". The first line of the black block can be represented as 10(Black) which we can symbolize as "B". The first line in the image of the chess board can be represented as 4(A;B) [4 repetitions of 10 wite pixes follwed by 10 black pixels]. To get the first row of blocks woud be 10 copies of the first line. 10(4(A;B)) which we can symbolize as "C". The second row of the board is 10(4(B;A)) which we can symbolize as "C". We've reduced the size of the chess board image from 6,400 bytes to a formula
A=10(White);B=10(Black);C=10(4(A;B));D=10(4(B;A));C;D;C;D;C;D;C;D

This formula does not grow much as the size of the image grows. If the chess board image was increased in size where each of the blocks is 1,000 pixels x 1,000 pixels, the image would grow to 64,000,000 bytes, while our stored formula would only grow by 8 bytes:
A=1000(White);B=1000(Black);C=1000(4(A;B));D=1000(4(B;A));C;D;C;D;C;D;C;D

It is possible to compress high frequency images (like most photographs) somewhat without any loss, but not much. To make high frequency images more predicable to allow for greater compression, pixels need to be thrown away before creating the fsymbolized version which is stored. Anything lost before symbolization cannot be recovered later. Since the images can't be predicted like the chess board example, the complexity in the compression engines is how to determine how to symbolize the image so that the least number of pixels need to be lost to achieve a desired compression ratio. You need to throw fewer pixels away for a 4:1 compression ration than for a 8:1 ratio.

I don't know if that answered any questions or not, but it was good to revive some of the old theory I haven't used for years.
 
Last edited:
Well, why not just use the RAW format and fix it all?

some cameras don't (didn't) have this option. it was seen as being overkill for the casual user.

plus, it allowed them to offer a more expensive camera with this additional feature.
 
Compression uses predictability to replace longer strings of bits with shorter ones. Using text to illustrate a simple example:
"queen". we know by rule "q" is always followed by "u" so we do not need to store it. so if we store "qeen" we've reduced the storage by 20% (4 bites instead of 5) and have not lost any information since we will always add a "u" whenever we read a "q" from the file.

Low frequency images can also be compressed very well without loss. Take a picture of chess board with 10 pixel x 10 pixel squares for example. The first line of the white block can be represented as 10(White) which we can symbolize as "A". The first line of the black block can be represented as 10(Black) which we can symbolize as "B". The first line in the image of the chess board can be represented as 4(A;B) [4 repetitions of 10 wite pixes follwed by 10 black pixels]. To get the first row of blocks woud be 10 copies of the first line. 10(4(A;B)) which we can symbolize as "C". The second row of the board is 10(4(B;A)) which we can symbolize as "C". We've reduced the size of the chess board image from 6,400 bytes to a formula
A=10(White);B=10(Black);C=10(4(A;B));D=10(4(B;A));C;D;C;D;C;D;C;D

This formula does not grow much as the size of the image grows. If the chess board image was increased in size where each of the blocks is 1,000 pixels x 1,000 pixels, the image would grow to 64,000,000 bytes, while our stored formula would only grow by 8 bytes:
A=1000(White);B=1000(Black);C=1000(4(A;B));D=1000(4(B;A));C;D;C;D;C;D;C;D

It is possible to compress high frequency images (like most photographs) somewhat without any loss, but not much. To make high frequency images more predicable to allow for greater compression, pixels need to be thrown away before creating the fsymbolized version which is stored. Anything lost before symbolization cannot be recovered later. Since the images can't be predicted like the chess board example, the complexity in the compression engines is how to determine how to symbolize the image so that the least number of pixels need to be lost to achieve a desired compression ratio. You need to throw fewer pixels away for a 4:1 compression ration than for a 8:1 ratio.

I don't know if that answered any questions or not, but it was good to revive some of the old theory I haven't used for years.

I can tell you are my sort of "get into the details guy". My main point was to tell people that JPEG throws away more detail each time it is saved. So, if you edit an image repeatedly, saving each time, your pic becomes more and more lossy. PING files don't do this.

I think most people would not want to use RAW format because of the storage problems.
 
I was one of the original team of 3 that developed this: Wavelet Scalar Quantization - Wikipedia, the free encyclopedia

So image compression is something I hold dear :)

My hat (or helmet) is off to you. I am always surprised at how many people can be on a bike forum who are much brighter than I would have thought. I'm not trying to insult anyone, but the idea of someone who works with digital compression and also rides insanely fast bikes amazes me.
 
Back
Top