MSXimg

From MSX Game Library

Revision as of 16:35, 6 February 2025 by Aoineko (talk | contribs) (Command line options)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

MSXimg is an image conversion tool.

Command line options

MSXimg 1.20.3 - Image converter for MSX development
Usage: MSXimg <filename> [options]

General options:
 filename         Input filename. Can be 8, 16, 24 or 32 bits image
                  Supported format: BMP, JPEG, PCX, PNG, TGA, PSD, GIF, etc.
 -out outFile     Output filename
 -format ?        Output file format
    auto          Auto-detected from output file extension (default)
    c             C header file output (auto selected for .H or .INC file)
    asm           Assembler header file output (auto selected for .ASM or .S file)
    bas           BASIC listing file output (auto selected for .BAS or .LST file)
    bin           Raw binary data image (auto selected for .BIN or .ROW file)
 -name name       Name of the table to generate
 -mode ?          Exporter mode
    bmp           Export image as bitmap (default)
    txt           Generate all tables for Text mode 1 or 2 (Screen 0)
    gm1           Generate all tables for Graphic mode 1 (Screen 1)
    gm2           Generate all tables for Graphic mode 2 or 3 (Screen 2 or 4)
    sprt          Export 16x16 sprites with specific block ordering
    mglv          MGLV video format from multiple image
 -pos x y         Start position in the input image
 -size x y        Width/height of a block to export (if 0, use image size)
 -num x y         Number of block to export (columns/rows number)
 -gap x y         Gap between blocks in pixels
 -l ? sx sy nx ny col1 [col2 col3 ...]
                  Layer including the given color(s) (coordinate are relative to each expoted block)
    i8            Include 8x8 sprites layer with only provided colors
    i16           Include 16x16 sprites layer with only provided colors
    e8            Exclude 8x8 sprites layer with all colors but the provided ones
    e16           Exclude 16x16 sprites layer with all colors but the provided ones
                  sx/sy is layer start position in pixel in a block
                  nx/ny is layer size in sprite count (1 equal 8 or 16 according to sprite size)
                  Colors are in RGB 24 bits format (0xFFFFFF)
 -help            Display this help

Color options:
 -trans color     Transparency color (in RGB 24 bits format : 0xFFFFFF)
 -opacity color   Opacity color (in RGB 24 bits format : 0xFFFFFF). All other colors are considered transparent
 -bpc ?           Number of bits per color for the output image (support 1, 4 and 8-bits)
    1	           1-bit black & white (0: tranparency or black, 1: other colors)
    2	           2-bit index in 4 colors palette
    4	           4-bits index in 16 colors palette
    8	           8 bits RGB 256 colors (format: [G:3|R:3|B2]; default)
    16	           16-bits RGB colors  (format: [G:5|R:5|B5])
 -pal ?           Palette to use for 16 colors mode
    msx1          Use default MSX1 palette
    custom        Generate a custom palette and add it to the output file
    input n [c1 c2 ...] Use the following colors for conversion
 --palcount n     Number of color in the custom palette to create (default: 15)
 --paloff n       Index offset of the palette (default: 1)
 --pal24          Use 24-bits palette (for v9990; default: false)
 -dither ?        Dithering method (for 1-bit color only)
    none          No dithering (default)
    floyd         Floyd & Steinberg error diffusion algorithm
    bayer4        Bayer ordered dispersed dot dithering (order 2 – 4x4 - dithering matrix)
    bayer8        Bayer ordered dispersed dot dithering (order 3 – 8x8 - dithering matrix)
    bayer16       Bayer ordered dispersed dot dithering (order 4 – 16x16 dithering matrix)
    cluster6      Ordered clustered dot dithering (order 3 - 6x6 matrix)
    cluster8      Ordered clustered dot dithering (order 4 - 8x8 matrix)
    cluster16     Ordered clustered dot dithering (order 8 - 16x16 matrix)

Transformations
 -vflip           Vertical flip
 -hflip           Horizontal flip
 -rot x           Rotate image by X° (positive integer value)
 -resize x y      Resize the image to the given width & height (before starting export)
 -filter ?        Resize image filter
    box           Box, pulse, Fourier window, 1st order (constant) B-Spline
    bilinear      Bilinear filter
    bspline       4th order(cubic) B - Spline
    bicubic       Mitchell and Netravali's two-param cubic filter
    catmull       Catmull - Rom spline, Overhauser spline (default)
    lanczos       Lanczos - windowed sinc filter
 -compress ?
    none          No compression (default)
    crop16        Crop image to non transparent area (4-bits, max size 16x16)
    cropline16    Crop image to non transparent area (4-bits per line, max size 16x16)
    crop32        Crop image to non transparent area (5-bits, max size 32x32)
    cropline32    Crop image to non transparent area (5-bits per line, max size 32x32)
    crop256       Crop image to non transparent area (8-bits, max size 256x256)
    cropline256   Crop image to non transparent area (8-bits per line, max size 256x256)
    rle0          Run-length encoding of transparent blocs (7-bits for block length)
    rle4          Run-length encoding for all colors (4-bits for block length)
    rle8          Run-length encoding for all colors (8-bits for block length)
    rlep          Pattern based run-length encoding (6-bits for block length)
    auto          Determine a good compression method according to parameters
    best          Search for best compressor according to input parameters (smallest data)
    pletter       Pletter v0.5c1 by XL2S Entertainment
 -skip            Skip empty sprites (default: false)

Exporter options:
 -data ?          Text format for numbers
    dec           Decimal data (c & asm)
    hexa          Default hexadecimal data (depend on langage; default)
    hexa0x        Hexadecimal data (0xFF; c & asm)
    hexaH         Hexadecimal data (0FFh; asm only)
    hexa$         Hexadecimal data ($FF; asm only)
    hexa#         Hexadecimal data (#FF; asm only)
    bin           Binary data (11001100b; asm only)
 -asm ?           Assembler number format
    sdasz80       SDCC format (default)
    tniasm        tniASM format
    asmsx         asMSX format
    sjasm         Sjasm format
 -idx             Add images index table (default: false)
 -notitle         Remove the ASCII-art title in top of exported text file
 -copy (file)     Add copyright information from text file
                  If file name is empty, search for <inputFile>.txt
 -head            Add a header table contening input parameters (default: false)
 -bload           Add header for BLOAD image (default: false)
 -font x y f l    Add font header (default: false)
                  x/y: Font width/heigt in pixels
                  f/l: ASCII code of the first/last character to export
                  Can be character (like: &) or hexadecimal value (0xFF format)
 -at x            Data starting address (can be decimal or hexadecimal starting with '0x')
 -def             Add defines for each table
 -ret0            Program return 0 for success instead of data size (default: data size)

GM1 & GM2 specific options:
 -offset x        Offset of layout index for GM1 et GM2 mode (default: 0)
 --tilesComp      Compress also names/layout table (default: false)
 --tilesUnique    Export all tiles as unique (default: false)
 --noTilesName    Exclude name table (default: false)
 --noTilesPattern Exclude pattern table (default: false)
 --noTilesColor   Exclude color table (default: false)

MGLV options:
 -mglvHead x      File header
    full          Full data header (default)
    short         Short data header without image information
    none          No header
 -mglvSeg x       Segment size (default: 8)
 -mglvFreq x      Movie frequency (default: 60)
 -mglvTime x      Duration of image in screen frames (default: 5, for 12 fps at 60 Hz)
 -mglvLoop        
 -mglvMinSkip x   Minimal size of skip chunk (default: 8)
 -mglvMinFill x   Minimal size of fill chunk (default: 60)

MSX Screen Modes

List of MSX screen modes and the parameter to be used with MSXimg to converter image to the mode's color format.

Mode Desc. MSXimg parameters
MSX1 - TMS9918
Screen 0 256x192, 40x24 tiles (6x8), 256 patterns, 2 colors Not supported
Screen 1 256x192, 32x24 tiles (8x8), 256 patterns, 2 colors per tile (from 32 combinations) -mode gm1 -pal msx1
Screen 2 256x192, 32x24 tiles (8x8), 2 colors per 8x1 pixels -mode gm2 -pal msx1
Screen 3 64x48, 16 colors Not supported
MSX2 - V9938
Screen 0 256x212, 80x24 tiles (6x8), 4 colors palette Not supported
Screen 4 256x212, 32x26.5 tiles (8x8), 2 colors palette per 8x1 pixels -mode gm2 -pal custom
Screen 5 256x212, 16 colors palette -mode bmp -bpc 4 -pal custom
Screen 6 512x212, 4 colors palette -mode bmp -bpc 2 -pal custom
Screen 7 512x212, 16 colors palette -mode bmp -bpc 4 -pal custom
Screen 8 256x212, 256 colors RGB (G3,R3,B2) -mode bmp -bpc 8
MSX2+ - V9958
Screen 10 256x212, 12499 colors YJK per 4x1 pixels + 16 colors palette Not supported
Screen 12 256x212, 19268 colors YJK per 4x1 pixels Not supported
V9990
P1 (PP) 256x212, 30 colors palette -mode bmp -bpc 4 -pal custom --pal24
P2 (PP) 512x212, 15 colors palette -mode bmp -bpc 4 -pal custom --pal24
B0-B7 (BP2) 192x240 ~ 1024x424, 4 colors palette -mode bmp -bpc 2 -pal custom --pal24
B0-B7 (BP4) 192x240 ~ 1024x424, 16 colors palette -mode bmp -bpc 4 -pal custom --pal24
B0-B3 (BP6) 192x240 ~ 512x424, 64 colors palette Not supported
B0-B3 (BD8) 192x240 ~ 512x424, 256 colors RGB (G3,R3,B2) -mode bmp -bpc 8
B0-B3 (BYUVP) 192x240 ~ 512x424, 12499 colors YUV per 4x1 pixels + 16 colors palette Not supported
B0-B3 (BYUV) 192x240 ~ 512x424,, 19268 colors YUV per 4x1 pixels Not supported
B0-B3 (BYJKP) 192x240 ~ 512x424, 12499 colors YJK per 4x1 pixels + 16 colors palette Not supported
B0-B3 (BYJK) 192x240 ~ 512x424, 19268 colors YJK per 4x1 pixels Not supported
B0-B3 (BD16) 192x240 ~ 512x424, 32768 colors RGB (G5,R5,B5) -mode bmp -bpc 16