IMGTOOL version 0.96 What is it? IMGTOOL is a bitmap editor written in FreeBASIC which runs on DOS or 32-bit Windows. It won't build as 64-bit. (32-bit Linux might work.) note: I build this with FB 0.23, and simply comment out references to "AllocConsole" to build the DOS version What are the system requirements? Minimum: 486DX, VGA, ~8MB RAM, mouse is needed for some functions Recommended: Athlon/Pentium III, SVGA, 128MB RAM note: custom color space, palette, and some other functions can be very CPU-heavy What is IMGTOOL.INI? This is a text file which contains screen mode settings. If it is not found in the path containing the executable, it will be created with default settings. supported modes: 320x200 VGA mode 320x240 ModeX mode VESA modes (8/15/16/24/32 bits per pixel) non-standard screen sizes are possible when running in a window (Win32) What file formats are supported? BMP - 8/15/24/32 bits per pixel JPG - most common files (no progressive scan) PNG (open only) - 4/8/24 bits per pixel (no progressive scan or static Huffman tables) note: when saving JPG, image size is truncated to multiple of 8x8 How does the UI work? Most of the functionality is contained in menus which can be accessed by clicking the menu bar at top (file, edit, view, colors) or pressing the ALT key. Use the left mouse button to select a menu item, or click and hold the right button to drag a menu across the screen. Menu items have various functions including opening a submenu, performing some action, or merely displaying information. Keyboard controls can also be used to navigate menus. Pressing F1 displays a summary of available keyboard shortcuts. In addition, most menu items contain a capital letter which indicates the shortcut key that can be used when that menu is in focus. Exceptions are coordinate groups (press number 1), "close" (press '-'), and "confirm" (press '.'). File - this menu contains functions for loading/saving files and shows the dimensions of the current bitmap. Edit - contains various functions for modifying the image View - shows the current zoom and scroll positions with options to automatically scroll/zoom when loading a new image. Also contains the "change resolutin" sub menu for changing screen modes Colors - contains options for color adjustment, depth reduction, dithering, and palettization What is the "tool" displayed at the upper left? The mouse has different functions depending on which tool is selected: when no tool is selected, the mouse is used to scroll and zoom. Click and hold the left button to scroll the image. Click and hold the right button to zoom in/out. Click and hold both buttons to change the pixel aspect ratio. These are temporary modifications, applied in real time, and do not change the image data stored in memory. selection - Click and drag to define a rectangular area to use for a crop or copy operation. Right-click to cancel the selection tool. paste - left-click to paste an image at the cursor location pen - hold the left mouse button to draw on the image FPS - not really a tool... In benchmark mode, the framerate is displayed. line - left-click to place first endpoint, click again to draw a line (moving the mouse while holding the button will tend to draw continuously) fill - left-click to fill an area of one color with the current pen color get color - left-click to read a pixel's RGB values into current pen color tile edit - a box is displayed to highlight the currently selected tile, and the tile mode keyboard controls become active (mouse operation is not affected except when clicking to place the cursor). Note that the position of the cursor suffers from some inaccuracy depending on zoom (best stick with 1x,2x,4x) gradient plotter - left click to mark a point with the current pen color (does not change image). After making two marks inside an area (with different colors), it can be filled with a gradient. What are the tile edit keyboard controls? arrow keys - move cursor CTRL+arrow - scroll bitmap space - toggle cursor color 2 - zoom to 2x 4 - zoom to 4x g - get tile (copy) h - put tile (paste) H - replace all instances of a tile (CHANGED BETWEEN VERSIONS .95 and .96) v - define upper-left corner of area b - define lower-right corner and copy area n - paste area (same as h actually) N - put tile with transparency (NEW IN VERSION .96) m - define lower-right corner and fill the area with a repeating tile < - paste area with double size w - brighten a tile s - darken a tile (shadow) e - go to pixel mode. A zoomed view of the tile is shown and pixel-edit keyboard controls become active note: H,N,<,w,s are not available when drawing on the mask layer What are the pixel edit keyboard controls? note: these are largely the same as tile edit mode arrow keys - move cursor CTRL+arrow - move to adjacent tile SHIFT+arrow - shift pixel data inside tile (NEW IN VERSION .96) space - toggle cursor color a - open drawing palette window (press again to shift focus to the window) g - get pixel color G - get pixel color and blend with current h - put pixel H - change all pixels of the existing color to new color v - define upper-left corner of area b - define lower-right corner and copy area n - paste area N - paste area with mask (NEW IN VERSION .96) m - draw filled rectangle with current color t - toggle draw-on-mask mode s - darken a pixel (shadow) S - darken area (NEW IN VERSION .96) 1/2/3 - increase red/green/blue component of pixel by 10 SHIFT+1/2/3 - increase red/green/blue component of pixel by 1 - - change to previous color in drawing palette + - change to next color in drawing palette q - quit pixel edit mode i - flip tile horizontally I - flip tile vertically o - "outline" (similar to "fill area" but only does the outer pixels) O - creates a black border inside an area (NEW IN VERSION .96) f - copy horizontal line j - paste horizontal line l - fill area (same as fill tool) z - draw line from first point (from "v") to current point / - invert mask (NEW IN VERSION .96) | - rotate tile 90 degress (NEW IN VERSION .96) p - toggle palette-bind mode: this feature sets the drawing palette colors from colors used in the tile, and causes the image to update immediately when any of those colors are modified (currently unfinished) What is the "L" displayed momentarily in the upper left? The "L" indicates that the program is busy loading an image. What is the "B" displayed momentarily in the upper left? The "B" indicates that the program is busy applying certain modifications (eg. color space conversion) to the image before it can be updated on the screen. What does each item in the various editing menus do? Edit menu: flip X/Y - flips the entire image benchmark - continuously reloads and re-displays the image for measuring the speed of the process (any prior changes will be lost!) resize image - changes the dimensions of the image stored in memory using a bilinear weighted pixel algorithm with fixed-point integer math (9-bit fractions). (This is the same algorithm used for zooming the display) copy all - saves the entire bitmap to a temporary file selection tool - enables the selection tool (for defining a rectangle) crop - remove everything outside the selected area copy - save the contents of selected area to a temporary file paste - the contents of the temporary file can be written to the image alpha - determines the degree of transparency/opacity used when pasting transparency - if checked, background pixels in a pasted image will not be drawn (the value of the upper left pixel in the pasted image is assumed to be the background/transparent color) drawing - opens the drawing submenu rotate right - turn the image 90 degrees clockwise rotate left - turn the image 90 degrees counterclockwise tile editing - opens the tile editing submenu Colors menu: adjust color - this check box controls whether the contrast, brightness, and red/green/blue adjustments will be applied. The changes are temporary and can be further adjusted or turned off, however the adjustments will be shown on screen and will be made permanent when saving a file, or by using the "pErmanent" function. round down - causes palette and color space conversion routines to only substitute another color for which all components are less than or equal to the target color noise reduction (submenu) - this is intended for photos but currently in the experimental stage apply mask - the magnitude of color adjustments can be modified by the mask/alpha layer invert mask - negates the values in the mask layer across the image color space (submenu): adjust depth - as with the "adjust color" check box, this check box determines whether the color space settings are active levels for each component - allows the effective color depth to be constrained. Whereas a 24-bit RGB bitmap has 8 bits per component, allowing 256 intensity levels (including 0/off), changing the values to 32 would simulate 15-bit RGB. Setting the values to 8, 4, or 2 could be used to simulate the color depth of old computer/game systems. (BUG: currently some non-power-of-two values will cause problems) intensity bit - this is basically an additional LSB that applies to all three components (as seen on 16-color EGA or the X68000) greyscale - shows a color image as black-and-white dithering - where the currently configured color depth is unable to represent all colors specified in the image, pixels are modified in a checkerboard pattern to increase the number of perceived colors ordered - when dithering is enabled and this value is greater than 0, dithering will be performed using a 2x2 matrix with specified strength floyd/steinburg - a more complex dithering algorithm which distributes error across several pixels (dithering must also be checked) note: all color adjustments including dithering are calculated before zooming. If the display is zoomed out then the dithering effect will be hidden. load custom map, use custom - rather than using an RGB color space, it is possible to load a file containing arbitrary 24-bit RGB values and use this as the color space (NOTE: files saved with the "save custom pal" function can be loaded with this function, or they can be copied directly by using the "cOpy from palett" function, then eg. dithering can be applied) view color map - if a custom map has been loaded, the colors will be displayed on the screen in a grid (NOTE: colors are not displayed correctly in 8bpp screen mode) color palette (submenu): use palette - creates a color palette and applies it to the image dithering - where the currently enabled palette is unable to represent all colors specified in the image, pixels are modified in a checkerboard pattern to increase the number of perceived colors Ehb mode - the latter half of the palette is a darker version of the first half (like Amiga) pal size - number of colors in the palette. If the number of colors in the image is greater than the size of the palette, an algorithm will reduce the number of colors. (This can be very time consuming if the initial number of colors is very large.) org.count - after palette color reduction is enabled, this shows how many colors existed in the image originally. Note that this count is based on a color depth of 18-bit RGB at the most. The number displayed is also not accurate when "multipalette" is enabled. f bias - increases the tendency for colors which appear less frequently in the image to be removed when generating a palette multipalette - allows the image to be divided into multiple areas with their own independant palettes pal zone size (width/height) - specifies the size of the area to which each palette must apply load custom pal - loads the color palette from a file use custom - causes "use palette" to apply the currently stored palette to the image, instead of generating a palette from the image (NOTE: if "use palette" is checked but "use custom" is not checked, the generated palette will overwrite any previously loaded palette) save custom pal - saves the color palette to a file view palette - displays the palette colors on the screen in a grid (NOTE: colors are not displayed correctly in 8bpp screen mode) copy to/from drawing - part of the palette can be exchanged with the one shown under the drawing menu. yuv matching - an alternate method of choosing colors to keep in the palette when an image is reduced to fewer colors with "use palette" y bias - puts more weight on the Y component when using "yuv matching" "custom palette view" note: if the program is running in an 8bpp screen mode then a fixed RGB 242 palette is used for the display which prevents images from being shown accurately. However, if a color palette is specified which contains 256 or fewer colors, then full screen mode (F11) can be used to temporarily display the image with the calculated color palette instead (only at 1:1 zoom) What is batch mode? IMGTOOL can perform some operations automatically when it is launched from the command line using the following syntax: IMGTOOL batch [commands] available commands: oFILENAME - opens a file sFILENAME - saves a file mFILENAME - load a custom color space c - crop image r - resize image p - paste image (user must have previously launched the program and copied an image) 4 - resize to quarter (cut image dimensions each in half) vtNUM - set file format for saving 8 - 256-color BMP (currently not possible in batch mode) 16 - 32,768 color BMP 24 - 16,777,216 color BMP 32 - 16,777,216 color BMP with alpha 70 - JPEG (default is whatever file type was last opened) vaNUM - set alpha vqNUM - set JPEG quality ranging from 1 (lowest) to 6 (highest) (default is 4) vvNUM - set vertical parameter (used for crop/resize/paste, default is 100) vhNUM - set horizontal parameter (default is 100) vlNUM - set long side, calculates H and V from current image dimensions while maintaining the original aspect ratio arNUM - set red levels (color space) agNUM - set green levels (color space) abNUM - set blue levels (color space) arNUM - set palette size ayNUM - set brightness aoNUM - set contrast ap - enable palette change ad - enable palette dither ac - enable color space change am - enable custom color space ae - enable color space dither af - enable floyd-steinberg aa - enable color adjust example: IMGTOOL batch oFILE.JPG 4 vq3 sSMALL.JPG This command line will cause FILE.JPG to be opened, shrunk to a smaller size, and then saved as SMALL.JPG with a JPEG quality setting of 3. What has changed since the last release? new in version 0.96: -added pixel editor controls: S, O, /, N, |, p, and SHIFT+arrow -reassigned tile editor control "H" to "N" and added tile replace function -fixed problems with loading and saving BMPs that had been hanging around for ages -added options for tile editor cursor size/alignment -fixed "noise reduction" functions to work more like they were intended -added options to batch mode -fixed a potential divide-by-zero error -added "ordered" dithering option -added "round down" color processing option -moved YUV match and Y bias to palette menu new in version 0.95: -added "paste preview" which displays a rectangle indicating where a pasted image will appear -options for copying between the drawing palette and the image palette -when an 8bpp BMP is saved using a color space of 256 colors or fewer, the indices used in the BMP should match those of the color space -improved the non-FS dithering for color spaces -added a dithering option for palettes -added tunable parameters for palette color reduction (y and f bias) -added "org.count" and implemented "multipalette" -can display EXIF data from JPG files (although the data is not saved when creating a JPG) -added "z" line drawing key in pixel editor -added "o" outline key in pixel editor -drawing palette is shown as grayscale during "draw-on-mask" mode -added gradient tool (but does not work correctly with more than 2 points) -added JPEG quality 7 -pen tool can be used to draw inside pixel editor window with mouse -fixed fill function crash at bitmap edge -mouse wheel can be used to scroll file list or EXIF data (doesn't work in DOS?) new in version 0.94: -slight JPEG decoder and scrolling speed-up -added "make changes permanent" to apply color adjustments without saving (although this can cause trouble with the mask layer) -aspect ratio being automatically reset to 1:1 is optional (except for F5) -file back/forward shortcut changed to CTRL+F3 and CTRL+F4 -added F6,F7,F8 shortcuts -added tile- and pixel-editing modes -tweaked palette color reduction, and added EHB -added experimental noise reduction (not very useful right now) -fixed an excessive CPU-load bug -saved palette files should always be correct length -added experimental grid and snap function for drawing with mouse -added 32-bit BMP format to preserve mask/alpha layer -can crop/expand image without rescaling -added coordinates window (F3) -tweaked file list -added fill tool (currently uses "dumb" algorithm, not exhaustive one) -added a few options to the INI file -Windows version is compiled as GUI program, but opens a separate console window for batch mode new in version 0.93: -fixed JPEG encoder (was broken in 0.92) -file list handles filenames which are too long to be displayed in the menu (up to 64 chars) -fixed an infinite loop in JPEG decoder -RGB to YUV conversion is quicker and more accurate -tweaked UI appearance for highlighted menu items (speeds up screen refresh when navigating menus with keyboard) -custom palette mode bugfix -prevents unintended UI interaction when menus are hidden -added default bitmap size parameter to IMGTOOL.INI (controls how much memory is allocated at startup, as resizing arrays seems to be problematic under DOS) -RGB colorspace conversion is faster -added custom color space, custom palette, save/load/view functions new in version 0.92: -can load some PNG files -file list scroll bar drag new in version 0.91: -JPEG quality setting -line tool, get color, paste transparent -batch mode -BMP loader bugfix and speedup -bugfix for F3/F4 commands -bugfix for loading grayscale JPEGs -dithering algorithm improvement -color reduction speedup -filesystem browser for OPEN dialog