Like you, I find the Extract Embedded Jpg feature extremely useful.
Be aware that the quality of the the jpg will vary depending on:
1. Has the image been edited in NX2 (or NX)? If so, the jpg embedded in the nef file will be full resolution and excellent jpg compression. Typically, a nef file size will increase after NX2 editing because the quality jpg compression has gone from good to excellent. For a D40, this may be a 2-3mb file size increase.
2. For some older cameras, like the D2h, the original (unedited by NX2) jpg image is not full resolution. After NX2 editing, the embedded jpg will be full resolution.
The file size expanding when using Save As can be explained as follows: Let's say NX2 embeds a jpg compressed in excellent quality and that this coincides with a PM equivalent of 95 quality. At this quality level, there is some minor (visually lossless) compression going on. When you use PM to Save As at quality 100, the image is loaded from the nef (using the embedded jpg) and then saved without (or very, very little) compression. The result is a slightly larger file size.
Deven
Thanks Deven,
Yes, this agrees with my observations too. When I open an original D40 NEF straight from the camera into PM it is much smaller than the same NEF after being opened and resaved as NEF by NX2. I had assumed that this was due to NX2 replacing the original embedded JPEG (from the camera) with it own version which was higher quality. Now you have confirmed this. Thanks.
With regard to the JPEG size increasing I think the question has still not been answered, perhaps because I did not explain it carefully enough. Of course if we make two JPEG versions of the same source image at, say, 95 and 100% respectively we will get two different file sizes, but that analogy does not exactly fit what is going on here. In this case only NX has the original RAW data to create its JPEG rendering. PM takes this JPEG, decodes it back to an RGB image, and then re-encodes it. This decode/encode process can not possibly add information to the image that was not there in the original JPEG, but the bit count has increased. This means it is taking more bits to convey the same information. It is not a higher quality JPEG, just a higher bit-count JPEG.
Since posting my question I did some reading on JPEG and I did learn something that may explain the increased file size. It seems the JPEG standard uses quantizer step sizes that are set according to the target quality (i.e., 0 through 100). And it appears that all these levels may still be used even if there is no discernible information in the image to warrant them, which leads to wasted bits.
For example, say an original RGB (TIFF) image has 30MB of data. Suppose you encode this as a low quality JPEG (say 20%) and get a file that is 1MB. If you then decode this JPEG to an intermediate RGB image and then re-encode this image at a high quality setting (say 100%) you may get a JPEG that is 5MB in size, but the result will never look any better than the 1MB version because the original loss of information can never be recovered. On a smaller scale I assume this is what is happening in PM when "save as JPEG" leads to more bits than "extract JPEG".Fortunately, the quality is already so high that it is likely never to make any difference in the finished result. My interest is really just a matter of curiosity.