5

I recently put the SD card of my camera in a Windows 7 PC and start browsing pictures on it. I noticed some were not aligned correctly and use rotate feature included in Windows Photo Viewer in order to view them as I wanted.

What I didn't know is that when rotate feature is used, it also overwrite the picture when pressing next or previous button resulting in a possible loss of quality (which is in my opinion a bad idea, app should at least warn user of what will happened when using such a feature).

After that, I re-inserted the SD card back in my camera and bad surprise happened : the rotated picture could not be previewed anymore. Instead, i got a black screen saying "Incompatible JPEG format". Other files (untouched) are still working ok.

To try to understand what happened I opened a JPEG file from camera and one generated on windows 7 in a hex editor. Here is the difference :

The camera JPEG files have a Exif tag in them (with 0xE1 in header). Other JPEG files (Windows 7) have first a JFIF tag in it, followed by a Exif tag (with 0xE0 in header).

So if i understand it well, both are JPEG files, but using a different internal format.

Here is my question : is it possible (using some tool) to convert JFIF files to Exif format ?

I understand that original camera files have been reencoded and thus lose some quality (getting originals back is impossible). What i want know if convert them from JFIF back to Exif (without a second loss of quality if possible...)

2
  • Dumb question, but if you rotate them back, do they show? My assumption on first reading was that they aren't the right size for the camera screen as I had an old camera that did that. If you took a landscape photo and put it back as a portrait, it would give an error.
    – Duall
    Dec 24, 2012 at 1:14
  • 1
    Note, JPEG data can be rotated (in 90-degree increments) and mirrored losslessly. I'd expect that the rotate feature in the Windows Photo Viewer does lossless rotations, without re-encoding the images.
    – Wyzard
    Dec 26, 2013 at 16:59

2 Answers 2

4

The JPEG standard has a number of file compliancy variations which were created for specific reasons, two types which are often used are EXIF and JFIF.

Although both files are classed as JPEG files and appear on a computer with the JPEG extension the difference is due to the supplementary data which is added to the original image during processing in camera or in computer. This data is usually stored in an areas that are called "APPn" (where "n" is the number 0,1,2 etc).

Most imaging software applications can open both types of JPEG file, but most digital cameras can only display EXIF format images. When a EXIF file is opened in an imaging program like Photoshop and then saved, the file is changed into a JFIF format with a result that the image can no longer be opened by the camera and the shooting data is lost.

EXIF

The EXIF format was created for use in digital cameras, the APPn stores information such as the state of the camera when the image was recorded (shutter, aperture white balance etc).

JFIF

The JFIF variation is commonly used in the imaging industry, most software applications save files in this format. JFIF uses the APPn to store information such as copyright and captions (IPTC text) and profile information for colour management (icm data).

You can try ExifTool and run this command, but it is possible that your camera will be unable to display the images, as the shooting data is lost.

exiftool "-exif:all<jfif:all" "-thumbnailimage<jfif:thumbnailimage" FILE

7
  • I tried what you said, but it doesn't fix the problem. Thanks anyway.
    – tigrou
    Dec 23, 2012 at 14:25
  • 1
    Try this command exiftool "-exif:all<all" "-thumbnailimage" DIR this should fix all files in the current directory
    – user181734
    Dec 23, 2012 at 16:13
  • I try that one but doesnt fix anything. I'm using utility correctly because after executing command the tool write "1 picture sucessfully updated" and it creates on the disk a second file named "picturexxx.jpg.original"
    – tigrou
    Dec 24, 2012 at 11:31
  • See updated answer
    – user181734
    Dec 24, 2012 at 14:18
  • 1
    Worked great for me! Thank you! Photoshop should fix their image file parsers to cope.
    – Bruce
    Jun 8, 2017 at 20:52
1

From the Compatibility section of the Wikipedia article JPEG File Interchange Format:

The newer Exchangeable image file format (Exif) is comparable to JFIF, but the two standards are mutually incompatible. This is because both standards specify that their particular application segment (APP0 for JFIF, APP1 for Exif) must be the first in the image file. In practice, many programs and digital cameras produce files with both application segments included. This will not affect the image decoding for most decoders, but poorly designed JFIF or Exif parsers may not recognise the file properly.

Based on the above, you can convert a JFIF to a Exif by simply removing the APP0 segment/marker with your hex editor and adding an APP1 segment/marker (e.g. using another tool that manipulates Exif data). Or, you could simply add the Exif data and you should still be able to open the image in most programs.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .