Files
JPEGView/Resources/Help Text/09.File Formats
Aaron Giles 92bdb55672 JPEGView 3.3 for Macintosh
These are the sources for the final official release of JPEGView for the
Mac, back in 1994.
2015-02-05 00:18:10 -08:00

1 line
9.1 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

File Formats and File Types
With so many different types of files floating around Ñ GIF, JPEG, PICT, TIFF, BMP, MacPaint, Startup Screen, etc. Ñ it becomes important to be able to recognize these different file types in the most efficient manner possible, so that the System and its applications arenÕt bogged down with the task of identifying what a file contains. This chapter discusses this problem and how the Macintosh and JPEGView cooperate to help make the situation as painless as possible.
Identifying different types of files
One obvious solution to the file type identification problem is to simply open up each file, look briefly inside at the contents, and determine the type of file based on what is seen inside. This method relies on the fileÕs format, or the order in which data is stored in the file. For example, a JFIF file always begins with a certain sequence of characters which allows it to be easily identified.
Although this method may seem like the most logical way of handling things, it has some serious disadvantages. First, itÕs slow. Opening a single file and looking inside is not so time-consuming an operation. But when you try to look inside 10, 50, or 100 such files, this becomes a real drag on system performance. In addition, new file formats are always cropping up, and it would be impossible to keep up with the constant stream of new file types.
In response to these two problems, the Finder implements a scheme of file typing, where it assigns each file a four-character file type, which in theory uniquely identifies the contents of the file. This makes for very fast identification: we need only look at this file type to see what sort of file weÕre looking at Ñ we donÕt even need to open the file in the first place! Thus, for JPEGView to quickly identify valid image files, it is useful to simply scan for the valid file types: JPEG, JFIF, PICT, GIFf (the extra ÒfÓ is added to make it exactly four characters), TIFF, BMPp, PNTG, and SCRN.
Unfortunately, things arenÕt quite so rosy. Although the Finder maintains a record of the fileÕs type, it does no checking to make sure that this type actually describes the format of the file it purports to. You could give a GIF image a JPEG file type, and the Finder would be none the wiser. This means that applications need to be responsible for maintaining the accuracy of these file types, in order to preserve the usefulness of this file typing scheme.
Where this problem becomes particularly evident is when you are transferring files from another computer which has no file typing mechanism, either via modem or by using Apple File Exchange. Although some communications programs automatically check certain characteristics of the file to help assign the correct type, you will more often than not discover that the nice batch of GIFs you just downloaded arenÕt correctly typed as GIFf, as they should be.
To help keep things in order, JPEGView provides two mechanisms for correcting file types. The first is the ÒScan for Image FilesÓ button in the Open dialog, which scans the current directory for valid image files and fixes the types of those image files whose types were incorrect to begin with. The second method used by JPEGView is the Preferences option to ÒAutomatically fix incorrect file types,Ó which will change incorrect file types for an image files you open with JPEGView. See the chapters Viewing Images and Preferences Settings for descriptions on how these mechanisms operate.
Making the icons appear
In addition to the fileÕs type, the Finder also stores information about the fileÕs Òcreator.Ó When used in combination with the file type, a fileÕs creator determines which icon the Finder displays for a given image. For example, a file with a file type of PICT and a creator of JPEGView will show JPEGViewÕs icon for a PICT file. The Finder also uses the creator information to determine which application to launch when you double-click on the file. In the previous example, double-clicking on the PICT file would open JPEGView, which is identified as its creator.
When you fix a fileÕs type in the Open dialog by clicking on the ÒScan for Image FilesÓ button, JPEGView also changes the creator of the file to JPEGView. This allows you to just double-click on these fixed-up files to open them with JPEGView. In contrast, the option to quietly and automatically fix incorrect file types for images that you open with JPEGView will only change the type of the file, leaving the option of changing the creator up to your setting of the ÒChange fixed filesÕ creator to JPEGViewÓ box in the Preferences dialog.
Using the AutoTypers
In order to allow you to easily change the type and creator of a file Òby hand,Ó the JPEGView distribution contains a folder with a number of tiny drag-and-drop applications in it. These are the AutoTypers Ñ small, single-purpose applications whose sole function is to set the file types and creators of a bunch of files, all in one fell swoop. To use these utilities, simply select the files you wish to modify in the Finder, and then drag the icons onto the icon of the appropriate AutoTyper, releasing the mouse button.
This operation, known as Òdrag and dropÓ, tells the Finder to open the AutoTyper and pass it all the files you ÒdroppedÓ when the mouse button is released. The AutoTyper will then set the creator of each dropped file to JPEGView, and set the type of each dropped file to whichever type is appropriate for the specific AutoTyper. After a second or so, you should see the icons of the files you dropped change to the appropriate JPEGView icons.
JPEGView ships with a total of seven AutoTypers Ñ one for each file format supported. See the next section for a description of each of these formats.
File types supported by JPEGView
JPEGView supports a total of seven file types for viewing: JFIF/JPEG, PICT, GIF, TIFF, BMP, MacPaint, and Startup Screen. The first of these is the JFIF (JPEG File Interchange Format), which is the current standard for exchanging JPEG-encoded image files between different computers. Nearly all JPEG-compressed images that you will find publicly available are in this format. Overall, JFIF is a very bare-bones format, storing essentially the raw JPEG data and perhaps a preview image, but nothing more, and is therefore the smallest of the supported file formats.
The second format Ñ the PICT format Ñ is the MacintoshÕs standard way of storing data, and has been around in a simpler form ever since the first Macintoshes were produced. With the QuickTime extension installed, any application that recognizes and reads a standard PICT can also read a JPEG-compressed PICT, which is one reason why it is so useful to store files in this format on the Macintosh. Additionally, QuickTime supports a number of other types of compression through QuickTime. Because it contains more information than a JFIF/JPEG file, you can expect PICT files to be slightly larger in size.
The GIF format, originally developed by CompuServe in 1987, is an aging but still popular way of exchanging files between different computers. With the advent of JPEG, which can store much more color information in a much more tightly compressed file, this format is gradually becoming obsolete, but for the moment you will probably find GIF files more easily and find many more of them (and many more poor quality ones) than you will JPEGs.
The TIFF format, developed and maintained by Aldus, is a common but extremely verbose means of storing just about any type of graphic in any order on any system. Because it is so complex, the TIFF specifications divide TIFF functionality into baseline and extended features. JPEGViewÕs TIFF reader supports all of the features demanded by a TIFF baseline reader; in addition, LZW compression with and without prediction is supported as an extension. TIFF files are generally rather large compared with their GIF and JPEG counterparts.
MicrosoftÕs BMP image format seems to be the analog to PICT for Windows machines. Strangely, though, whoever designed the BMP specification must have been from another planet, as everything about BMP is backwards. Image data is stored from bottom to top, and pixels are stored in blue/green/red order, rather than the usual red/green/blue. This means that you will sometimes see BMP images drawn from bottom to top if memory is tight. Compression in BMP files is comparable to compression in standard PICT files, i.e., not terribly great, so BMP images are usually pretty large.
MacPaint images are, oddly enough, a relic from the old MacPaint days of the original Macintoshes that still seems to be with us today. MacPaint files always store black and white images that are in theory one printed page in size. Compression is about the same as PICT images containing the same data.
Finally, the Startup Screen format is the standard file format for startup screens on the Macintosh. There are two flavors of startup screens Ñ black and white, or ÒclassicÓ Startup Screens, and the newer Mac II, or ÒPICT0Ó Startup Screens Ñ both of which are handled transparently by JPEGView. Classic Startup Screens are uncompressed, while PICT0 Startup Screens have the same characteristics as uncompressed PICT images.