Go Back   Steve's Digicams Forums > Digicam Help > Newbie Help

Reply
 
Thread Tools Search this Thread
Old Apr 4, 2009, 9:17 AM   #1
Member
 
July's Avatar
 
Join Date: Mar 2009
Posts: 39
Default

The first thing I read about JPG was the dire warning that it s a lossy format. That every time a JPG is saved and resaved, the pixels are resampled and some quality is lost. Now, through a link at Steve's, I have read that, when resizing a picture into higher size, professional photographers find that resampling repeatedly in a number of small steps gives a better result than resampling in one big step. The apparent conflict suggests that I don't understand resizing and resampling, or the impact of post processing in general.

I imagine the digital image as pixels in the different squares on a piece of graph paper. Resizing without resampling would be like taking the content of each square on the graph paper and reproducing them faithfully onto a piece of graph paper with the same number of vertical and horizontal lines but drawn to different scale. The data would not be altered.

Each time a JPG image is re-saved, it is resampled, degrading the image. How many cycles of re-saving is tolerable is an open question. Renaming it only changes the filename but does not result in resaving/resampling - I hope.

Resampling I imagine to require alteration to the content of each square on the graph paper. The software measures the content of the original grid and forces the result into a different grid by combining the data from a number of adjacent squares in the original to arrive at the best estimate for a square in the new grid. The data would be altered, and the result would not be as accurate as the original.

Without resampling I imagine moving the paper on which the pixels lie closer or further from my eye, or perhaps viewing the piece of paper at an angle. Resampling I imagine is like studying a drawing with great care, putting the drawing out of sight, and then re-creating the picture from memory.

My guess is that neither resizing without resampling, nor cropping, alter the underlying data. I also conclude that resampling (including the likes of straightening) alters data, and lossy resaving throws away data. Histogram adjustments and the like retain the "position" of the pixels but alters their content. The latter category of editing, depending on the type and the intensity of the adjustment, may alter not only the color, saturation etc. but also the apparent sharpness of the image – but may be reversible. The effects of sharpening I am not at all clear on.

I would much appreciate advice on both the conceptual understanding of the above issues and their practical application in amateur use. I have some familiarity with both Photoshop Elements and Paint Shop Pro.

July is offline   Reply With Quote
Sponsored Links
Old Apr 4, 2009, 12:06 PM   #2
Senior Member
 
TCav's Avatar
 
Join Date: Sep 2005
Location: Washington, DC, Metro Area, Maryland
Posts: 13,543
Default

JPEG images are compressed, and the compression is not lossless the way that ZIP files, for instance, are able to reconstruct the exact contents of the original file. When you save a JPEG image, it is compressed and some detail is lost. When you open it again, the image is uncompressed, but the detail that was lost the first time it was saved will still be gone. When you save it again, even if you only do a "Save As...", the image is compressed again, and some more detail is lost. If you keep doing this over and over again, you will end up with an 18% gray frame.

So, if you are editting an image (JPEG or not), if you aren't done, but need to quit, you should save the image in a lossless format like Photoshop's PSD file.

Resampling is different. When you change the resolution of a 3000 x 2000 pixel image to 1500x1000, every 4 pixels in the original image are combined into a single pixel in the resulting image (sort of.) This is the kind of resampling that is used to display a high resolution image (say 4272 x 2848 )onto a monitor with a resolution of 1440 x 900. Pixels are averaged in order to reproduce the image as faithfully as possible onto an output device with a lower resolution. That's downsampling.

Upsampling is going the other way. When you print a 3000 x 2000 pixel image on an printer with a resolution of 600 dpi, without any resampling, the print will be 5 x 3 1/3 inches. If you want a larger print, the image must be resampled in order to fill the extra space with something. So a single pixel in the original imagewill be split into 4 pixels in the resulting image (sort of.)

Upsampling in a single pass, such as what happens in the process of printing,produces some excellent results. But upsampling in multiple passes produces even better results, though it is time consuming. And as long as the resluts of each pass are stored in a lossless format, like PSD, no detail is lost.

So resampling and compression are seperate techniques. Resampling can suppliment, even enhance detail, while compression will always reduce detail.
TCav is offline   Reply With Quote
Old Apr 4, 2009, 12:40 PM   #3
Member
 
July's Avatar
 
Join Date: Mar 2009
Posts: 39
Default

TCav, thank you for clarifying compression vs. downsampling/upsampling. That is very heplful. For the next step in my learning, I'm trying to get my head around maintaining image quality when resampling that results in fractional conversions, e.g., crudely, from a 5x5 matrix into a 7x7 matrix. It seems to result in some "rounding errors". Also, when straightening an image and saving the result as JPG, the pixel map needs to be recalculated. Hmm.

From your comment touching on PSD, it might mean that in lossless file formats the original image is stored intact and the changes recorded separately, either within the edited image file itself or in a companion, sidecar file. If so, I can see that re-editing a PSD would impact only the companion data, without loss of data. But that would mean that upsampling in a number of steps would be no better than doing it in a single step. Therefore la ossless format uses a process that I can't imagine at the moment.

Perhaps I am just overly curious for my skill level.
July is offline   Reply With Quote
Old Apr 4, 2009, 3:13 PM   #4
Senior Member
 
TCav's Avatar
 
Join Date: Sep 2005
Location: Washington, DC, Metro Area, Maryland
Posts: 13,543
Default

July wrote:
Quote:
For the next step in my learning, I'm trying to get my head around maintaining image quality when resampling that results in fractional conversions, e.g., crudely, from a 5x5 matrix into a 7x7 matrix. It seems to result in some "rounding errors". Also, when straightening an image and saving the result as JPG, the pixel map needs to be recalculated.
That is true for most image editting operations. Straightening, adjusting perspective, correcting optical distortons, etc., all require recalculating the entire pixel map. And it needs to be done whether the image is saved as a JPEG or not. And any operation that requires an analog to digital conversion involves rounding errors. Your camera performs a rounding error at each pixel when you take a photo. And when you amplify the signal by increasing the ISO setting, you're amplifying the effects of those rounding errors.

July wrote:
Quote:
From your comment touching on PSD, it might mean that in lossless file formats the original image is stored intact and the changes recorded separately, either within the edited image file itself or in a companion, sidecar file. If so, I can see that re-editing a PSD would impact only the companion data, without loss of data. But that would mean that upsampling in a number of steps would be no better than doing it in a single step. Therefore la ossless format uses a process that I can't imagine at the moment.
No. The lossless file formatsstore the image as it results from the editting operations performed in theapplication. A PSD file is like a RAW file for Photoshop.It contains the exact output of the application. You can't open a PSD file, select "Undo", and go back to what you had before your last editting session. "Lossless" means that the file contains the exact image you were working with before you saved it; the process of saving did not cause any detail to be lost.
TCav is offline   Reply With Quote
Old Apr 4, 2009, 5:50 PM   #5
Member
 
July's Avatar
 
Join Date: Mar 2009
Posts: 39
Default

These two points are now clear in my mind, and will be helpful in many ways in my enjoyment of digital photography. For one thing, I have found straightening so easy that I have expended little effort in keeping the camera level. Thanks to your advice, my work will now improve.

Further, even knowledge that I may not be able to apply directly at this level of skill will prepare me for the next step in learning, whatever that may be.

Again, many thanks, TCav
July is offline   Reply With Quote
Old Apr 5, 2009, 5:33 AM   #6
Administrator
 
Join Date: Jun 2003
Location: Savannah, GA (USA)
Posts: 22,378
Default

See JPEG Images: Counting Your Losses by Mike Chaney.

Make sure to check out Mike's Qimage product line, too. This software includes very sophisticated interpolation algorithms designed to optimize output for specific printer models.

JimC is offline   Reply With Quote
Old Apr 5, 2009, 8:19 AM   #7
Member
 
July's Avatar
 
Join Date: Mar 2009
Posts: 39
Default

A fine article on JPEG, and good introductions to Steve's Tech Corner and to Qimage.
Thank you, Jim
July is offline   Reply With Quote
Old Apr 13, 2009, 1:19 AM   #8
Senior Member
 
Join Date: Oct 2003
Location: Indian Rocks Beach, FL
Posts: 4,036
Default

July wrote:
Quote:
But that would mean that upsampling in a number of steps would be no better than doing it in a single step.
The technique of stepped interpolation or SI to upsample an image can give good results. I also find it counterintuitive. I have actions set up in Photoshop to do SI in 5% increments and often compare that to Genuine Fractals upsamples. Sometimes the SI upsamples look better than GF. There is no intermediate storage between steps in SI.

Something to keep in mind is that many things that make an image look better slightly degrade the image. Sharpening adds artifacts. Contrast reduces the dynamic range. You always lose detail in a resample, although the detail lost can be too little to see in a single resample. So SI is degrading the image, but it is doing it in a way that makes it look better when viewed normally or printed. It seems to work best with a simple bicubic resample.

Changing print size and resample are different things. The print spooler distributes whatever pixels you give it. If you set a large print size and realize your PPI is going to be low you can upsample. It doesn't help much. SI seems to introduce resample artifacts that give the impression of a slightly sharper image. I've never read a good explanation of how or why. Most people do a little extra sharpening after an upsample regardless of method.


slipe is offline   Reply With Quote
Old Apr 13, 2009, 7:20 AM   #9
Administrator
 
Join Date: Jun 2003
Location: Savannah, GA (USA)
Posts: 22,378
Default

July:

Expanding on what Slipe went into, Mike Chaney has an article here that touches on some of the common methods used for resampling:

Interpolation Revisited

JimC is offline   Reply With Quote
Old Apr 13, 2009, 8:59 AM   #10
Member
 
July's Avatar
 
Join Date: Mar 2009
Posts: 39
Default

slipe, JimC, many thanks for your expert assistance. As a newbie I do understand some of the advice. I cut-and-paste to messages into a word document where I can return to them as my skills progress.

I am attempting to become a modestly equipped and modestly skilled candid photographer. Perhaps I will be able to derive a bit of pocket-money from it to pay for at least a part of the cost of my truly enjoyable toys.

Regards,

July
July is offline   Reply With Quote
 
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -5. The time now is 7:39 PM.