@echo off setlocal EnableExtensions EnableDelayedExpansion color 0f Title convert_syslinux_rev4b.bat REM updated 10/22/2014 REM Place this batch file anywhere and drag and drop the image files REM (bmp, jpg or png) to be converted on it (other image formats may not REM convert correctly). Converted files will be moved to the same directory REM as this file. REM Drag and drop single or multiple images into this batch file to convert REM them to Syslinux compatible splash images with ImageMagick. The converted REM file(s) will have the size and number of colors used appended after the REM name, and the extension(s) changed as selected. This script works for REM files only (it will not work for folders). Tested on Vista and WinXP with REM ImageMagick portable version (ImageMagick-6.8.9-7-Q16-x86-windows.zip) REM installed to the ImageMagick folder. REM CD "%~dp0" changes the working directory to the current directory (where REM this batch file is located) REM "%~n1" is the filename minus the extension REM ------------------ Set location of ImageMagick ---------------------------- REM If using the installed version of ImageMagick, paths are already set so just REM comment out the folowing line and delete %IMdir% everywhere it appears in REM this file or change the name below to your ImageMagick path. If using the REM portable version, change the directory name below. set IMdir=F:\Utilities\ImageMagick\ CD "%~dp0" set cdir=%~dp0% echo. echo Current directory is: "%~dp0" echo. REM initialize count set count=0 echo Output format: echo 1. JPG echo 2. PNG echo 3. Old Syslinux 640x480 format (ver 4.4 and earlier) :ploop SET INPUT= SET /P INPUT=Select image format: IF /I "%INPUT%"=="1" set pformat=jpg&&goto colorset IF /I "%INPUT%"=="2" set pformat=png&&goto colorset IF /I "%INPUT%"=="3" set pformat=png&&goto oldsys goto ploop :oldsys :Loop2 IF [%1]==[] goto continue "%IMdir%convert" -resize 640x480 -colors 14 -depth 16 %1 "%~n1_splash.png" move "%~n1_splash.png" "%cdir%" echo "%~nx1 converted to png" echo "converted image moved to:" echo "%cdir%" set /A count+=1 echo. SHIFT goto Loop2 :colorset echo. echo Number of colors: echo 1. 14 echo 2. 24 echo 3. 256 echo 4. 2560 (slow, doesn't change orginal num of colors) echo 5. Zero (0) - keeps original num of colors. If error occurs, ^ use another option :scolors set test=false SET INPUT= SET /P INPUT=Select number of colors: IF /I "%INPUT%"=="1" set ncolor=14 IF /I "%INPUT%"=="2" set ncolor=24 IF /I "%INPUT%"=="3" set ncolor=256 IF /I "%INPUT%"=="4" set ncolor=2560 IF /I "%INPUT%"=="5" set ncolor=0 IF /I "%INPUT%" LSS 1 set test=true IF /I "%INPUT%" GTR 5 set test=true IF %test%=="true" ( echo "%INPUT%" is not valid, please select again set test=false goto scolors ) echo. echo 4:3 aspect ratio: echo 1. Resize to 640x480, %ncolor% colors echo 2. Resize to 800x600, %ncolor% colors echo 3. Resize to 1024x768, %ncolor% colors echo 4. Resize to 1280x960, %ncolor% colors echo 5. Resize to 1400x1050, %ncolor% colors echo 6. Resize to 1600x1200, %ncolor% colors echo 7. Resize to 2048x1536, %ncolor% colors echo 16:10 aspect ratio: echo 8. Resize to 1280x800, %ncolor% colors echo 9. Resize to 1440x900, %ncolor% colors echo 10. Resize to 1680x1050, %ncolor% colors echo 11. Resize to 1920x1200, %ncolor% colors echo 12. Resize to 2560x1600, %ncolor% colors echo 13. Exit :rsizeloop SET INPUT= SET /P INPUT=Select a number to start conversion: IF /I "%INPUT%"=="1" set rsize=640x480 IF /I "%INPUT%"=="2" set rsize=800x600 IF /I "%INPUT%"=="3" set rsize=1024x768 IF /I "%INPUT%"=="4" set rsize=1280x960 IF /I "%INPUT%"=="5" set rsize=1400x1050 IF /I "%INPUT%"=="6" set rsize=1600x1200 IF /I "%INPUT%"=="7" set rsize=2048x1536 IF /I "%INPUT%"=="8" set rsize=1280x800 IF /I "%INPUT%"=="9" set rsize=1440x900 IF /I "%INPUT%"=="10" set rsize=1680x1050 IF /I "%INPUT%"=="11" set rsize=1920x1200 IF /I "%INPUT%"=="12" set rsize=2560x1600 IF /I "%INPUT%"=="13" goto end echo. echo converting to %rsize%, %ncolor% colors echo. :Loop IF [%1]==[] goto continue "%IMdir%convert" -resize %rsize% -colors %ncolor% -depth 16 %1 "%~n1_%rsize%_%ncolor%.%pformat%" move "%~n1_%rsize%_%ncolor%.%pformat%" "%cdir%" echo "%~nx1 converted to %~n1_%rsize%_%ncolor%.%pformat%" echo "converted image moved to:" echo "%cdir%" echo. set /A count+=1 SHIFT goto Loop :continue echo. echo %count% conversions completed.... echo. REM line below opens output folder; optional and may be deleted or commented out REM %SystemRoot%\explorer.exe "%cdir%" :end echo. echo exiting echo. endlocal @pause REM --------------------------- exit ----------------------------------------- :end EXIT /B 0