I have some files that should be jpegs, but the computer doesn’t seem to think so. They won’t open. I tried adding “.jpg” or “.jpeg” to the because that worked for me once in the past with another file type. No luck.
Is there any way to tell the computer that these are jpeg files without opening them up?
If changing the extension doesn’t open them as jpegs, they aren’t jpegs. Period. (Assuming you are using a MS OS, etc. Note: providing such info is a real big help.)
Try looking at the first few bytes of the files in ascii. If they don’t start with “JFIF” then they aren’t jpegs. If they do, then they are corrupted.
There are several freebie “file identifier” programs out there that will tell you what type a file is.
It could be if the file was sent as an attachment that it got messed up/corrupted/incomplete somehow.
Otherwise, you can try forcing an “open with” - try opening it with Internet Explorer, for example. Or download the freeware IrfanView which supports many different graphics formats.
Not quite, it tells the computer what type of file format to expect. Which MS Oses use to determine which app to run and lets the app decide on how to interpret the bytes. Now if the file extension is jpg when it should be bmp, the OS and the viewer are expecting the jpg headers and other format details. When it trys to map the bitmap into that format it receive erroneous values and assumes that the file is corrupt. It won’t, for the sake of ease and safety, start guessing the format.
Think like a Mac user (even if you’re on a PC): remove the file extension*, then drag 'n drop the mystery file onto Paint Shop Pro or Photoshop or whatever app you use to open graphic files.
*If you’ve got that silly setting turned on that hides file extensions, disable it.
While file extensions are useful for identifying file formats in things like Windows Explorer, it’s not how applications usually interpret files. Most files have a magic number in the first few bytes which identifies it with a particular format. Typically, when an application opens the file it reads this number to verify the file format is valid.
If you’re pretty sure they’re valid images, get a program that supports a variety of image formats (like Gimp) and open it with the File->Open dialog. Then save it in your preferred format.
If it won’t open, chances are it’s corrupt. Hope this helps.
I took a jpg file, changed the extension to xls.
Lo and behold, excel tried opening the file and gibberish showed up.
Now it is true that if a program supports a variety of file types… like Quicktime can read mov, gif, jpg, etc… it’ll read it if the .jpg was renamed to .mov.
That’s the problem with conventions - sooner or later some jokers going to come along that doesn’t adhere to the convention. Hence my weasel-wording of “typically” and “most”.
In the case of excel, I guess it doesn’t use magic numbers. I tried a quick google search for “excel magic number” and “ms word magic number” and couldn’t find anything. I wouldn’t be surprised if they assumed the extension corresponds to the file format - after all, that’s the way their OS works.
But in the specific example I’ve given, the application (Gimp) will use magic number to determine the file format. So if the OPs file is a valid image (in a supported format) then my advice holds - open it via File->Open and save it in your favorite format.
I know how it all works, I just prefer to answer questions in the same way they are posed. The OP wanted to know how to “tell” the computer what sort of file it was. My answer was consistent with that way of looking at things because I don’t see anything wrong with it in this case. Many people view their computers as a unified whole and don’t separate the OS from applications and in this particular case what difference does it really make? The file is either valid or corrupt and if it isn’t opening no matter what file extension it has, then it is most likely corrupt.
If you want to get into the philosophy of it, then I would submit that unless you think in ones and zeros, any concept you have of how your computer works is an approximation and when it comes to approximations, it only matters that they work in getting you to where you want to go. Digital pragmatism. If thinking that your computer “knows” things and that you can “tell it” something gets the job done, then that is a useful way to think about it. Sometimes you have to learn new ways to think about things because your current concept doesn’t help you. In other words, sometimes the reason you can’t find an answer is because you are asking the wrong question. That’s when you look for a new point of view. I didn’t see that the OP’s problem was based on his/her concepts of how it all works, so I didn’t address that issue.
I agree with you on the importance of approximations. I was just implying that the aproximation was a little too strong and therefore misleading. Thinking that “the extension makes the file what it is” is wrong, philosophically or not. To approximate, if I have a book on earthworms that has a torn off cover, putting on a cover from an engineering book does not change the contents of the book, nor its intended target. It may be that I think it is an engineering book, likened to the OP, but the approximation of the cover makes the book is completely false. When I open the cover expecting to see engineering stuff I will only see earthworm gibberish.
Just as an aside, the “magic” number for TIFF files is 42. The TIFF spec defines it as an “arbitrary but carefully chosen value”. I have always wondered if this was some sort of inside joke/nod to “the Hitch Hikers Guide”. (Hey, maybe FordPrefect knows! )
You learn something new everyday. “Magic Numbers” huh? What will they think of next.
So, I think I will go and check my jpeg files really have got a magic number in them. I drop one in Notepad and the first line says…
ÿØÿà … then a couple of boxes … then JFIF … then a bunch more boxes.
What kind of magic number is ÿØÿà? Has someone sneeked a ÿØÿà file on to my computer and it’s only pretending to be a jpeg? And what is the deal with the boxes. They must be magic boxes, because when I paste them into this note they just disappear.
You learn something new, and you realise how little you know.