Does defragging a HDD affect JPEG's?

Associate
Joined
18 Apr 2006
Posts
1,121
Location
Essex
Hello all,

Posted this under Photograhy forum as not sure which is the most relevant one so apologies in advance.

As the title suggests I was wondering if this is the case. As I understand it, everytime one opens and closes a .jpg you lose a little resolution as the file decompresses and then recompresses. Is this correct or does it only happen whenever you make a change and save the .jpg?

Either way, can I assume that merely copying the file up and down whilst the HDD is being defragged should NOT affect the .jpg?

Many thanks

NB
 
Defragging is non-destructive, viewing a jpeg is non-destructive.
Jpegs only get recompressed when you change and save the file.

:)
 
As I understand it, everytime one opens and closes a .jpg you lose a little resolution as the file decompresses and then recompresses.

that's complete pablum. jpgs only loose detail when re-saved with a lower-level of JPG compression.
 
that's complete pablum. jpgs only loose detail when re-saved with a lower-level of JPG compression.
I suppose you meant to say "a higher level of JPEG compression", but you're wrong either way (unless you're performing a lossless transform such as flipping or rotating in 90deg increments), although simply opening and closing the file won't make any difference of course.

http://en.wikipedia.org/wiki/Lossy_compression
 
Thanks everyone. So, Opening and closing and merely rotating along with copying/moving is fine. When I edit by changing colour or contrast or redeye etc or use a HIGHER compression there is some data/image degradation.

Many thanks for the prompt reply.

NB
 
When I edit by changing colour or contrast or redeye etc or use a HIGHER compression there is some data/image degradation.
There's some degradation when you re-save the file whether you use a higher or lower compression, or the same, it's just the nature of lossy compression. That's the point I was getting at. :)

The difference might not be noticeable, but it's there, and it will be compounded every time you save/re-encode the file. That's why you should save any edits using a lossless format as far as possible, and only use lossy JPEG for the final product when you (hopefully) won't need to mess with it any more.

It's the same principle as re-encoding a 128kbps MP3 at 320kbps - the algorithm will still throw away some of the data it deems dispensible, even though you're bumping up the bitrate (obviously it can't replace the data which was discarded during the original encoding).
 
do all image editing programms re-compress when you save them ?

Not all of them do i'm pretty sure.

It doesn't take any complicated processing to say that if the file extension is .JPEG, then it doesn't require compressing.
 
Last edited:
It depends on the format you save them in, not on the program as such.

If you save a file as a JPEG then, yes, the act of saving it will apply lossy compression, although it does have a lossless mode for some simple operations (which don't substantially alter the file content), as I mentioned.

Perhaps "compressing" is a bit misleading in this context - unless you specifically ask your program to reduce the image size or compress at a higher level, the file probably won't get any smaller and in fact may well even get bigger. That doesn't mean that lossy compression isn't being used though (if that makes sense).
 
Perhaps "compressing" is a bit misleading in this context - unless you specifically ask your program to reduce the image size or compress at a higher level, the file probably won't get any smaller and in fact may well even get bigger. That doesn't mean that lossy compression isn't being used though (if that makes sense).
To go along with CaptainCrash. I was wondering about the whole "compress" "decompress" that keeps being mentioned in this thread. If a JPG truly used that process, then the image would be exactly the same as the original every time it was opened. No, that's not how it works.

To explain in simple terms: With a BMP image, the information for each individual pixel is saved, well, individually. This can result in very large files and the file size can be calculated mathematically. For example, a 640x480 pixel image using 16-bit color (65000 colors) should be 614.4K (a little more or less depending on tagging the application might put in it). It doesn't matter what content is in that file -- it could be all white or be an extremely complex image, but it will still be the same size.

With a JPG, however, the software takes a look at a pixel, and all the pixels around it, and determines how close they are together. If 10 pixels are next to eachother and have the exact same attributes, the software says take this information, and repeat it 10 times. If 10 pixels have nearly the same info, it will average out the difference and repeat that (this is what causes the "block" affect you see in images). This information is written to disk and cannot be "decompressed". The image quality can never be recovered.

If we take that same 640x480 all-white image and save it as a JPG, it simply reads the information from one pixel and says repeat it 307,200 times. This can result in extremely small file sizes. Obviously this is just a quick summary of the algorithm. There is a lot more to be considered, but hopefully it works as an example.

You can compress and decompress a BMP image quite effectively, using your normal ZIP operation. This way you get a smaller file size for sharing through email and such, but will not lose any quality.

PNGs, TIFs, GIFs, etc are totally different though. But you can read more about those on the wiki if interested.
 
Last edited:
Back
Top Bottom