Remove TYPE codes to avoid possible conflicts

Aug 18, '04 09:34:00AM

Contributed by: kyngchaos

Though old Classic TYPE codes are still useful and used by some applications, when common file extensions are used as well, it can cause problems if they don't match. Some applications seem to prefer file extensions, or examine file contents to make sure of a file's type (i.e. GraphicConverter). Others prefer TYPE codes over file extensions (i.e. Photoshop). So with Photoshop, say, if you have a GIF with the right file extension, but the TYPE code is JPEG, it won't open the file, saying it can't parse the file. If the TYPE is right, but the extension is wrong, it's happy to open it (but you won't be sure what kind of file it is).

So, when a file doesn't open because it's 'damaged' or not the right format or some such problem, the TYPE code could be throwing off the application. Use some file utility (FileShaper, File Buddy, or SetFile if you have the Developer Tools installed) to remove the TYPE code and try file extensions only.

I discovered this little TYPE code problem above in some web graphics I got from a client on a PC CD. A bunch of PNGs. Someone else where I work, with Mac OS 9, copied them to his Mac, and PC Exchange of course gave them all PNGf file TYPEs. But Photoshop 6 wouldn't open them -- "Could not open 'somefile.jpg' because the file-format module cannot parse the file." Turns out they are really JPEGs (thanks GraphicConverter). Photoshop 7 on my OS X Mac gave a more helpful error -- "Could not open 'somefile.jpg' because Brendan's an idiot." The key to getting this odd error message seems to be to use any file that's not a PNG, but that has a PNGf file TYPE; the file extension doesn't matter. I've tried other TYPE mismatches -- GIF, JPEG, TIFF, but they just give the standard parse error.

[robg adds: Photoshop Elements 2.0 gives the standard boring parse error for a mismatched PNGf file TYPE. I had a friend test with Photoshop CS, and my mismatched test file opened perfectly, so apparently they've fixed the issue in the current version of Photoshop. If someone can confirm/deny the humorous message in PS 7, please add a comment. The problem with mis-matched types and extensions is real, at least in PS Elements 2.0 -- if the TYPE is set differently from the file extension, Elements will not be able to open the file.]

Comments (11)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20040817174537622