diff --git a/README.md b/README.md index e849a22..b9ddfd1 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Martine generates a lot of differents files, which allow you to find the format ### files generated : * .win or .scr sprite or screen files - * .pal or .ink palette file (.ink will be generated if the -p option is set) + * .pal or .ink palette file (.ink will be generated if the -plus option is set) * .txt ascii file with palettes values (firmware values and basic values), and screen byte values * c.txt ascii file with palettes values (firmware values and basic values), and screen byte values by column * .json json file with palettes values (firmware values and basic values), and screen byte values @@ -50,15 +50,15 @@ Martine generates a lot of differents files, which allow you to find the format ## Options ### additionnals options available : * -dsk will generate a dsk file and add all amsdos files will be added. -* -n will remove amsdos headers from the amsdos files -* -f will generate overscan screen amsdos file -* -p will generate a CPC plus screen amsdos file -* -h will generate sprite of x pixel high -* -w will generate sprite of x pixel wide -* -s to define the byte token will be replace the byte token in the ascii files -* -a to set the algorithm to downsize the image -* -m to define the screen mode 0,1,2 -* -o to set the output directory (is not exists, martine will create the folder). +* -noheader will remove amsdos headers from the amsdos files +* -fullscreen will generate overscan screen amsdos file +* -plus will generate a CPC plus screen amsdos file +* -height will generate sprite of x pixel high +* -width will generate sprite of x pixel wide +* -statement to define the byte token will be replace the byte token in the ascii files +* -algo to set the algorithm to downsize the image +* -mode to define the screen mode 0,1,2 +* -out to set the output directory (is not exists, martine will create the folder). * -z compress the image .scr / .win (not overscan) using the algorithm. * -zigzag will generate data output as zigzag. * -scanlinesequence will generate the lines following the input sequence such as 0,7,1,2,3,4,5,6 for instance. @@ -73,7 +73,7 @@ Martine generates a lot of differents files, which allow you to find the format * -sna copy output files in a new CPC image Sna. * -reducer reducing color filter (3 gradients are available) * -mask string - Mask to apply on each bit of the sprite (to apply an and operation on each pixel with the value #AA [in hexdecimal: #AA or 0xAA, in decimal: 170] ex: martine -i myimage.png -w 40 -h 80 -mask #AA -m 0 -maskand) + Mask to apply on each bit of the sprite (to apply an and operation on each pixel with the value #AA [in hexdecimal: #AA or 0xAA, in decimal: 170] ex: martine -in myimage.png -width 40 -height 80 -mask #AA -mode 0 -maskand) * -maskand Will apply an AND operation on each byte with the mask * -maskor Will apply an OR operation on each byte with the mask * -tilemap @@ -108,213 +108,243 @@ Usage and options : ``` ./martine martine convert (jpeg, png format) image to Amstrad cpc screen (even overscan) -By Impact Sid (Version:0.25rc) +By Impact Sid (Version:0.29) Special thanks to @Ast (for his support), @Siko and @Tronic for ideas usage : - -a int - Algorithm to resize the image (available : - 1: NearestNeighbor (default) - 2: CatmullRom - 3: Lanczos - 4: Linear - 5: Box - 6: Hermite - 7: BSpline - 8: Hamming - 9: Hann - 10: Gaussian - 11: Blackman - 12: Bartlett - 13: Welch - 14: Cosine - 15: MitchellNetravali - (default 1) -address string - Starting address to display sprite in delta packing (default "0xC000") + Starting address to display sprite in delta packing (default "0xC000") + -algo int + Algorithm to resize the image (available : + 1: NearestNeighbor (default) + 2: CatmullRom + 3: Lanczos + 4: Linear + 5: Box + 6: Hermite + 7: BSpline + 8: Hamming + 9: Hann + 10: Gaussian + 11: Blackman + 12: Bartlett + 13: Welch + 14: Cosine + 15: MitchellNetravali + (default 1) -animate - Will produce an full screen with all sprite on the same image (add -i image.gif or -i *.png) + Will produce an full screen with all sprite on the same image (add -in image.gif or -in *.png) -autoexec - Execute on your remote CPC the screen file or basic file. + Execute on your remote CPC the screen file or basic file. + -brightness int + apply brightness on the color of the palette on amstrad plus screen. (max value 100 and only on CPC PLUS). + -contrast int + apply contrast on the color of the palette on amstrad plus screen. (max value 100 and only on CPC PLUS). -delta - Delta mode: compute delta between two files (prefixed by the argument -df) - (ex: -delta -df file1.SCR -df file2.SCR -df file3.SCR). - (ex with wildcard: -delta -df file\?.SCR or -delta file\*.SCR + Delta mode: compute delta between two files (prefixed by the argument -df) + (ex: -delta -df file1.SCR -df file2.SCR -df file3.SCR). + (ex with wildcard: -delta -df file\?.SCR or -delta file\*.SCR + -deltapacking + Will generate all the animation code from the followed gif file. -df value - scr file path to add in delta mode comparison. (wildcard accepted such as ? or * file filename.) + scr file path to add in delta mode comparison. (wildcard accepted such as ? or * file filename.) -dithering int - Dithering algorithm to apply on input image - Algorithms available: - 0: FloydSteinberg - 1: JarvisJudiceNinke - 2: Stucki - 3: Atkinson - 4: Sierra - 5: SierraLite - 6: Sierra3 - 7: Bayer2 - 8: Bayer3 - 9: Bayer4 - 10: Bayer8 - (default -1) + Dithering algorithm to apply on input image + Algorithms available: + 0: FloydSteinberg + 1: JarvisJudiceNinke + 2: Stucki + 3: Atkinson + 4: Sierra + 5: SierraLite + 6: Sierra3 + 7: Bayer2 + 8: Bayer3 + 9: Bayer4 + 10: Bayer8 + (default -1) -dsk - Copy files in a new CPC image Dsk. + Copy files in a new CPC image Dsk. -egx1 - Create egx 1 output cpc image overscan (option -f) or classical (mix mode 0 / 1). - (ex before generate two images one in mode 1 et one in mode 0 - for instance : martine -i myimage.jpg -m 0 and martine -i myimage.jpg -m 1 - : -egx1 -i 1.SCR -m 0 -pal 1.PAL -i2 2.SCR -o test -m2 1 -dsk) - or - (ex automatic egx from image file : -egx1 -i input.png -m 0 -o test -dsk) + Create egx 1 output cpc image overscan (option -fullscreen) or classical (mix mode 0 / 1). + (ex before generate two images one in mode 1 et one in mode 0 + for instance : martine -in myimage.jpg -mode 0 and martine -in myimage.jpg -mode 1 + : -egx1 -in 1.SCR -mode 0 -pal 1.PAL -in2 2.SCR -out test -mode2 1 -dsk) + or + (ex automatic egx from image file : -egx1 -in input.png -mode 0 -out test -dsk) -egx2 - Create egx 2 output cpc image overscan (option -f) or classical (mix mode 1 / 2). - (ex before generate two images one in mode 1 et one in mode 2 - for instance : martine -i myimage.jpg -m 0 and martine -i myimage.jpg -m 1 - : -egx2 -i 1.SCR -m 0 -pal 1.PAL -i2 2.SCR -o test -m2 1 -dsk) - or - (ex automatic egx from image file : -egx2 -i input.png -m 0 -o test -dsk) + Create egx 2 output cpc image overscan (option -fullscreen) or classical (mix mode 1 / 2). + (ex before generate two images one in mode 1 et one in mode 2 + for instance : martine -in myimage.jpg -mode 0 and martine -in myimage.jpg -mode 1 + : -egx2 -in 1.SCR -mode 0 -pal 1.PAL -in2 2.SCR -out test -mode2 1 -dsk) + or + (ex automatic egx from image file : -egx2 -in input.png -mode 0 -out test -dsk) -extendeddsk - Export in a Extended DSK 80 tracks, 10 sectors 400 ko per face - -f Overscan mode (default no overscan) + Export in a Extended DSK 80 tracks, 10 sectors 400 ko per face + -fillout + Fill out the gif frames needed some case with deltapacking -flash - generate flash animation with two ocp screens. - (ex: -m 1 -flash -i input.png -o test -dsk) - or - (ex: -m 1 -flash -i input1.scr -pal input1.pal -m2 0 -i2 input2.scr -pal2 input2.pal -o test -dsk ) - -h int - Custom output height in pixels. (Will produce a sprite file .win) (default -1) + generate flash animation with two ocp screens. + (ex: -mode 1 -flash -in input.png -out test -dsk) + or + (ex: -mode 1 -flash -i input1.scr -pal input1.pal -mode2 0 -iin2 input2.scr -pal2 input2.pal -out test -dsk ) + -fullscreen + Overscan mode (default no overscan) + -height int + Custom output height in pixels. (Will produce a sprite file .win) (default -1) -help - Display help message + Display help message -host string - Set the ip of your M4. - -i string - Picture path of the input file. - -i2 string - Picture path of the second input file (flash mode) + Set the ip of your M4. + -imp + Will generate sprites as IMP-Catcher format (Impdraw V2). + -in string + Picture path of the input file. + -in2 string + Picture path of the second input file (flash mode) -info - Return the information of the file, associated with -pal and -win options + Return the information of the file, associated with -pal and -win options -initprocess string - Create a new empty process file. + Create a new empty process file. -ink string - Path of the palette Cpc ink file. (Apply the input ink palette on the image) + Path of the palette Cpc ink file. (Apply the input ink palette on the image) + -inkswap string + Swap ink: + for instance mode 4 (4 inks) : 0=3,1=0,2=1,3=2 + will swap in output image index 0 by 3 and 1 by 0 and so on. -iter int - Iterations number to walk in roll mode, or number of images to generate in rotation mode. (default -1) + Iterations number to walk in roll mode, or number of images to generate in rotation mode. (default -1) -iterx int - Number of tiles on a row in the input image. (default 1) + Number of tiles on a row in the input image. (default 1) -itery int - Number of tiles on a column in the input image. (default 1) + Number of tiles on a column in the input image. (default 1) + -json + Generate json format output. -keephigh int - Bit rotation on the top and keep pixels (default -1) + Bit rotation on the top and keep pixels (default -1) -keeplow int - Bit rotation on the bottom and keep pixels (default -1) + Bit rotation on the bottom and keep pixels (default -1) -kit string - Path of the palette Cpc plus Kit file. (Apply the input kit palette on the image) + Path of the palette Cpc plus Kit file. (Apply the input kit palette on the image) + -linewidth string + Line width in hexadecimal to compute the screen address in delta mode. (default "#50") -losthigh int - Bit rotation on the top and lost pixels (default -1) + Bit rotation on the top and lost pixels (default -1) -lostlow int - Bit rotation on the bottom and lost pixels (default -1) - -m int - Output mode to use : - 0 for mode0 - 1 for mode1 - 2 for mode2 - and add -f option for overscan export. - (default -1) - -m2 int - Output mode to use : - 0 for mode0 - 1 for mode1 - 2 for mode2 - mode of the second input file (flash mode) (default -1) + Bit rotation on the bottom and lost pixels (default -1) -mask string - Mask to apply on each bit of the sprite (to apply an and operation on each pixel with the value #AA [in hexdecimal: #AA or 0xAA, in decimal: 170] ex: martine -i myimage.png -w 40 -h 80 -mask #AA -m 0 -maskand) + Mask to apply on each bit of the sprite (to apply an and operation on each pixel with the value #AA [in hexdecimal: #AA or 0xAA, in decimal: 170] ex: martine -in myimage.png -width 40 -height 80 -mask #AA -mode 0 -maskand) -maskand - Will apply an AND operation on each byte with the mask + Will apply an AND operation on each byte with the mask -maskor - Will apply an OR operation on each byte with the mask + Will apply an OR operation on each byte with the mask + -mode int + Output mode to use : + 0 for mode0 + 1 for mode1 + 2 for mode2 + and add -fullscreen option for overscan export. + (default -1) + -mode2 int + Output mode to use : + 0 for mode0 + 1 for mode1 + 2 for mode2 + mode of the second input file (flash mode) (default -1) -multiplier float - Error dithering multiplier. (default 1.18) - -n No amsdos header for all files (default amsdos header added). - -o string - Output directory - -p Plus mode (means generate an image for CPC Plus Screen) + Error dithering multiplier. (default 1.18) + -noheader + No amsdos header for all files (default amsdos header added). + -oneline + Display every other line. + -onerow + Display every other row. + -out string + Output directory -pal string - Apply the input palette to the image + Apply the input palette to the image -pal2 string - Apply the input palette to the second image (flash mode) + Apply the input palette to the second image (flash mode) + -plus + Plus mode (means generate an image for CPC Plus Screen) -processfile string - Process file path to apply. + Process file path to apply. -quantization - Use additionnal quantization for dithering. + Use additionnal quantization for dithering. -reducer int - Reducer mask will reduce original image colors. Available : - 1 : lower - 2 : medium - 3 : strong - (default -1) + Reducer mask will reduce original image colors. Available : + 1 : lower + 2 : medium + 3 : strong + (default -1) -remotepath string - Remote path on your M4 where you want to copy your files. + Remote path on your M4 where you want to copy your files. -reverse - Transform .scr (overscan or not) file with palette (pal or kit file) into png file + Transform .scr (overscan or not) file with palette (pal or kit file) into png file -rla int - Bit rotation on the left and keep pixels (default -1) + Bit rotation on the left and keep pixels (default -1) -roll - Roll mode allow to walk and walk into the input file, associated with rla,rra,sra,sla, keephigh, keeplow, losthigh or lostlow options. + Roll mode allow to walk and walk into the input file, associated with rla,rra,sra,sla, keephigh, keeplow, losthigh or lostlow options. -rotate - Allow rotation on the input image, the input image must be a square (width equals height) + Allow rotation on the input image, the input image must be a square (width equals height) -rotate3d - Allow 3d rotation on the input image, the input image must be a square (width equals height) + Allow 3d rotation on the input image, the input image must be a square (width equals height) -rotate3dtype int - Rotation type : - 1 rotate on X axis - 2 rotate on Y axis - 3 rotate reverse X axis - 4 rotate left to right on Y axis - 5 diagonal rotation on X axis - 6 diagonal rotation on Y axis - + Rotation type : + 1 rotate on X axis + 2 rotate on Y axis + 3 rotate reverse X axis + 4 rotate left to right on Y axis + 5 diagonal rotation on X axis + 6 diagonal rotation on Y axis + -rotate3dx0 int - X0 coordinate to apply in 3d rotation (default width of the image/2) (default -1) + X0 coordinate to apply in 3d rotation (default width of the image/2) (default -1) -rotate3dy0 int - Y0 coordinate to apply in 3d rotation (default height of the image/2) (default -1) + Y0 coordinate to apply in 3d rotation (default height of the image/2) (default -1) -rra int - Bit rotation on the right and keep pixels (default -1) - -s string - Byte statement to replace in ascii export (default is db), you can replace or instance by defb or byte + Bit rotation on the right and keep pixels (default -1) -scanlinesequence string - Scanline sequence to apply on sprite. for instance : - martine -i myimage.jpg -w 4 -h 4 -scanlinesequence 0,2,1,3 - will generate a sprite stored with lines order 0 2 1 and 3. - + Scanline sequence to apply on sprite. for instance : + martine -in myimage.jpg -width 4 -height 4 -scanlinesequence 0,2,1,3 + will generate a sprite stored with lines order 0 2 1 and 3. + -sla int - Bit rotation on the left and lost pixels (default -1) + Bit rotation on the left and lost pixels (default -1) -sna - Copy files in a new CPC image Sna. + Copy files in a new CPC image Sna. -splitrasters - Create Split rastered image. (Will produce Overscan output file and .SPL with split rasters file) + Create Split rastered image. (Will produce Overscan output file and .SPL with split rasters file) -spritehard - Generate sprite hard for cpc plus. + Generate sprite hard for cpc plus. -sra int - Bit rotation on the right and lost pixels (default -1) + Bit rotation on the right and lost pixels (default -1) + -statement string + Byte statement to replace in ascii export (default is db), you can replace or instance by defb or byte -tile - Tile mode to create multiples sprites from a same image. + Tile mode to create multiples sprites from a same image. -tilemap - Analyse the input image and generate the tiles, the tile map and gloabl schema. + Analyse the input image and generate the tiles, the tile map and global schema. + for instance: martine -in board.png -mode 0 -width 8 -height 8 -out folder -dsk + + -txt + Generate text format output. -version - print martine's version - -w int - Custom output width in pixels. (Will produce a sprite file .win) (default -1) + print martine's version + -width int + Custom output width in pixels. (Will produce a sprite file .win) (default -1) -win string - Filepath of the ocp win file + Filepath of the ocp win file -z int - Compression algorithm : - 1: rle (default) - 2: rle 16bits - 3: Lz4 Classic - 4: Lz4 Raw - (default -1) + Compression algorithm : + 1: rle (default) + 2: rle 16bits + 3: Lz4 Classic + 4: Lz4 Raw + 5: zx0 crunch + (default -1) -zigzag - generate data in zigzag order (inc first line and dec next line for tiles) + generate data in zigzag order (inc first line and dec next line for tiles) ``` ## Technics Principles : @@ -335,22 +365,22 @@ examples : * convert samples/Batman-Neal-Adams.jpg * in mode 0 -```martine -i samples/Batman-Neal-Adams.jpg -m 0``` +```martine -in samples/Batman-Neal-Adams.jpg -mode 0``` * in mode 1 -```martine -i samples/Batman-Neal-Adams.jpg -m 1``` +```martine -in samples/Batman-Neal-Adams.jpg -mode 1``` * in mode 2 -```martine -i samples/Batman-Neal-Adams.jpg -m 2``` +```martine -in samples/Batman-Neal-Adams.jpg -mode 2``` * in mode 0 in overscan : -```martine -i samples/Batman-Neal-Adams.jpg -m 0 -f``` +```martine -in samples/Batman-Neal-Adams.jpg -mode 0 -f``` * in mode 0 overscan for Plus series : -```martine -i samples/Batman-Neal-Adams.jpg -m 0 -f -p``` +```martine -in samples/Batman-Neal-Adams.jpg -mode 0 -fullscreen -p``` * to get sprites (40 pixels wide) -```martine -i samples/Batman-Neal-Adams.jpg -m 0 -w 40``` +```martine -in samples/Batman-Neal-Adams.jpg -mode 0 -width 40``` * roll mode to do an rra operation on the image (will create 16 sprites with a rra operation on the first pixels on the left) - ```martine -i samples/Batman-Neal-Adams.jpg -m 0 -w 40 -roll -rra 1 -iter 16``` + ```martine -in samples/Batman-Neal-Adams.jpg -mode 0 -width 40 -roll -rra 1 -iter 16``` Samples : -```martine -i samples/Batman-Neal-Adams.jpg -m 0 -f``` +```martine -in samples/Batman-Neal-Adams.jpg -mode 0 -f``` input ![samples/Batman-Neal-Adams.jpg](samples/Batman-Neal-Adams.jpg) @@ -371,7 +401,7 @@ input ![samples/Batman-Neal-Adams.jpg](samples/Batman-Neal-Adams.jpg) ### Roll : -```martine -i samples/rotate.png -m 0 -w 16 -h 16 -roll -rra 1 -iter 16``` +```martine -in samples/rotate.png -mode 0 -width 16 -height 16 -roll -rra 1 -iter 16``` input ![samples/rotate.png](samples/rotate.png) @@ -398,7 +428,7 @@ after rotate the first pixels' column in 16 differents images : with the same image, to rotate the pixels line : - ```martine -i samples/rotate.png -m 0 -w 16 -h 16 -roll -keephigh 2 -iter 16 ``` + ```martine -in samples/rotate.png -mode 0 -width 16 -height 16 -roll -keephigh 2 -iter 16 ``` will produce images : @@ -425,7 +455,7 @@ after rotate the first pixels' column in 16 differents images : this option will extract all the tiles from an image and generate the sprites files. sample usage : -```martine -i samples/tiles.png -tile -w 64 -iterx 14 -itery 7 -m 0 ``` +```martine -in samples/tiles.png -tile -width 64 -iterx 14 -itery 7 -mode 0 ``` input ![samples/rotate.png](samples/tiles.png) @@ -457,7 +487,7 @@ Warn, all sprite must have the same size. ### Rotation : This option able to rotate the input image, iter will generate the number of images. -```martine -i images/coke.jpg -rotate -iter 16 -o test -m 1 -w 32 -h 32``` +```martine -in images/coke.jpg -rotate -iter 16 -out test -mode 1 -width 32 -height 32``` Input : ![samples/coke.jpg](samples/coke.jpg) @@ -466,7 +496,7 @@ results : ![samples/coke.igf](samples/coke.gif) ### 3D_rotation This option able to rotate the input image on an axis (X or Y and even on a diagonal), iter will generate the number of images. -```./martine -m 0 -w 64 -h 64 -rotate3d -rotate3dtype 2 -o test/ -i images/sonic.png -iter 12``` +```./martine -mode 0 -width 64 -height 64 -rotate3d -rotate3dtype 2 -out test/ -in images/sonic.png -iter 12``` Input : ![samples/sonic.png](samples/sonic.png) @@ -477,7 +507,7 @@ Results: ![samples/sonic_rotate.png](samples/sonic_rotate.gif) ### tilemap This option allows to create allow tiles and tile map from the input image. If for instance you use the mario level 1 like this : ![samples/mario-level1.png](samples/mario-level1.png) -```martine -i mario-level1.png -w 16 -h 16 -tilemap -o Mario-level1``` +```martine -in mario-level1.png -width 16 -height 16 -tilemap -out Mario-level1``` By this command line, martine will analyse the image to find all tiles 16 pixels high and 16 pixels wide. It will keep in memory the tile position to produce the tile map. ![samples/mario-level1/tilesmap_schema.png](samples/mario-level1/tilesmap_schema.png) @@ -532,8 +562,8 @@ In this example I will use this image : So you need to generate two images in differents modes such as follow : ``` -martine -i images/bwind.jpg -m 0 -o egx_bwind/mode0 -f -martine -i images/bwind.jpg -m 1 -dithering 10 -o egx_bwind/mode1 -f +martine -in images/bwind.jpg -mode 0 -out egx_bwind/mode0 -f +martine -in images/bwind.jpg -mode 1 -dithering 10 -out egx_bwind/mode1 -f ``` results : * mode 0 ![mode 0](samples/egx_bwind/mode0/bwind.jpg_down.png) @@ -543,14 +573,14 @@ It's important to generate in differents folders, martine will erase the files g Now create the egx file by the command : ``` -martine -egx1 -m 0 -i egx_bwind/mode0/BWINND.SCR -m2 1 -i2 egx_bwind/mode1/BWINND.SCR -o egx_bwind/ -pal egx_bwind/mode0/BWINND.PAL -f -dsk +martine -egx1 -mode 0 -in egx_bwind/mode0/BWINND.SCR -m2 1 -i2 egx_bwind/mode1/BWINND.SCR -out egx_bwind/ -pal egx_bwind/mode0/BWINND.PAL -fullscreen -dsk ``` will produce ![](samples/bwind_egx.png) Some explanations :
I choose here to be in full screen (option -f). -martine needs to know the two modes of each input images (here -m 0 mode 0 for the first image, -m2 1 mode 1 for the second image).
--i and -i2 for the .scr images.
+martine needs to know the two modes of each input images (here -mode 0 mode 0 for the first image, -m2 1 mode 1 for the second image).
+-in and -i2 for the .scr images.
And the palette path option -pal.
You can note that martine allows you to choose you own palette. You can modify your palette to have a different rendering.
If you want to iterate and gets the results quickly on your own machine, I advise you to add the M4 option and use the sna output.
@@ -588,21 +618,21 @@ Extract image from gif (same convert binary):
Now create your reference palette :
-```martine -m 0 -i images/m00.png -o reference -dsk``` +```martine -mode 0 -in images/m00.png -out reference -dsk``` Iterate on all png to create sprite for each images :
-```for i in images/m*.png; do martine -i "$i" -m 0 -w 50 -h 50 -o sprites -pal reference/M000.PAL ; done ``` +```for i in images/m*.png; do martine -in "$i" -mode 0 -width 50 -height 50 -out sprites -pal reference/M000.PAL ; done ``` You will obtain in the sprites folder all sprites. Compute the difference between images and ouput screen address (here the sprite will start at the address #D005): -```martine -delta -df sprites/\*.WIN -o delta -address "#D005" -json``` +```martine -delta -df sprites/\*.WIN -out delta -address "#D005" -json``` Format your data : -```prepare_delta -sprite sprites/m00.json -m 0 -delta delta/\*.json -out data.asm ``` +```prepare_delta -sprite sprites/m00.json -mode 0 -delta delta/\*.json -out data.asm ``` The assembly code can be compiled with Rasm from Roudoudou : ```