What camera?

General cycling advice ( NOT technical ! )
Tom Richardson
Posts: 772
Joined: 25 Jun 2007, 1:45pm

Post by Tom Richardson »

I didn't want to start an argument about jpeg compression. Theres plenty of info out there on the subject (see tutorials in www.luminous-landscape.com). I've found that they will take editing but not repeated editing but they shouldn't need repeated editing so it shouldn't be a problem so long as youre aware of it.

I think camera quality depends on what you want to do with the pics. I've managed to get good A3 sized prints from 2mp jpegs, but not often and for that job I would use a digital slr. I use an old 5mp nikon compact for cycle touring. Prints come out good in sub A5 sizes and they look even better on a comuter screen. For general use, unless youre planning an exibition, I don't think that there is anything to be gained by the cost, weight and lumbering file sizes that you get from an expensive camera.

I wouldn't go too cheap though. I've never tried a sub £100 digital camera so can't speak from experience but If i wanted one for £50 my first port of call would be e-bay.
User avatar
patricktaylor
Posts: 2303
Joined: 11 Jun 2008, 11:20am
Location: Winter Hill
Contact:

Post by patricktaylor »

Tom Richardson wrote:... I've found that they will take editing but not repeated editing but they shouldn't need repeated editing so it shouldn't be a problem so long as youre aware of it ...

Aware of what?
stewartpratt
Posts: 2566
Joined: 27 Dec 2007, 5:12pm

Post by stewartpratt »

patricktaylor wrote:I was demonstrating that saving a jpeg over and over again in itself does not degrade the quality of the image (contrary to what a lot of people seem to think). As for editing an image, it depends on what is being done to it. Again, editing an image in itself does not degrade it.


It can affect it, but yes, resaving the exact same image with the same compression settings will give eitehr no reduction or a small reduction in quality.

The point is though, that most people don't do that. If you load an image, tweak the colour balance, then save it, reload it, play with the contrast, save it, and so on - you will lose quality if you'reusing JPEG compression.


I'm not sure what you mean there. You're saying the compressed image does contain fewer colours. A compressed image contains less information, so what information can it lose other than colour? (assuming the number of pixels is the same)


The loss of information is simply a loss of quality: the data is no longer accurate. Resolution and sharpness are lost, noise is added. Consider a pure black and white image of the 'yin and yang' symbol. When compressing it, the edges may be smeared. This adds colours to the data, but loses information. Likewise, the compression may not be able to perfectly reproduce a flat area of colour: the white of the symbol may be a mottled pale grey.

The JPEG algorithm in fact does both of these things.

To go down the inevitably doomed route of an analogy, think of an artist painting on canvas with a decorator's brush. He'll get it done quicker, and he can use the exact same colours he would with a fine brush, but he can't get the detail. You can't reproduce the Mona Lisa with a 2" brush, but you can get something that looks quite like it from a distance.

Take the example of your small crop. Look in the top right and detail has been lost in the pale area. Now look to the dark area on the left and you'll see paler pixels appearing - noise which is a result of the compression algorithm.

A simple reduction of the color resolution (or space) does not do this. (If you want a demostration, re-export your original image as a GIF - a format which is limited to 256 colours and whose compression works losslessly.)
User avatar
patricktaylor
Posts: 2303
Joined: 11 Jun 2008, 11:20am
Location: Winter Hill
Contact:

Post by patricktaylor »

stewartpratt wrote:... If you load an image, tweak the colour balance, then save it, reload it, play with the contrast, save it, and so on - you will lose quality if you'reusing JPEG compression ...

Yes, but it's the compression that causes the loss of quality, not adjusting the colour or contrast in themselves. Obviously if an image is compressed repeatedly it will degrade further and further.

... The loss of information is simply a loss of quality: the data is no longer accurate. Resolution and sharpness are lost, noise is added ...

Because the image will contain less colours and the software compensates accordingly.

... Take the example of your small crop. Look in the top right and detail has been lost in the pale area. Now look to the dark area on the left and you'll see paler pixels appearing - noise which is a result of the compression algorithm ...

Sorry... which image?

... re-export your original image as a GIF - a format which is limited to 256 colours and whose compression works losslessly.

Here is the original image saved as 16 colour GIF:

Image

Quality is lost because there are only 16 colours, but the quality is lost in a different way than if it was a highly compressed JPEG.
emergency_pants
Posts: 292
Joined: 26 Aug 2008, 3:40pm

Post by emergency_pants »

JPEG is designed to exploit known limitations of the human eye,
notably the fact that small color changes are perceived less accurately than small changes in brightness. Thus, JPEG is intended for compressing images that will be looked at by humans.

Getting up close to an image and examining it at a pixel level is not the point of jpg compression, as is getting picky about whether any data or quality is lost.

Broadly speaking, opening a file multiple times and saving it at the same compression value will not degrade the perceived quality of the image. However, this is not true for some editors, as Tom's case proves so, as he says, it's something to be aware of.

As pointed out, this is rarely ever going to happen because no one is likely to open a file and re save it without editing it in any way.

There's nothing wrong with saving after each edit process. So, for example, it's possible to apply a brightness change, save, contrast change, save, colour change, save, crop, save, etc. etc. etc. and the image quality will not degrade with each save in any perceived way. As I said... you could examine the image at pixel level after each save (why would you do that unless you're trying to prove some sort of argument or you're a-nal) and see some extra artifacts but the perceived quality is not affected.

Multiple "save for web" publishing will possibly cause extra degradation of image quality over multiple saves, so that one's best left for the final publish save.

jpg will not reduce the number of colours available within the image, so a 16-bit image remains a 16-bit image and has the full squillionbillionziliion colours available. Unlike the gif compression example above.

jpg is not as good at compressing sharp edges. In these cases it actually adds pixels, so that it can calculate a compression more successfully. That's why you may see some artifacts along edges in jpg files and some of these extra pixels may be allsorts of new, different colour values.

It will also add pixels to very plain areas, for the same reason... though these are much less perceiveable than the artifacts created for high contrast edges.

As I said.. it's all about how the image quality is perceived after compression, so changes in pixel values, on a pixel level are always probable but totally negligible, given that no-one in their right mind is going to open an image and edit it with 400 separate processes, with a save in between.

A file compressed at 100% could potentially be three times larger than a file saved at 95%. With absolutely no perceived (or actual?) loss of image quality.

Our company rule of thumb is to save all screen-based jpg files off at 70% for p[ublishing as this strikes a very good image quality/file size balance. Thsi does depend on the image being saved... so an image saved with lots of contrasty edges is not going to have as good a perceived compression as a softer composition. Greater compression is fine if a smaller file size is needed.

All this may have been said already, so apologies if it has.

Hope that helps in some way or other. :)
Last edited by emergency_pants on 10 Feb 2009, 12:32pm, edited 2 times in total.
stewartpratt
Posts: 2566
Joined: 27 Dec 2007, 5:12pm

Post by stewartpratt »

patricktaylor wrote:Yes, but it's the compression that causes the loss of quality, not adjusting the colour or contrast in themselves. Obviously if an image is compressed repeatedly it will degrade further and further.


Er, yes. I think that's what I said. If you use the lossless JPEG mode, all is well. If you perform a cycle of open/edit/save with lossy compression, you will lose data quality.

patricktaylor wrote:
... The loss of information is simply a loss of quality: the data is no longer accurate. Resolution and sharpness are lost, noise is added ...

Because the image will contain less colours and the software compensates accordingly.


No. Not because the image contains fewer colours. You can lose data quality by adding colours to the image. Here's an example - there should only be 4 colours in that image, but as you can see there are many more. The JPEG artifacts add noise.

The maniuplation of the number of colours in the image - whether increased or decreased - is a result of the compression. It is not the means by which compression is achieved.

patricktaylor wrote:
... Take the example of your small crop. Look in the top right and detail has been lost in the pale area. Now look to the dark area on the left and you'll see paler pixels appearing - noise which is a result of the compression algorithm ...

Sorry... which image?


The last one - the crop of the highly compressed image. Compare this with one of the crops of the high-quality image above.

patricktaylor wrote:Quality is lost because there are only 16 colours, but the quality is lost in a different way than if it was a highly compressed JPEG.


That's precisely my point..! This is the type of quality loss caused by color reduction. JPEG does not perform color reduction.
pigman
Posts: 1917
Joined: 11 Jan 2007, 12:23pm
Location: Sheffield UK

Post by pigman »

looks like your query has expired Si. Another "prove you wrong" debate is up and running ....
User avatar
patricktaylor
Posts: 2303
Joined: 11 Jun 2008, 11:20am
Location: Winter Hill
Contact:

Post by patricktaylor »

emergency_pants, I agree with what you say (and possibly with what stewart is saying - maybe we're saying the same thing differently).

My rule of thumb is to process an image (as required) and to 'Save For Web' at compression between 75% and 50%, depending on how the percentage affects the image visually on-screen, and without zooming in.

I have some JPEG images that are ten years old and which have been edited and saved countless times, but not compressed. There has been no loss of quality in terms of degradation caused by all that editing and saving. Sometimes it's worth 'proving' that this is the case by zooming in to view the pixels close up.

I have no doubt that poor images off a poor camera can often be improved with software. I thought that might be of interest to Si (the OP) when choosing a cheap one.

stewartpratt wrote:... If you perform a cycle of open/edit/save with lossy compression, you will lose data quality.

Yes. I'm talking about open/edit/save without compression.

When a JPEG is saved using compression, the format looks for pixels of a similar colour and removes those that are 'not needed' and replaces them using 'best guess' - that is how the file size is reduced: less information and less demand on the computer's memory and speed. The effect of this can be the addition of unwanted artefacts or noise that give a grainy impression, but I believe compression is compression of the colour range. An image with more and stronger colours tends to be larger in file size than one with less, just as a monochrome version of an image is smaller in file size than the same image in colour.

stewartpratt wrote:... Take the example of your small crop. Look in the top right and detail has been lost in the pale area. Now look to the dark area on the left and you'll see paler pixels appearing - noise which is a result of the compression algorithm ... The last one - the crop of the highly compressed image. Compare this with one of the crops of the high-quality image above.

Yes, that's the noise we agree on!

@pigman, this is an "establish the facts" debate.
stewartpratt
Posts: 2566
Joined: 27 Dec 2007, 5:12pm

Post by stewartpratt »

I think we're getting close to agreement, yes :)

patricktaylor wrote:The effect of this can be the addition of unwanted artefacts or noise that give a grainy impression, but I believe compression is compression of the colour range. An image with more and stronger colours tends to be larger in file size than one with less, just as a monochrome version of an image is smaller in file size than the same image in colour.


The thing with compression is that different algorithms have different effectiveness with different data.

Take the antique Windows BMP format as an example - it has the option of run-length encoding (RLE) compression. This is a lossless algorithm (you get the exact same data after decompression) but it is next to useless with most photographic images because of the way it works (it relies on horizontal bands of identical color - pretty good for a screen grab of a Word document but no good for a picture of a tree).

Now... RLE encoding doesn't affect colours at all, not one bit - put as many as you like in one end and you'll get the same out. But you'll get vastly greater compression if you have large blocks of constant colour than if you have a constantly varying image.

JPEG is similar in that it can achieve greater compression rates where there is relatively gradual variation than where there is high-frequency and/or high-amplitude variation.

Grabbing a couple of photos to illustrate:

Image
Image

The first has 256 colours and is 30.4kb in size. The second has 19,116 colours and is under 14kb in size. Both were saved from the same application with the exact same compression settings.

The thing is that whilst the number of colours in the input image does affect the final file size, the reduction of individual color values is simply not something that JPEG compression inherently does. For instance, I've just taken that 30kb photo of the cross rider, colorized it red (so it still has 256 colours, but it's not a greyscale) and saved it with higher compression. The resulting file is 7kb, and the decoded image contains 13,629 colours.
emergency_pants
Posts: 292
Joined: 26 Aug 2008, 3:40pm

Post by emergency_pants »

ooo! oooooo! It's like a fuzzy Wikipedia in here. Lovely. :D We should create a CTC knowledgebase! Amongst ALL the forum members, I wonder how much collective, useful knowledge there is!

(I wonder how much totally uselss knowledge there is too! :lol: )
brianleach
Posts: 622
Joined: 14 Jul 2007, 2:10pm
Location: Winchester, Hants

Post by brianleach »

When an image is saved in JPEG format, the process of encoding it involves compression. The level of compression which is applied can be set - images can be strongly compressed to save space or weakly compressed to retain quality. When you saved, whatever application you were using would have been using a higher compression level than whatever originally saved the images. You'll have also lost image quality in the process (zoom in around the edge of an area of constant colour - eg where trees meet blue sky - and you should see the artifacts). Some applications will give you the option to set the compression when saving JPEGs.

When you rename a file, the actual content of the file is unchanged.


Thanks for that Stewart. You live and learn.

Brian
User avatar
patricktaylor
Posts: 2303
Joined: 11 Jun 2008, 11:20am
Location: Winter Hill
Contact:

Post by patricktaylor »

stewart, thanks. I never actually knew that 'lossless' referred to decompression, not compression. I think that is maybe why we seemed to be talking at cross purposes.

I'm in the habit of keeping two versions of all my web images: the source file and the optimised file (for the web). And my opinions are based on practical application and what I see for myself. It has never occurred to me that anyone would try to decompress an optimised JPEG, although I have often seen them dimensionally enlarged beyond their original pixel size.

@emergency_pants :lol:
kwackers
Posts: 15643
Joined: 4 Jun 2008, 9:29pm
Location: Warrington

Post by kwackers »

Hey don't forget guys - digital cameras usually have a RGRB format - two green, a red and a blue.
But importantly they're side by side - so an black and white edge that falls partly across the four pixels should in theory have a colour band on each side.
In practise cameras mess around with the image to try to remove this.

Not that I want to stir anything up, just think it's worth pointing out. :twisted:
stewartpratt
Posts: 2566
Joined: 27 Dec 2007, 5:12pm

Post by stewartpratt »

patricktaylor wrote:stewart, thanks. I never actually knew that 'lossless' referred to decompression, not compression ... It has never occurred to me that anyone would try to decompress an optimised JPEG, although I have often seen them dimensionally enlarged beyond their original pixel size.


Hm, from reading that I think you may be misunderstanding what decompression is.

Image source data is normally an 8-bit value, ie 0..255, for each of the red, greed and blue channels at each pixel. So each pixel takes 3 bytes to represent.

When you save an image as a JPEG, it takes the source data and encodes it. As part of that encoding, the file size is reduced in comparison to that which would be produced by saving the source data. That's the compression.

When the file is opened - be that by your image editor or your web browser, or whatever - the data is decoded. From the small file size, a block of data is produced in the computer's memory which is once more a 3-bytes-per-pixel chunk. This is the decompression. It happens every time the file is read and used to display an image.

Decompression is not (if this is what you were thinking) a means of restoring image quality which is lost during encoding. This absolutely can't be done (broadly speaking).

The term "lossless" refers to the whole process: encoding and decoding that image data. If after encoding and decoding, ie saving and loading, the result is exactly what went in, it's lossless. Any single tiny discrepancy and it's lossy.

kwackers wrote:Hey don't forget guys - digital cameras usually have a RGRB format - two green, a red and a blue.
But importantly they're side by side - so an black and white edge that falls partly across the four pixels should in theory have a colour band on each side.


Good grief man, we've gone way overboard on JPEG compression, don't get us into Bayer sensors and raw formats as well! There's two BIG cans of worms there.
Tom Richardson
Posts: 772
Joined: 25 Jun 2007, 1:45pm

Post by Tom Richardson »

patricktaylor wrote:
Tom Richardson wrote:... I've found that they will take editing but not repeated editing but they shouldn't need repeated editing so it shouldn't be a problem so long as youre aware of it ...

Aware of what?


silly me - i should have said
I've found that they will take editing but not repeated editing but they shouldn't need repeated editing so it shouldn't be a problem so long as youre aware that they will take editing but not repeated editing

(I also said that I didn't mean to start an argument so don't have a go at me or else I will print your message out and hang it on the nail in the outside midden)
Post Reply