RAW files embedded JPG

Gewitty

Senior Member
My camera offers me a choice of capturing either RAW files or JPG. It also provides several ways to use the two card slots, one way being to store a RAW file of the image on one card and a JPG version on the other.

However, it is perfectly simple to extract the JPG embedded in every RAW file, so I'm wondering if there is any difference between a JPG recorded directly as a discrete file, or the one which is embedded in the RAW file.

If they are one and the same, then it seems pointless ever using anything other than the RAW capture option, since you are then getting the JPG version by default.
 

Horoscope Fish

Senior Member
My camera offers me a choice of capturing either RAW files or JPG. It also provides several ways to use the two card slots, one way being to store a RAW file of the image on one card and a JPG version on the other.

However, it is perfectly simple to extract the JPG embedded in every RAW file, so I'm wondering if there is any difference between a JPG recorded directly as a discrete file, or the one which is embedded in the RAW file.

If they are one and the same, then it seems pointless ever using anything other than the RAW capture option, since you are then getting the JPG version by default.
I don't really know if Nikon employs a reduced-size, low-res JPG for previewing or not. I would suggest you extract some of the embedded JPG's and compare the image resolution to the corresponding JPG image as recorded when shooting in JPG or RAW+JPG, and find out. Older Canon bodies embedded a one-quarter sized, low-res JPG that was something along the lines of 2MP, if memory serves. Newer Canon bodies (at least some, if not all) do embed a full-resolution JPG image in the CR2 file (the Canon equivalent of a .NEF file) but again, I'm not sure what Nikon does. I think you'll need to extract and compare for a definitive answer.
 

Gewitty

Senior Member
As an experiment, I first tried zooming into the JPG version (using XnViewMP), which initially fitted the screen at 13% size. I can zoom right up to 100% and still retain detail.

Then I tried exporting the file. First as a JPG (100%), which gave me a file of 5.9MB with an image size of 4000 x 6000 px.

Exporting as a PNG gave me a file of 13.7MB, again with an image size of 4000 x 6000 px.

And finally, exporting as a TIFF gave me a file of 72MB, with an image size of 4000 x 6000 px.

The original RAW file is 24.1MB, with an image size of 4008 x 6008 px.

Looking at some images taken as JPG's on the same camera shows a file size of 24MB, 6000 x 4000 px, which leaves me somewhat confused, since the RAW files should surely be larger than the JPG's?
 

Horoscope Fish

Senior Member
As an experiment, I first tried zooming into the JPG version (using XnViewMP), which initially fitted the screen at 13% size. I can zoom right up to 100% and still retain detail.

Then I tried exporting the file. First as a JPG (100%), which gave me a file of 5.9MB with an image size of 4000 x 6000 px.

Exporting as a PNG gave me a file of 13.7MB, again with an image size of 4000 x 6000 px.

And finally, exporting as a TIFF gave me a file of 72MB, with an image size of 4000 x 6000 px.

The original RAW file is 24.1MB, with an image size of 4008 x 6008 px.

Looking at some images taken as JPG's on the same camera shows a file size of 24MB, 6000 x 4000 px, which leaves me somewhat confused, since the RAW files should surely be larger than the JPG's?
6000 X 4000 pixels is 24 megapixels total whether we're talking JPG or raw file; which is full resolution for the D7200. The raw file *should* be considerably larger than the JPG if you look at file-size in megabytes. The raw file should be *about* 24-25MB, for instance, while the JPG version of the same photo I would expect to be somewhere around 5MB. Those last two numbers would vary depending on the individual shot, however; what I'm trying to put across is that the raw file should be several times larger than the JPG, even if not exactly five times larger etc. while at the same time being 24 megapixels. Hope I'm making sense here...

EDIT: Okay, having re-read your post a few times I would have to say the embedded JPG is full resolution: 24MP and roughly 6MB in file-size; this is roughly the file-size I would expect for a 24MP JPG image. The raw file is also full resolution (obviously) at 24MP and has a file-size of 24.1MB. This is also about what I would expect.

What leaves me a little confused is you say your JPG's are showing as being the same file-size, in megabytes, as your raw files, roughly 24MB... Both the JPG and the raw file should measure 24 megapixels, but the JPG should have a much smaller file-size (6MB is about right). So I'm confused if your JPG's are showing as being 6MB or 24MB.
 
Last edited:

WayneF

Senior Member
The Jpeg embedded into the RAW files is just a preview at not a full resolution version.

HTH


The embedded JPG is Large. It is what does the rear LCD optical zooming for enlargement. And some little programs that claim to open raw files only get the JPG from it.

The embedded JPG is a Large JPG, 7360x4912 pixels from a D800.

Extract with Exiftool:
exiftool -b -JpgFromRaw E:\camera\20160407\801_2097.NEF > test2.jpg
 

Gewitty

Senior Member
The confusion seems to arise from the way in which some software displays file sizes. Some actually refer to MB, when they actually mean MP.

Looking at a detailed Properties list for each file type, I see that images shot as RAW files have an actual file size of 27.66MB (29,000,049) and are 24MP resolution. Images shot as JPG's are 18.5MB (19,394,782) with the same resolution.

If I open an embedded JPG from within a RAW file, then save it directly, it has a file size of 5.9MB and a resolution of 24MP. Given that the camera uses its own software to convert the RAW file to an embedded JPG, it would seem that this does involve some significant compression.

Having got that far, I'm not quite so confused as I was previously and can see that the answer to my original question is that the embedded JPG is not a direct or adequate substitute for one shot directly.

Phew!
 

WayneF

Senior Member
The confusion seems to arise from the way in which some software displays file sizes. Some actually refer to MB, when they actually mean MP.

Looking at a detailed Properties list for each file type, I see that images shot as RAW files have an actual file size of 27.66MB (29,000,049) and are 24MP resolution. Images shot as JPG's are 18.5MB (19,394,782) with the same resolution.

If I open an embedded JPG from within a RAW file, then save it directly, it has a file size of 5.9MB and a resolution of 24MP. Given that the camera uses its own software to convert the RAW file to an embedded JPG, it would seem that this does involve some significant compression.

Having got that far, I'm not quite so confused as I was previously and can see that the answer to my original question is that the embedded JPG is not a direct or adequate substitute for one shot directly.

Phew!

I don't see why it is not adequate as a substitute, other then the extra effort to acquire it. That is the idea of it, the same image makes both the embedded and the JPG file. The extracted embedded image does not have Exif data (if from ExifTool), but the Exif is still in the raw file.


But image size is apples and oranges. MB is NEVER a way to compare image size. Image size is dimensioned in pixels.

RGB images (JPG and TIF for example) are typically 24 bit color (JPG color always is 24 bits), which is 3 bytes RGB per pixel.
So RGB 24 mp is 24x3 = 72 million bytes, every time (if 24 bit RGB color).

However (the confusion), then file data compression reduces the storage size, tremendously in JPG, and (optionally) significantly in TIF or raw files. JPG file size might be 1/4 to probably 1/8 to maybe 1/12 of data size. It has the dickens squeezed out of it (with losses, JPG compression is Not lossless). An image of the SAME pixel dimensions, but in larger JPG file, because it uses less compression, is a better quality file than a smaller JPG file of same pixel dimensions. Then, when the JPG file is opened into computer memory, it is always 3 bytes per pixel again (assuming standard 24 bit color, which all JPG is).

Raw files are NOT RGB data, and instead are Bayer GRGB 12 bits or 14 bits per pixel, so data size is more like 1.5 bytes per pixel. Again, file data compression reduces this number for a smaller file, significantly, but not as dramatically as JPG. We cannot view raw images, so any raw image presented for us to view and see has in fact been converted to RGB, for our RGB LCD monitors to be able to use. This is WHY the embedded JPG, to provide a means to see it on the camera rear LCD monitor, and also it is the histogram that we view. However, the JPG we convert later in raw software may not exactly match the same options specified in the embedded JPG that the camera converted (the idea is that we can make it even better).
 
Last edited:
The main reason I would think for recording both is when you are in a hurry to get photos out to someplace/someone. Post the JPG file directly with no post processing. For some of my shooting that would be acceptable. Like shooting progress shots for a contractor. Then take the best of those shots from the RAW files to post online for the public to see. The JPG only versions are processed in camera and can show the improved sharpness etc. I have no idea if the embedded jpg versions have the in camera processing.
 

Gewitty

Senior Member
Thanks for the replies guys. I think that pretty well explains everything, at least as far as I'm concerned.

One thing is certain: There are a lot of options available!
 

ryan20fun

Senior Member
The embedded JPG is Large. It is what does the rear LCD optical zooming for enlargement. And some little programs that claim to open raw files only get the JPG from it.

The embedded JPG is a Large JPG, 7360x4912 pixels from a D800.

Extract with Exiftool:
exiftool -b -JpgFromRaw E:\camera\20160407\801_2097.NEF > test2.jpg
I stand corrected :)
The reason I wrote that was because I found viewing the NEF with View NX-I it would initially show the embedded Jpeg and then process the NEF and display that.
 

WayneF

Senior Member
I stand corrected :)
The reason I wrote that was because I found viewing the NEF with View NX-I it would initially show the embedded Jpeg and then process the NEF and display that.

There are actually two other images in the raw file. One is a small RGB, not JPG, and my Exif says 160x120, for thumbnails.

One is Large JPG, same size as raw when extracted. This Large size allows full zooming on the camera LCD. And we can see (on rear LCD) that this has all the camera controls applied (white balance, Vivid, whatever) which the Raw file does not get any of (so this JPG is used for the histogram too). I cannot imagine that it is not exactly the same JPG image written to the card memory card.

And the NEF is there too of course.

---- EXIF ----
Subfile Type : Reduced-resolution image - 160x120 thumbnail
Image Width : 160
Image Height : 120
Bits Per Sample : 8 8 8
Compression : Uncompressed
Photometric Interpretation : RGB
Make : NIKON CORPORATION
Camera Model Name : NIKON D800
Strip Offsets : 123692
Orientation : Horizontal (normal)
Samples Per Pixel : 3
Rows Per Strip : 120
Strip Byte Counts : 57600
X Resolution : 300
Y Resolution : 300
Planar Configuration : Chunky
Resolution Unit : inches
Software : Ver.1.10
Modify Date : 2016:04:06 18:20:54
Artist :
Subfile Type : Reduced-resolution image - Large JPG same size as raw, when extracted
Compression : JPEG (old-style)
X Resolution : 300
Y Resolution : 300
Resolution Unit : inches
Jpg From Raw Start : 943104
Jpg From Raw Length : 2044635
Y Cb Cr Positioning : Co-sited
Subfile Type : Full-resolution Image - NEF raw image, actually comes out as 7360x4912
Image Width : 7424
Image Height : 4924
Bits Per Sample : 12
Compression : Nikon NEF Compressed
 
Last edited:
Top