Changes

Jump to: navigation, search

Img2CPC

71 bytes added, 16:38, 8 April 2009
Img2CPC is a command line tool, developed by AugustoRuiz using C#. You will need the .NET Framework 2.0 to run it<br>&nbsp;properly.
<br>
Usage:
Usage:<br>
Img2CPC [/w=width] [/h=height] [/g] [/bn=tileBaseName] [/m=mode] [/t]&nbsp;[/f] [/o=output] [/c=80] [/cbb] files
<br>
Img2CPC [/w=width] [/h=height] [/g] [/bn=tileBaseName] [/m=mode] [/t]&nbsp;[/f] [/o=output] [/c=80] [/cbb] files   *'''w''': Tile Width. If not specified, it will process the&nbsp;whole image width.*'''h''': Tile Height. If not specified, it will process the&nbsp;whole image height.*'''g''': If specified, it will generate one bmp file per tile.*'''bn''': Base name to be used for asm labels.*'''m''': Pixel mode. Valid values are 0,1,2.&nbsp;If not specified defaults to mode 0.*'''t''': Transparency. Creates masks for transparent pixels.*'''i''': Interlace masks. Creates masks for transparent pixels, mixing them&nbsp;with sprite data.*'''f''': Flipped values LUT. Creates a look-up table with&nbsp;flipped bytes for the current mode.*'''o''': Output file name. Default value is gfx.h*'''c''': Create compiled sprites. Screen width in bytes can (should) be&nbsp;specified.&nbsp;(Default width is 80). File name will be compiled.[outputFileName]*'''cbb''': Create backcuffer compiled sprites. File name will be bb.compiled.[outputFileName]
*'''files''': List of files to process. Wildcards can be used (*.png)
<br>
You can specify Img2CPC the palette you want to use. Depending on the&nbsp;mode specified, the program will reduce the number of colors of the&nbsp;original image to 16 colors (mode 0), 4 colors (mode 1) or 2 colors&nbsp;(mode 2). To change the palette that the program uses, you can modify&nbsp;the Img2CPC.exe.config file, which is a XML file.
<br>
There is a node in&nbsp;that file like this:
There is a node in&nbsp;that file like this:<br>
  &lt;add key="PaletteColors"<br>value="244,0,244#0,0,132#0,132,132#0,244,132#132,0,0#132,132,0#132,244,0#132,0,132#132,132,132#132,244,132#0,0,0#244,132,0#244,244,0#244,132,244#132,132,244#244,244,244"/
<br>Please, do not change the key, just the value. The value of this node&nbsp;represents the palette colors in RGB, using commas to separate the&nbsp;color components, and a sharp to separate the colors.
<br>
There is another&nbsp;node like this:
There is another&nbsp;node like this:   &lt;add key="TransparentColor" value="0"/&gt;<br>
&lt;add key="TransparentColor" value="0"/&gt;
Which specifies the color that will be assumed as transparent (in this&nbsp;case, it will be the first color in the palette). This is only taken&nbsp;into account if you want to create sprites (tiles with masks) or&nbsp;precompiled sprites.<br>
Which specifies the color that will be assumed as transparent (in this&nbsp;case, it will be the first color in the palette). This is only taken&nbsp;into account if you want to create sprites (tiles with masks) or&nbsp;precompiled sprites.
<br>
The color reduction is performed using a nearest color algorithm, so&nbsp;the original image can have as many colors as you want (although you&nbsp;will get better results if the original image has the same palette you&nbsp;<br>specify in the config file). The "g" switch can be useful to check the<br>color reduction results without having to use a CPC emulator.
13
edits