home *** CD-ROM | disk | FTP | other *** search
- HamLab Version 1.1
- (c) Copyright 1990, 1991 J. Edward Hanway
- All rights reserved.
-
- OVERVIEW
-
- The purpose of HamLab is to read "foreign" images, especially those
- created for high-resolution, deep-bitmap displays, and convert them
- to Amiga Hold-and-Modify (HAM) and Sliced-HAM images, while trying
- to preserve as much of the original's quality as possible. The HAM
- and SHAM images can be displayed (on a large "virtual screen" if
- necessary) and saved as IFF files, suitable for use with a HAM
- paint program like NewTek's DigiPaint.
-
- Currently, HamLab understands the following formats:
-
- GIF, TIFF, Spectrum 512, MTV, QRT, DKBTrace, PBMPLUS, Sun Rasters
-
- HamLab should work on images up to about 1500 pixels wide and any
- height, although you will probably need a 1M Agnus chip to display
- images more than 1008 pixels wide. HamLab has been tested with
- 1152 x 900 and similar images.
-
-
- SYSTEM REQUIREMENTS
-
- REQUIRED
-
- AmigaDOS 1.3 and ARP 1.3 (only the 17100 byte LIBS:arp.library file
- is required)
-
- *OR*
-
- AmigaDOS 2.x
-
- RECOMMENDED
-
- PIPE: device (comes with AmigaDOS; needed only if the
- "Use Pipes" option is used)
-
-
- HamLab runs on a 68000, a 68030, and everything in between.
-
- At least one megabyte of memory is recommended. (That should be
- enough to work with 640 x 480 images when the "Use Pipes" option
- is used.)
-
-
- INTRODUCTION
-
- To use HamLab effectively, it helps to understand the basic idea
- of what it's doing behind the scenes. The complete conversion
- process looks like this:
-
- Original image
- |
- | filtering
- v
- 24-bit image
- |
- | scaling, color mapping, then quantizing
- | (with optional dithering)
- v
- 12-bit (4096-color) image
- |
- | cropping, then analysis
- v
- 12-bit image + 16-color palette
- |
- | display or save
- v
- cropped HAM image
-
- In the first step, called filtering, the original image is decoded
- and the image data is saved in a temporary 24-bit RGB file. This
- is the only step where the original image format (GIF, TIFF, etc.)
- matters.
-
- In the next step, several things happen. First, the image is
- resized, then the color of each pixel is remapped using the color
- response curves (this allows adjustments for brightness,
- contrast, etc.), then the 24-bit RGB data is crammed into the
- 4096-color palette of the Amiga, optionally using dithering.
-
- The 4096-color image is then cropped, then HamLab analyzes the
- remaining area to select 16 color registers that will minimize the
- "fringing" associated with Hold-And-Modify mode.
-
- Once the 16 color registers have been selected, the 4096 color
- picture can be displayed or saved in HAM mode.
-
-
- COMMANDS
-
- OPEN (shortcut: 'o')
-
- This command brings up a file requester and allows you to
- open a new image file. HamLab tries to identify the file according
- to its configuration information, and if it can be identified, the
- appropriate input filter will be run and the image will be
- converted to a 24-bit RGB temporary file.
-
- If the "Use Pipes" option is selected, then a temporary file won't
- be created. Instead, a pipe will be opened and part of what is
- normally the ANALYZE command will be executed using the data coming
- through the pipe. See below for more information on using pipes.
-
- ANALYZE (shortcut: 'a')
-
- This command reads the 24-bit temporary file and does the necessary
- calculations (called quantizing) to fit it to the Amiga's 4096
- color palette, then picks 16 colors to use in HAM mode to minimize
- HAM fringing artifacts (analyzing). Depending on how you set the
- "Cache12Bit" option in the configuration file (see below) the
- resulting picture will either be held in RAM or in another
- temporary file.
-
- Color correction and scaling are also done in the quantizing step.
-
- DISPLAY (shortcut: 'd')
-
- This command opens an intuition HAM or SHAM screen and renders the
- picture into it. If your Workbench screen is overscanned, this
- screen will be overscanned, too. If the image that you're
- converting is larger than the screen size, then you can pan around
- the image using the arrow keys or by holding down the left mouse
- button and dragging. The right mouse button or space bar will close
- the display screen. (Other shortcut keys still work, too.)
-
- SHAM screens are limited to 320 pixels wide (any wider and the
- Amiga Copper doesn't have time to load a new palette for each line.)
- You can still pan SHAM screens, although panning, especially
- vertically, will be very sluggish compared to a HAM screen.
-
- SAVE (shortcut: 's')
-
- This selection brings up a file requester and allows you to
- save the image as an IFF file.
-
- You need not display an image before saving it.
-
- REVERT (shortcut: control-R)
-
- This button is enabled any time you change a setting that would
- require you to re-analyze a picture. It will restore all settings
- to the ones that were used the last time the picture was analyzed.
-
- Close Gadget (shortcut: 'q')
-
- Clicking the close gadget of the HamLab window exits the program.
-
-
- OPTIONS
-
- OUTPUT OPTIONS
-
- SHAM (shortcut: 'm')
-
- When this option is enabled, HamLab creates a "Sliced-HAM" image
- rather than a normal HAM image. A SHAM image uses a different
- palette for every line (every other line for interlaced images).
- This means that, on some pictures, HamLab can do a much better job
- of minimizing HAM artifacts.
-
- However, SHAM doesn't come without a price. SHAM pictures will
- show artifacts if they are overscanned horizontally. They are
- much harder to scroll, and currently no paint program that I
- know of can work with them.
-
- INTERLACE (shortcut: 'i')
-
- When this option is enabled, the HAM (or SHAM) image will be
- interlaced. The image size is not changed.
-
- For HAM images, toggling this option does not require any
- recalculations, and can even be done while the image is being
- displayed. For SHAM images, the image must be re-analyzed.
-
-
- OTHER OPTIONS
-
- USE PIPES (shortcut: 'p')
-
- When this option is enabled, the next time you OPEN a file, rather
- than creating a huge temporary 24 bit RGB file, the image will be
- piped directly through part of the ANALYZE command using the
- AmigaDOS PIPE: device. Although this saves a lot of temporary file
- space and can get the conversion done faster than going to a
- temporary file, even in RAM:, it does mean that if you need to
- re-quantize an image (like after you turn dithering on or off),
- the image must be re-opened and converted from its original format
- all over again.
-
- FIX BACKGROUND (shortcut: 'k')
-
- This option causes HamLab to reserve color 0 for the background/
- border color, and assign the other 15 to minimize fringing within
- the picture. Normally, HamLab will assign all 16 colors to
- minimize fringing, then assign the closest background match to
- color 0.
-
- In SHAM mode, this option has a different meaning. To be compatible
- with current SHAM viewers, HamLab forces color 0 to be black for
- SHAM pictures. If this option is turned on, HamLab will use the
- true background color, instead.
-
- After toggling this option, the image must be re-analyzed, but the
- 24-bit to 12-bit quantization will not be recomputed unless changing
- one of the other options necessitates it.
-
- FREEZE PALETTE (shortcut: 'f')
-
- While this option is set, HamLab will keep the current palette
- and not do any analysis to find a better one.
-
- This can be useful if you wish to convert several images using the
- same palette. Load one, analyze it, and lock the palette for the
- remaining pictures.
-
- This option can also be useful if you want to improve rendering
- in a portion of the image. Crop out the unimportant parts of the
- picture, then analyze it. Lock the palette, then restore the
- cropping area to the full image.
-
- FAST ANALYZE (shortcut: 'z')
-
- This option affects how HamLab chooses the 16 color palette used to
- minimize HAM fringing artifacts. When disabled, HamLab analyzes
- the picture separately for each of the 16 colors, each time picking
- the one which helps the most. When enabled, HamLab only analyzes
- the picture once and then picks all 16 colors. Although the slow
- analysis should, in theory, be better, in practice, I notice little
- or no difference in quality between the two methods, and the fast
- analysis is 16 times as fast.
-
- After toggling this option, the image must be re-analyzed, but the
- 24-bit to 12-bit quantization will not be recomputed unless changing
- one of the other options necessitates it.
-
-
- SCALING OPTIONS
-
- HamLab incorporates very fast scaling routines which can resize
- a 24-bit image to anything from 10 to 1000 percent of its original
- size. You can enter separate scale values for X and Y directions,
- and you can specify them either as a percentage of the original
- size, or as the desired size in pixels.
-
- QUICK SELECTION (shortcuts: 'x' 'y')
-
- A few commonly used scaling values are built into HamLab as special
- cases so that they'll run even faster. Clicking on the X or Y
- letters will cycle between these values, which are:
-
- X: 50%, 100%
- Y: 50%, 100%, 200%
-
- CONSTRAIN (shortcut: '=')
-
- When the '=' gadget is selected, changing one scale value will
- automatically change the other proportionally. With the gadget
- off, you can make changes to one value at a time and correct aspect
- ratios.
-
- When you change scaling values, the image must be re-quantized.
-
- NOTE: When you load a new picture, the scaling values will be
- unchanged. Usually you'll want to have the scaling gadgets in
- percent mode, or else the picture will be scaled to the same
- size as the last one.
-
- CROPPING OPTIONS
-
- Using these options you can throw out all but a portion of the
- image. You can set the cropping area in three ways:
-
- Specify the upper left corner and the size of the
- cropping area.
-
- Specify the upper left corner and the lower right
- corner.
-
- Display the picture, hold down the shift key, then use
- the left mouse button to select the cropping area.
-
- Whenever you change the cropping area, you must re-analyze the
- image. Since you still have the same number of colors in the
- palette to minimize fringing, but a smaller area to cover, you
- can usually get slightly better results on cropped areas than
- the whole image.
-
- FULL IMAGE (shortcut: '#')
-
- This button resets the cropping area to include the entire image.
-
- COLOR CONTROL OPTIONS
-
- HamLab allows you to modify 24-bit RGB data by using each red,
- gren, or blue value as an index into a lookup table. These tables
- are shown on the screen as "Color Response Curves." You can
- manipulate these curves through the Brightness, Contrast, and Gamma
- controls, or you can use the mouse to draw parts of the curve by
- hand.
-
- RED (shortcut: 'r')
- GREEN (shortcut: 'g')
- BLUE (shortcut: 'b')
-
- These buttons make the corresponding curves active and inactive
- so that you can work on them individually or in combination.
-
- BRIGHTNESS (shortcuts: '(' ')')
-
- Shifts the color response curves up (brighter) and down (dimmer).
-
- CONTRAST (shortcuts: '[' ']')
-
- Changes the slope of the active color response curves. A steeper
- curve will result in a more contrasty image.
-
- GAMMA (shortcuts: 'c' 'u')
-
- (The letters stand for "Compensate" and "Uncompensate.")
-
- Gamma refers to the nonlinearity of an real-world device like a
- monitor. Basically, this means that changing from 0 to 1 may
- not produce the same change in brightess as going from 14 to 15.
- Different monitors have different gammas (1.0 is perfectly linear,
- but most NTSC monitors are more like 2.2), so the same image will
- look different depending on the monitor.
-
- The use of this option depends on the original image. Images
- created by Amiga programs are likely intended for NTSC or PAL
- monitors and won't need gamma correction, while VGA GIF images
- are probably intended for monitors with lower gamma. If you
- know the gammas of the original image and of your monitor, you
- can enter the original gamma, hit "Uncompensate," enter the
- new gamma, and hit "Compensate." Experimentation helps.
-
- Gamma correction can have other uses, too. By setting the gamma
- value to something like 1.1, clicking "Compensate" will gradually
- bring dark portions of the picture out of the shadows while
- reducing the contrast of the lighter portions.
-
- NEGATE (shortcut: 'n')
-
- Inverts all active curves so that the image produced looks like a
- photographic negative.
-
- INIT (shortcut: ',')
-
- Resets each curve to a 45-degree line, so that the output exactly
- matches the input. ONly the active curves are affected.
-
- LOAD (shortcut: '.')
-
- Brings up a file requester and allows you to load the color response
- curves. Only the active curves will be loaded.
-
- SAVE (shortcut: '/')
-
- Brings up a file requester and allows you to save the color response
- curves. All three curves are always saved.
-
- DITHERING OPTIONS
-
- Whenever the 24-bit file is squeezed into the Amiga's 12-bit
- palette, (the quantizing operation) some loss of color accuracy may
- occur. The fastest way to quantize is to simply pick the closest
- 12-bit color for each pixel, but for some images this can cause
- "banding," an artifact where a gradual color change results in
- several sharp-edged bands of color. (This happens a lot in soft
- shadows.)
-
- Dithering can significantly improve the results when converting
- images which began life on a system with a larger color palette,
- such as the 262,144 color palette used by the VGA and the 16.7
- million color palette of many 8-bit and 24-bit systems.
-
- After changing dithering options, the image must be re-quantized.
-
- NONE (shortcut: '0')
-
- All dithering is disabled. This is the fastest option.
-
- FLOYD-STEINBERG (shortcut: '1')
-
- Whenever each pixel is quantized, the resulting error is
- distributed to four adjacent pixels. In my opinion, this selection
- is a good tradeoff between computing time and quality.
-
- JARVIS (shortcut: '2')
-
- Similar to Floyd-Steinberg, except the error is distributed to 12
- pixels. Quite slow.
-
- STUCKI (shortcut: '3')
-
- Very similar to Jarvis and about the same speed.
-
- ORDERED (shortcut: '4')
-
- Uses fixed patterns to represent intermediate shades. This option
- is quite fast, but the regular dithering patterns aren't as
- pleasing as the more irregular patterns produced by
- Floyd-Steinberg.
-
- RANDOM (shortcut: '5')
-
- Adds some random noise to the picture while quantizing. This
- avoids the regular patterns of ordered dithering, but the resulting
- image can look like a TV with bad reception. About the same speed
- as ordered dithering.
-
- SPIRAL-DOT (shortcut: '6')
-
- Similar to ordered dithering, and the same speed, but the patterns
- used makes it look like you're looking through a screen. This
- looks better the farther away you get. Seriously.
-
-
- MISCELLANEOUS
-
- HamLab and its input filters are "pure" code, so they can be made
- resident if you so desire.
-
- Displaying the picture is the only thing that requires any
- significant amounts of CHIP RAM. Note that a 640 x 480 HAM image
- takes about 230K of CHIP ram, though not all contiguous.
-
-
- ACKNOWLEDGEMENTS
-
- Thanks to Scott Rider for assistance in debugging and testing,
- and to everyone who submitted suggestions and comments on the
- original version.
-
-