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?

  • 9
    To check - are you asking if 'given a jpeg, can we find out if it was once a raw file and then converted' or are you asking 'I believe that RAW is a type of jpeg and want to check if this jpeg is RAW'? (either are reasonable beginner questions, and both are easy to explain, but in different ways) – user67208 Dec 3 '18 at 14:06
  • 3
    It's been said here at Photo.SE many times before but it bears repeating: There's no such thing as a raw image. There is only raw data. Whatever you are viewing on the screen when you open a raw file is a conversion of that data. A light curve must be applied. Demosaicing must be applied to the monochromatic luminance values from each pixel well. Color balance, tint, contrast, etc. are all being applied to the image by the application with which you view it. – Michael C Dec 4 '18 at 17:41
  • 2
    @MichaelClark By that logic there is no such thing as a JPEG or PNG image, which makes the distinction mostly useless. – pipe Dec 4 '18 at 18:39
  • 4
    JPEGs and PNGs have a single correct way to display them. They are already in RGB form and have a color space designated in their metadata. There is only a singular way to correctly display a JPEG or PNG. A raw file is not RGB, it is not gamma corrected, it has no color/white balance, no black points or white points set, etc. There are a near infinite number of ways a raw file can be interpreted. If one merely converts the linear luminance values of a raw image file to a raster format, one gets a blob of mostly black nothingness with splotches of dark gray here and there. – Michael C Dec 5 '18 at 0:28
  • 4
    @phuclv each encoder might create a slightly different JPEG file. But once there is a file, there is one correct way to convert it back to RGB values! – Josef says Reinstate Monica Dec 5 '18 at 10:29


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.

| improve this answer | |
  • 3
    "RAW isn't a single format, but rather a collective name for image files that contain data straight from the sensor." Well put. In fact, it is a pet peeve of mine that there is a pattern of capitalizing the word "raw" as if it was an initialism. As you say, it is a word that describes general or vendor specific partially processed file type(s) that represents data as it is captured by a sensor and engine combination. Like I said, pet peeve. I'm learning to live with my struggle. – user31502 Dec 5 '18 at 15:35
  • 2
    Oh dear. Well, we are going to have to disagree on this. I'll continue to use the word "raw" for the concept and the initialism or acronym for specific interpretations of raw. You can tell I'm serious because I used the word "initialism". – user31502 Dec 5 '18 at 16:02
  • 2
    It's true. I'm mostly joking, which I hope is clear. I think for me, the sticking point is how I get the information across in prose. And when talking about raw formats in general, or even a specific raw format that doesn't overload the term with a .RAW file extension I find it maybe less obscuring to just use the English word without any decoration. It's a deliberate attempt at lessening noise or jargon, especially in the written word. – user31502 Dec 5 '18 at 16:20
  • 1
    @hobbs, I'm not sure why you seem to be disagreeing with me on this when I've made it clear that I am in agreement with everything you've said. I'm saying it is a peeve of mine that we use the term raw in all-caps as if it was an initialism when it is, as I've already said, decidedly not. Maybe, but only maybe, would it make sense when referring to a specific raw file format that uses the ".RAW" extension, but maybe only in that context. If I'm arguing for anything, I'm arguing for clarity in prose. Others may argue for convention. These are both valid approaches. – user31502 Dec 5 '18 at 17:35
  • 1
    And, yes. I recognize I've confused initialism and acronym in some of my earlier comments. I'll reconsider my peeve maybe, since clarity and accuracy in prose is a lost cause and start referring to the format as "R.A.W." This has the advantage of not only being wrong, but annoying the other people who's peeve is no whitespace after the punctuation in abbreviations. (And I may have misused an apostrophe right then, so now I'm throwing my hands up in despair over this whole "written language" thing.) – user31502 Dec 5 '18 at 17:40

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".

| improve this answer | |
  • 5
    The JFIF criterion doesn't work for the JPG from my three Canon cameras (Ixus 150, 450D, 70D) or my smartphone (Moto G). No JFIF in there, Linux file says: IMG_1385.JPG: JPEG image data, Exif standard: [TIFF image data, little-endian, direntries=11, description= , manufacturer=Canon, model=Canon IXUS 150, orientation=upper-left, xresolution=200, yresolution=208, resolutionunit=2, datetime=2018:04:17 14:52:46, GPS-Data], baseline, precision 8, 4608x3456, frames 3. Conversely, you find the JFIF in a RAW file if there is an embedded JPG thumbnail. – xenoid Dec 3 '18 at 14:17
  • 5
    @xenoid: file isn't a text/hex editor. Try xxd (but you probably don't want to dump the whole file, so I recommend limiting it (e.g. xxd -l 1024 <file>)). – Cornstalks Dec 3 '18 at 14:42
  • "file" will only be available on a unix or cygwin box usually, or on a mac, not on a standard windows box? – rackandboneman Dec 3 '18 at 14:45
  • 1
    I tried grep -i JFIF *.JPG on whole directories. The only hits are on files I edited (so the image editor does use the JFIF format). I suspect this is because cameras use the Exif format and not the older JFIF format. – xenoid Dec 3 '18 at 14:50
  • 7
    @xenoid is right, Exif images have the string "Exif" instead of "JFIF" at the beginning of the first chunk. Some cameras or programs may create hybrid JFIF/Exif image files that contain both chunks, but those don't really comply with the Exif standard. – Ilmari Karonen Dec 3 '18 at 21:00

Trivial ways to recognize whether a file is a RAW or a JPEG:

  1. File ending: JPEGs end with .jpg or .jpeg, RAWs end with different strings (e.g. .cr2, .nef, .arw, ...)

  2. File headers: Usually, formats put some signature in there that tells programs.

  3. Size: Given the same size and motive, even quality 100 JPEGs will be significantly smaller. (e.g. 20 MiB vs 5 MiB)

  4. 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. ThisIsNotAPNG.png)

  5. 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'.

| improve this answer | |
  • 1
    At a guess... perhaps more relevant to the OP is that whilst a RAW can be re-processed into a JPG [or PNG etc] you cannot do it the other way, you cannot reprocess a jpg back to a raw. – Tetsujin Dec 3 '18 at 10:57
  • 1
    @Tetsujin That is true, but it makes a terrible mess of identifying formats :-) – flolilo Dec 3 '18 at 10:58
  • 3
    I'm thinking there's a comprehension issue at root - "Once I've a JPEG photograph image file, how can I find out whether it is a RAW file or not?" ...at that point you don't have a RAW, you have a JPG. A RAW can contain a JPG, but a JPG cannot contain or be transmuted into a RAW. – Tetsujin Dec 3 '18 at 10:59
  • I understand relation between JPG and RAW. However, I thought that probably RAW files might be getting saved in .jpg extension. Can that be the case? Actually I was experimenting with a device where it seems to be claiming to support RAW images, however I do not see any option of that, which led me to believe that probably although the image is getting captured in .jpg file it might be actually RAW file by default internally. I was trying to investigate whether my belief was true or not. – Temp O'rary Dec 3 '18 at 11:40
  • 1
    @Tetsujin since other (better) answers have appeared, I opted to only add it as a fifth way to recognize JPEG vs. RAW - I started with an explanation of RAW vs. JPEG, but it got out of hand :-D – flolilo Dec 6 '18 at 14:36

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:

  1. Open the shutter (mechanical: slide first curtain away, digital: start saving the data stream from the chip)
  2. Acquire the scene
  3. Close the shutter (mechanical: slide second curtain over the chip, digital: stop saving the data stream)
  4. Dump the data acquired to the buffer
  5. Process the image to jpeg using pre-set options
  6. Show preview to the screen.
  7. Save the image
  8. Clear buffer memory.

If the 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 jpg or jpeg
| improve this answer | |

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?
RAW in ACR vs JPG in ACR
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?


| improve this answer | |

Your Answer

