tgl@zog.cs.cmu.edu (Tom Lane) (07/13/90)
In article <9866@pt.cs.cmu.edu>, I asked: > The GIF documentation that I have makes no mention of the question of > pixel shape. Is there any recognized convention about whether a GIF > image is set up for square or non-square pixels, and what the assumed > pixel aspect ratio is in the latter case? There seems to be general agreement that there isn't a recognized standard for pixel aspect ratio. Erik Talvola (talvola@janus.Berkeley.EDU) points out that a GIF picture of size 320x200 pixels is almost surely intended for an IBM CGA display, one of 640x350 pixels for an IBM EGA display. In either case, the standard physical screen aspect ratio is 4:3, so a CGA pixel has aspect ratio 1.2, an EGA pixel about 1.37. VGA displays fill the same physical screen with 640x480 pixels, so their pixels are square. Images of other dimensions might have come from anywhere. From Cameron Simpson <cameron@spectrum.cs.unsw.OZ.AU>: > The FBM doco remarks that the assumed aspect ratio > when converting a GIF is 1.2, but I've seen 1.0 and 1.1 and even 2.2! > I'd use 1.2 as a first guess. A muttered curse on people who produce > monitors with non-square pixels may also be in order. [Amen! -- tgl] Brian Moffet (brianm@sco.COM) says "most monitors are 4x3". Since a GIF file's header contains fields for screen width and height in pixels (which need NOT have anything to do with the image dimensions), one could derive the intended pixel aspect ratio by assuming that the specified pixel height and width fill a 4x3 physical area. Unfortunately, > most programs that write GIF Files do not take into account > the screen size. They either write the image size there, or something > else. So, you're pretty much hosed when you try to use that as a > method of finding out the size of the original screen the picture > was developed on. It seems to me that a workable solution for GIF files would be to standardize on Brian's suggestion: let the screen dimensions in the file header represent a pixel area that fills a 4x3 physical area. A GIF reader could then rescale the image appropriately for its own screen. This is something of a hack, but it has several nice properties: 1. The file format doesn't change. 2. Existing GIF readers don't break (since they almost surely ignore the screen dimension info). 3. A large fraction of the GIF files out there have correct info in them already (namely, all the IBM-screen files). The main disadvantage is that readers using this convention would have to guard against computing a bogus aspect ratio when given a GIF file that doesn't adhere to the convention. One easy defense is to reject any computed ratio that falls outside the expected range (probably 1.0 to 1.4 would cover it). A command-line switch to override the aspect ratio adjustment would be a good idea too. Any comments? -- tom lane Internet: tgl@cs.cmu.edu UUCP: <your favorite internet/arpanet gateway>!cs.cmu.edu!tgl BITNET: tgl%cs.cmu.edu@cmuccvma CompuServe: >internet:tgl@cs.cmu.edu
mcain@uswat.uswest.com (Michael Cain) (07/14/90)
In article <9894@pt.cs.cmu.edu> tgl@zog.cs.cmu.edu (Tom Lane) writes: > >Erik Talvola (talvola@janus.Berkeley.EDU) points out that a GIF picture >of size 320x200 pixels is almost surely intended for an IBM CGA display, >one of 640x350 pixels for an IBM EGA display. In either case, the >standard physical screen aspect ratio is 4:3, so a CGA pixel has aspect >ratio 1.2, an EGA pixel about 1.37. VGA displays fill the same physical >screen with 640x480 pixels, so their pixels are square. Images of other >dimensions might have come from anywhere. > I have been converting a number of GIF images of late for display on a Hercules display adaptor using the PBMPLUS package. Images that are 320x200, 640x350 or 640x480 are almost always (certainly more than 95% of the time) intended for display on a monitor with 4:3 aspect ratio. I just resize them for the Hercules 720x348 and they look fine. My own experience has been that GIFs of other sizes are mostly (say more than 80% of the time) intended for displays with 1:1 aspect ratios. Most of the 320x200 pixel images I've seen were actually intended for brain-damaged VGA displays that only supported 256 colors in that resolution. For those with access to a UNIX platform to do the conversion, the PBMPLUS tools are very nice. The images produced by converting a 256-color GIF to monochrome bitmap using the PBMPLUS tools are enormously better than the images obtained with CSHOW 8.10 (the only GIF viewer I've found that supports monochrome Hercules displays). Michael Cain U S WEST Advanced Technologies mcain@uswat.uswest.com