When RAW Apple's rendering is disabled my understanding is that the "Save As JPEG" option will decode the embedded JPEG preview in a RAW file and then re-encode it at the quality level set by the slider.
It appears this can actually lead to an increase in file size in cases where the original JPEG is a basic quality preview and the PM quality slider is in the middle or upper end. Since the quality can never be increased in this conversion the new larger size is a waste of bits and misleading because it's file size may lead people to think it is a high quality image.
Is there a way to avoid this; that is, to make sure the new JPEG never exceeds the size of the original.
Sure. You can instead use the Extract JPEG previews from RAW photos command on the Tools menu. You will be getting the exact JPEG data (not re-encoded at all.)
-Kirk
The Extract JPEG is a great feature, but my question is specifically about the "Save As JPEG" feature.
Here is an example of why I am interested in this.
Suppose you have a contact sheet full of NEF images, some of which you've edited in NX and some of which you have not. For a D40, Images that have been edited have roughly 4MG JPEGS in them and images that have not been edited have 600KB JPEGS in them. I'd like to be able to save all the JPEGS at about a 2 MB size, but I don't want to end up inflating the size of the little 600KB images. They should stay as they are. Sure I could select these separately and extract, but it would be nice to be able to apply a single operation to the whole sheet.
Does the JPEG encoding algorithm you use allow for a target size or max size? or is quality the only parameter you have to play with.
No, there is only quality.
Let me explain how the process works internally. First the image is decoded to a bitmap in memory. At this point it is taking just as much space in memory for a very low quality JPEG as it would for a high quality JPEG. Once decoded, quality doesn't matter to the size in memory as it is no longer compressed. Then various operations are performed (Convert to sRGB, rotation, scaling, cropping, sharpening, etc.) Finally the image in memory is encoded as a JPEG with the quality setting you chose.
The save code has no knowledge of the original JPEG size, or for that matter whether the image being saved was a JPEG at all. It could have been a PSD, TIFF, PNG, etc. and not a JPEG at all.
I hope this explains things a bit better.
-Kirk