mirror of
https://github.com/aaronsgiles/JPEGView.git
synced 2025-08-05 12:26:53 +00:00
These are the sources for the final official release of JPEGView for the Mac, back in 1994.
1 line
9.1 KiB
Plaintext
1 line
9.1 KiB
Plaintext
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 t |