I'm a much like beginner level, so pardon me if this is a very basic silly question. Once I've a JPEG photograph image file, how can I find out whether it is a RAW file or not?
Once I've a JPEG photograph image file, how can I find out whether it is a RAW file or not?
If you have a JPEG file, then it is not a RAW file.
RAW isn't a single format, but rather a collective name for image files that contain data straight from the sensor. RAW files need to be processed in order to convert them to more general-purpose image formats like JPEG or PNG. Most cameras can do that processing themselves, so that they save their images in JPEG format, or they can write the RAW data into a file for processing on your computer. Either way, if you know your file is a JPEG file, then by definition it is not a RAW file.
Unless somebody frivolously renamed a RAW file, it will never have a file name with the .jpg/.jpeg/.jfif extension. Typical extensions for RAW files will be .raw, .arw (Sony), .dng (Android phones etc.), .nef (Nikon), .cr2 (Canon)...
A JPEG file will always have the text JFIF somewhere near the start if opened in a text or hex editor, among the hieroglyphs (warning: if opening a non-text file in a text editor, NEVER save!). It is not impossible but extremely unlikely for a RAW file to have that.
If you cannot see file name extensions in Microsoft Windows, uncheck "Folder Options"/"Hide extensions for known file types".
Trivial ways to recognize whether a file is a RAW or a JPEG:
File ending: JPEGs end with
.jpeg, RAWs end with different strings (e.g.
File headers: Usually, formats put some signature in there that tells programs.
Size: Given the same size and motive, even quality 100 JPEGs will be significantly smaller. (e.g. 20 MiB vs 5 MiB)
Ask a program that knows. Most (if not all) programs use the file header or other file-analyses to determine a file's format. IrfanView even tells you when you have a JPEG with a wrong ending (e.g.
While you can save changes in the image's data to a JPEG by re-encoding it, you cannot e.g. draw a pencil line into a RAW and save it as a RAW - it will need to be a PSD, TIF, JPEG,...
There are more methods, but most involve some experience in this kind of stuff (e.g. a HEX-editor). If you want the answer to be low-level, then I would suggest to move it over to superuser.
Note: As it would make this answer very long, I have not considered container files. Most RAW files are containers - they include not only the RAW itself, but also a JPEG thumbnail. In my answer, I am only talking about the image file in the respective container - e.g. JPEGs in RAW containers are still JPEGs, and as far as I know, JPEGs are not container files and therefore cannot contain RAW 'images'.
RAW format, as generally called, is a group of file types with different suffixes. There are
*.raw files and proprietary files like
*.cr2 for Canon, for example and many others. I am a Canoneer so the following is based on my experience with my Canon.
Almost every manufacturer has their own RAW file format. Be also careful that some, Canon for sure, updates their RAW format so claim "All [Canon] image tools can open all [Canon] RAW images" is false. To preview a RAW file one need program that can process the the particular file format in particular version. Even mighty Photoshop have issues opening every RAW file.
RAW file is a dump of the data collected from the sensor plus data containing the camera setups. It is complete and lossless acquisition of data from the camera to the memory. RAW format is not an image format at all.
The cameras have built-in image processors (in case of Canon it is named DigicX) that interpret the RAW file to JPEG and show on screen and/or store to memory.
When one use any digital camera the internal workflow is:
- Open the shutter (mechanical: slide first curtain away, digital: start saving the data stream from the chip)
- Acquire the scene
- Close the shutter (mechanical: slide second curtain over the chip, digital: stop saving the data stream)
- Dump the data acquired to the buffer
- Process the image to jpeg using pre-set options
- Show preview to the screen.
- Save the image
- Clear buffer memory.
RAW mode is selected, the processor saves the data to image as-is in the body-specific format. If the
RAW+JPEG mode is selected, processor saves the data as-is to image.cr2 (for Canons) and processed image to image.jpeg. If
JPEG mode is selected only the processed image is saved and the raw data are lost forever.
That's why the RAW images are humongous when compared to true image formats. If you have 12MPx camera with 16bit depth the RAW file holds 12 000 000 * 16 bits of image information plus negligible amount of data keeping the setups.
JPEG is, on the other hand, file format dedicated to store images in files with reasonably size. It is based on lossy compression and benefits from the fact, that 50 shades of black are black to human eye, so why bother? It works similarly to
.mp3 audio format - it ignores the nuances the detector can distinguish but human senses can't. The level of ignorance is regulated by the compression quality.
How to identify RAW files?
- They are humongous
- Few previewers can process them
- The file extension is not
Raw image files contain enough data to create a near infinite number of interpretations of that data that will fit in an 8-bit jpeg file.¹ Anytime you open a raw file and look at it on your screen, you are not viewing "THE raw file." You are viewing one among countless possible interpretations of the data in the raw file. The raw data itself contains a single (monochrome) brightness value measure by each pixel well. With Bayer masked camera sensors (the vast majority of color digital cameras use Bayer filters) each pixel well has a color filter in front of it that is either red, green, or blue. For a more complete discussion of how we get color information out of the single brightness values measured at each pixel well, please see RAW files store 3 colors per pixel, or only one?
How the image you see on your monitor when you open a raw file will look is determined by how the application you used to open the file chose to interpret the raw data in the file to produce a viewable image. Each application has its own set of default parameters that determine how the raw data is processed. One of the most significant parameters is how the white balance that is used to convert the raw data is selected. Most applications have many different sets of parameters that can be selected by the user, who is then free to alter individual settings within the set of instructions used to initially interpret the data in the raw file.
If you are viewing an image on a screen, you are not looking at a raw file. What you are seeing is one possible interpretation of the raw data collected by a camera sensor. That interpretation may be one of several things:
- A jpeg produced by the camera using the raw data from the sensor and the camera's settings current at the time the image was captured.
- A jpeg preview image attached to a raw image file. The jpeg preview is also produced by the camera's internal processor using the camera's settings current at the time the image was captured. It is attached to the raw image file. This preview is normally what one sees when looking at an image on the LCD on the back of the camera when images are recorded as "raw" files. This preview is also what many photo applications will show when you are viewing thumbnails of raw image files on your computer.
- A fresh interpretation of the raw image data by a raw processing application such as Lightroom. Depending on your program settings, when you first open a raw image file, you may see either the jpeg preview image or you may see a new conversion of the raw data based on the current settings of the application with which you opened the image file. If you are seeing a fresh interpretation of the raw image data, it is still in a form that has had the same type of processing applied to it that a jpeg image produced with the same settings would have had.
The thing to keep in mind is that there is no single interpretation of a raw image file that is "THE raw image." Raw data must be processed to be viewed as any meaningful image. The settings of the various processing steps will determine how the result looks. There is no single inherently "correct" way to process the raw data. Things such as color temperature and white balance, contrast, white point, black point, etc. must be applied to the raw data collected by the sensor before it looks anything like what we call a "photograph."
For more detailed discussions about what the data in a raw image file is and is not, please see these other questions here at Photography at Stack Exchange:
RAW files store 3 colors per pixel, or only one?
Why can software correct white balance more accurately for RAW files than it can with JPEGs?
RAW in ACR vs JPG in ACR
While shooting in RAW, do you have to post-process it to make the picture look good?
Why do RAW images look worse than JPEGs in editing programs?
Why does my Lightroom/Photoshop preview change after loading?
Why is Lightroom changing all the settings on my imported RAWs?
¹ Sure, you could take a picture that contains a single pure color within the entire field of view. but most photos contain a wide variation of hues, tints, and brightness levels.