What is the difference between a JPEG and JPG file?

My older version of Photoshop (6.2) does not open files with the JPEG extension but it will open JPG files. I can just change the name of a file, change the extension that is, and open it just fine. Sometimes JPG files I make with photoshop and email to people can not be opened by them.

What gives?

No difference. Older software use the JPG extension because it conforms to the old DOS standard of three letter extensions. But the format of the files are exactly the same.

Nothing. But the pendantic in me insists on pointing out that JPEG is a compression format, not a file format: both are technically JFIF files, regardless of the extension.

You didn’t tell us whether you were on Mac or Windows, but in both cases I believe you can tell the OS and/or Photoshop that it can open additional extension types.

I using Windows. I have Picassa from Google and that will look at both but Photoshop will not. If I just got to OPEN and look a folder with both types of files only the JPG files can be opened. The JPEG files get an error message saying it isn’t a valid Photoshope file type.

Not sure how this would affect things, but it seems likely that your JPEG files came from a Mac or Unix user. I don’t think many Windows apps use the 4-character extension.

In fact, the only 4-character Windows extensions I deal with regularly are from another Adobe product, InDesign (.indd and .indt).

Some programmer was mildly silly. Each of the compression formats are handled differently. Thus, the first thing the program has to do is figure out what sort of file format is being used. There are a few ways of doing this, including opening the file and reading the first few bytes, but not all compression formats have a signature there, and for fairly boring reasons that might turn out to be a painful way of implementing the program. Instead, the programmer depended on the extension to determine the file type. So, there is a bit of code that looks something like this (written in pseudo code):

/* Check file extension */

if Extension == “BMP” OpenAsBMP
if Extension == “GIF” OpenAsGIF
if Extension == “JPG” OpenAsJPG

ShowCrypticErrorMessageClaimingWeveNeverHeardOfThisFileFormat();

The program has never heard or a “JPEG” file format, because for the longest time there 4 character filename extensions didn’t exist. In later versions a line reading something like

if Extension == “JPEG” OpenAsJPG

was probably added. Changing the extension to “JPG” causes your older version to admit it has heard of that file format. Renaming a “JPG” to a “GIF” would cause all sorts of problems, just in case you were curious.

I don’t know that’s what the problem is, but I’ve written programs to open files that acted differently based on what the extension was, so I am not completely guessing.

Not necessarily. I remember experimenting back with Netscape version 3, and it would not open any image file with an extension other than .gif, .jpg, .jpeg, or .jpe (the last three being equivalent; .jpe is what you get from truncating .jpeg down to 3 chars). But if you took a GIF file and gave it a .jpg name, Netscape would recognize, based on the .jpg name, that it was an image file that it knew how to open, but once it actually did, it would display it correctly as a .gif and label it as “GIF image 640 x 480”, or whatnot. I first noticed this when I saw an image on a webpage which purported to be a .jpg, but which was animated.

Hunh, that’s interesting. I’d have to look at the file formats to get any idea of why that might happen, and I’m way too lazy to do that over a completely acedemic question. Perhaps it would have been better to state that changing a .txt file (or .doc or .xls) would not allow the viewer to display it as an image file. The point was to explain why changing the extension would allow the viewer to display it, and what the limitations of that might be.

In the interests of figuring that out, I would note that I would be surprised if there was an internet browser that could not display .GIFs, even if .GIFs were not on the File/Open list. I would further note that .GIF was, until recently, a patented file format, and that a .GIF viewer was subject to restrictions. This might lead to the interesting situation where .GIF files viewing was supported, in that functionality existed within the program that allowed display of them, but it was not a file format that was listed as a supported type.

Finally, I meant only to explain what sounded likely in this case. It is completely possible that the developers of Netscape were not silly* in the way that the developers of Photoshop were.

  • I am reluctant to describe the apparent decision to decide on the file type by using the extension as “wrong” without having heard the justifications the development team used for using that approach. Also, although I am fairly sure that is why Photoshop 6.2 is acting the way it is, there are other possible reasons. It is a guess, but it is an educated one.