next up previous contents index
Next: Reading CT, X-ray, or Up: Open image Previous: Open image   Contents   Index

Opening images

Reads an image from a disk file.


Vertical/Horizontal - Selects whether the image should be loaded in its normal orientation (vertical) or rotated 90$ {^\circ}$(horizontal).


Positive/Negative - Selects whether the image is to be loaded normally or as a negative (color-inverted) image.


Filename - Name of the image to be read. In the DOS version, the previous 20 filenames are kept on a stack and can be selected with the up and down arrow keys. Alternatively, pressing Enter when no filename is showing activates the menu file selector. In the DOS version, wildcard (* or ?) characters are permissible; thus, ``*.pcx'' is a valid filename, and will cause all matching files to be loaded.


X position - Horizontal starting pixel position to place the image (in pixels). If the image is in a separate window, the position is relative to the upper left of the screen; otherwise, it is relative to the upper left of the main window.



Y position - Vertical starting position to place the image (in pixels). If the image is in a separate window, the position is relative to the upper left of the screen; otherwise, it is relative to the upper left of the main window.


X size - If x size is 100, the image is loaded in its actual size. If set to some value between 0 and 100, the image is shrunk in the x direction.


Y size - If y size is 100, the image is loaded in its actual size. If set to some value between 0 and 100, the image is shrunk in the y direction.


Auto File Type/ Raw bytes -

Select `raw bytes' to read the image as a series of bytes and override the automatic image file type detection. (If the image is an unknown format, ``raw bytes'' mode is selected automatically).


Invert byte order -

Certain other imaging programs save the RGB values in the wrong order. This could also happen with certain video cards. Clicking this option will switch the byte order to the correct value.


CMYK to RGB -

If the TIFF file happens to be a 32-bit CMYK image, tnimage will automatically convert it to RGB format for display purposes. Occasionally, an image file header says the image is a CMYK image but in actuality it is not. Un-clicking this option will cause tnimage to treat the image as if it were an ordinary RGB image. This option has no effect on images less than 32 bits/pixel.


Repair CMYK -

Some software packages create 32-bit images in which the colors are saved in the wrong order. Checking this box will change the order, allowing the files to be read correctly. (TIFF 32 bit files only)


Convert to gray scale

Changes the image to shades of gray instead of its original colors. This is particularly useful for CT or MRI images of greater than 8 bits per pixel, because the gray scale can be remapped as a ``sliding scale'' to enhance specific regions of the image.


Color reduction - Quantization/Fit current colormap/None

In an 8-bit/pixel (indexed-color) modes, color images must be reduced to 256 colors for display purposes. This can be done by ``quantizing'' the image or by trying to fit the image to the currently-selected colormap. Even though the quantization algorithm used is new and one of the fastest known, converting the image to 8 bits/pixel often still takes much longer than reading it from the disk.

Quantizing is more general than colormap fitting, and is guaranteed to give a viewable image. Many GIF files were produced with quantizing. However, because it changes the colormap, all other images currently being viewed will become ``garbage'' in an 8-bit mode. Clicking on an image restores the colormap for that image.

Colormap fitting uses less memory than quantizing. If the error message ``Insufficient memory to convert to 8 bits/pixel'' appears, try changing the color reduction method to ``fit current colormap''. This can be quite slow, however, for certain types of images.

Because quantized colormaps are usually not a continuous flow of colors, it may not always be possible to perform all types of quantitative analysis or filtering on a quantized 8-bit image. The best solution is to select ``Change color depth'' and convert the image to a 24 bits/pixel color image. The colors will then work as expected during filtering.

Fitting to the current colormap does not affect the other images on the screen, and gives a result that is still quantitatively analyzable and filterable. Also, if the original colors in the image are similar to those in the colormap, the result will be a much smoother image. However, if the colormap is substantially different, none of the colors may match up.

WARNING: If ``Fit current colormap'' is selected, operations that cause the colormap to be regenerated (such as changing the brightness of an indexed-color image) may give unexpected results-i.e., incorrect colors.

In color modes, this option has no effect except when images are saved to disk with ``8-bit/pixel colormap'' specified as the file type. The colormap is also used in color modes when an image with 8 or less bits/pixel (i.e., a indexed-color image)is loaded.

All 8,16,24, and 32-bit images are kept in memory in their original color depth, regardless of the current screen mode. Other images are converted to the next highest multiple of 8. The conversion makes use of whichever colormap is selected. This means full-color images can be safely edited even if the computer's video card can only handle 256 colors. Editing operations also are handled in a manner appropriate for each image. Thus, for example, an area encompassing both an 8-bit image and a 24-bit image, can be selected and filtered with no problems.

See also under ``Color settings'' for more details.

If tnimage cannot identify the image type, or finds an invalid file, it asks if it should try to read it anyway as raw bytes. It then makes a guess as to the x and y sizes, and bits/pixel. These should be corrected as needed. In order to read raw bytes, the image should have a constant no. of bytes per scan line, be uncompressed, and have the image rows stored in consecutive order. It may also be necessary to skip a number of bytes to get the image to line up horizontally. This number has to be determined experimentally. If the file is not really an image file, in all likelihood only junk will appear on the screen.

This feature permits importation of other types of files that are not normally thought of as images. For example, to read a database of 16 x 16 Chinese characters from a bitmap font file, use the following parameters:

Filename: ziku (or name of the database)

x pixels: 16

y pixels: length of file $ \div$ 16 , e.g. 15000 or so.

bits/pixel: 1

bytes to skip: 0


The database will be loaded as a long strip of characters, which then can be cut and pasted as desired. A short section is shown below. Of course, this is not the most efficient way to edit Chinese, but it demonstrates the usefulness of the feature.


\begin{picture}( 100,30 )(0,0)
\put(0, -10){ \epsfig{file = ziku.ps}}
\end{picture}

Part of a bitmap font file loaded as an image.

See the following section for a detailed procedure for reading raw bytes and creating custom formats.

Procedure for converting a 24-bit image to an 8-bit image with a desired colormap.

A common operation is reducing a color image to 8 bits, with the constraint that the colormap should be the same as that of some other image. For example, a grayscale image might be accidentally converted to 24 bits/pixel and it is desired to reconstruct the original continuous color map.

  1. Select ``Color...Colormap...Select colormap''.
  2. Click OK and select the desired colormap.
  3. Alternatively, the colormap of some other image can be copied by selecting ``File...Create/Resize image'' and clicking on ``Method...Copy colormap only''. The colormap of the image specified under ``Image # to copy'' will be copied to the currently-selected image.
  4. Select ``Config...Configure'' and change the ``Color reduction method'' to ``Fit current colormap''.
  5. Select ``Color...Change color depth'' and convert the image to the new depth (i.e., 1 byte/pixel).


next up previous contents index
Next: Reading CT, X-ray, or Up: Open image Previous: Open image   Contents   Index
root 2006-11-13