Add template/

This commit is contained in:
Michaelangel007 2016-08-24 09:54:08 -07:00
parent 969bd577cb
commit e3acf0b51e
2 changed files with 130 additions and 0 deletions

37
template/cvt.bat Executable file
View File

@ -0,0 +1,37 @@
@echo off
REM By the time I was done
REM I had pretty much abandoned The GIMP for ImageMagick
REM For production development of an interface version
REM I would likely use the ImageMagick API to save some time
if not exist SHRTONE\*.* mkdir SHRTONE >NUL
if not exist SH33TONE\*.* mkdir SH33TONE >NUL
if not exist SH32TONE\*.* mkdir SH32TONE >NUL
if not exist SHRPCX\*.* mkdir SHRPCX >NUL
if not exist SH32PCX\*.* mkdir SH32PCX >NUL
if not exist SH33PCX\*.* mkdir SH33PCX >NUL
if not exist SHRGREY*.* mkdir SHRGREY >NUL
if not exist PCX\*.* mkdir PCX >NUL
if not exist BMP320\*.* mkdir BMP320 >NUL
if not exist todo\*.* mkdir todo >NUL
if not exist done\*.* mkdir done >NUL
if not exist gif\*.* mkdir gif >NUL
REM call ImageMagick to make a 16 color error-diffusion dithered version
REM use as an external palette for conventional color space toning
REM in windows use pcx format for imagemagick's indexed output (for compatibility)
for %%f in (*.bmp) do call C:\IM\convert %%f -dither FloydSteinberg -colors 16 -define format:PCX PCX\%%~nf.pcx
REM Make 7 variations to choose from
REM the first will usually be the worst and unusable
for %%f in (*.bmp) do call ..\a2b %%f SHRTONE\%%f shr2 d v t i > NUL
for %%f in (*.bmp) do call ..\a2b %%f SH32TONE\%%f dic3 d v t i > NUL
REM The TONE variations are always more heavily contrasted
for %%f in (*.bmp) do call ..\a2b %%f SH33TONE\%%f drooks3 d v t i > NUL
for %%f in (*.bmp) do call ..\a2b %%f SHRPCX\%%f shr2 d v t i pPCX\%%f > NUL
for %%f in (*.bmp) do call ..\a2b %%f SH32PCX\%%f dic3 d v t i pPCX\%%f > NUL
for %%f in (*.bmp) do call ..\a2b %%f SH33PCX\%%f drooks3 d v t i pPCX\%%f > NUL
for %%f in (*.bmp) do call ..\a2b %%f SHRGREY\%%f shrgrey d v t i> NUL

93
template/cvt2bmp.bat Executable file
View File

@ -0,0 +1,93 @@
@echo off
if not exist SHRTONE\*.* mkdir SHRTONE >NUL
if not exist SH33TONE\*.* mkdir SH33TONE >NUL
if not exist SH32TONE\*.* mkdir SH32TONE >NUL
if not exist SHRPCX\*.* mkdir SHRPCX >NUL
if not exist SH32PCX\*.* mkdir SH32PCX >NUL
if not exist SH33PCX\*.* mkdir SH33PCX >NUL
if not exist SHRGREY*.* mkdir SHRGREY >NUL
if not exist PCX\*.* mkdir PCX >NUL
if not exist BMP320\*.* mkdir BMP320 >NUL
if not exist todo\*.* mkdir todo >NUL
if not exist done\*.* mkdir done >NUL
if not exist gif\*.* mkdir gif >NUL
if "%1" == "" goto BEGIN
if "%1" == "box" goto BOX
if "%1" == "BOX" goto BOX
if "%1" == "BMP" goto BMP
if "%1" == "bmp" goto BMP
goto RESIZE
REM Notes from the ImageMagick Forums about using convert (in Windows?)
convert image -resize "275x275^" -gravity center -crop 275x275+0+0 +repage resultimage
see http://www.imagemagick.org/script/comma ... p#geometry regarding ^ and other character options.
This resizes according to the smaller of your input image dimensions keeping aspect ratio. Thus the smaller dimension will end
up as 275, but the larger dimension will be larger. Thus the crop following the resize.
On Windows you may have to escape the ^ with ^ so that it is ^^ (if the quotes don't help). See
http://www.imagemagick.org/Usage/windows/
Alternately, you can resize to the larger dimension and then pad the image
convert image -resize "275x275" -gravity center -background white -extent 275x275 resultimage
Alternately, you can resize and lose aspect ratio ( and accept some distortion)
convert image -resize "275x275!" resultimage
examples are at http://www.imagemagick.org/Usage/resize/#fill
I have had some trouble with BMP conversions too. I have typically specified BMP3:outfile.bmp and I normally get 24 bit BMP
files. sometimes I get an 8 bit BMP when converting JPEG files. I just tried the -type truecolor (having seen it here) and now
it looks like I get a 24 bit BMP in the cases where I used to get only 8 bits.
I also use these switches:
-units PixelsPerInch -density 72 -compress None -depth 24
the -depth 24 should do a 24 bit BMP (the depth -8 in your case may also be causing a problem) but as I said I sometimes get 8
bits even with the 24 specified.
the -units and -density cases corrected a problem where sometimes I would get a 0 for the biXPelsPerMeter and biYPelsPerMeter
fields in the BMP header (it did not seem to cause a problem though). by the way I have not found a good explanation of these 2
fields.
the -compress None was required because sometimes a conversion generated a compressed BMP - no logical reason for doing that was
found.
REM End of Notes
:RESIZE
C:\IM\convert %1 -resize "320x200!" -type truecolor -units PixelsPerInch -density 72 -compress None -depth 24 -define format:BMP3 Resized_%1
goto ENDER
:BMP
for %%f in (*.bmp) do call C:\IM\convert %%f -resize "320x200!" -type truecolor -units PixelsPerInch -density 72 -compress None -depth 24 -define format:BMP3 BMP320\%%~nf.bmp
goto ENDER
:BOX
REM for %%f in (*.gif) do call C:\IM\convert %%f -resize "320x320" -gravity center -background black -extent 320x320 -crop 320x200+0+0 +repage -define format:BMP %%~nf.bmp
REM for %%f in (*.png) do call C:\IM\convert %%f -resize "320x320" -gravity center -background black -extent 320x320 -crop 320x200+0+0 +repage -define format:BMP %%~nf.bmp
for %%f in (*.jpg) do call C:\IM\convert %%f -resize "320x320" -gravity center -background black -extent 320x320 -crop 320x200+0+0 +repage -define format:BMP %%~nf.bmp
goto ENDER
:BEGIN
REM this next one is mostly for double dithering
for %%f in (*.pcx) do call C:\IM\convert %%f -resize "320x200!" -type truecolor -units PixelsPerInch -density 72 -compress None -depth 24 -define format:BMP3 %%~nf.bmp
for %%f in (*.gif) do call C:\IM\convert %%f -resize "320x200!" -type truecolor -units PixelsPerInch -density 72 -compress None -depth 24 -define format:BMP3 %%~nf.bmp
for %%f in (*.png) do call C:\IM\convert %%f -resize "320x200!" -type truecolor -units PixelsPerInch -density 72 -compress None -depth 24 -define format:BMP3 %%~nf.bmp
for %%f in (*.jpg) do call C:\IM\convert %%f -resize "320x200!" -define format:BMP %%~nf.bmp
:ENDER
REM this is the end