Maybe someone can offer little help
I modified this script for 2 runs - one for aspect with widht (as original), and second to generate thumbs 56x75 px
I also tried to rename output files
Script works with image, but no output appears
Code:
@echo off rem ******************* rem * BatchResize.cmd * rem ******************* rem Drag and drop a folder or folder structure to this script and IrfanView will rem resize all pictures of the given file type to the given pixel size. Smaller rem pictures will not be touched. rem Also the jpeg quality could be set. cls setlocal rem Check parameter if "%~1"=="" goto noparam rem Path to Irfan view rem Path to IrfanView on x86 Windows set iview="%ProgramFiles%\IrfanView\i_view64.exe" rem<--- this was also change if not exist %iview% goto noIview rem File type set filetype=*.jpg rem Width set width=1024 rem JPEG quality set quality=80 rem temporaery file set tmpfile="%temp%\imageinfo.txt" echo Converting... for /r "%~1" %%a in (%filetype%) do call :Resize "%%a" echo. echo Finished converting. rem Second run for mini rem added this set width=75 set height=56 echo Convert mini for /r "%~1" %%a in (%filetype%) do call :Resize2 "%%a" rem After finishing go to the end goto end :noparam echo No path given! goto end rem IrfanView could not be found. :noiview echo IrfanView not found in the given path: echo %iview% goto end :resize echo Checking file "%~1" start /wait "IrfanView" %iview% %1 /info=%tmpfile% set imagewidth=0 for /f "tokens=4 delims= " %%b in ('type %tmpfile% ^| find /i "image dimensions"') do set /a imagewidth=%%b if "%imagewidth%" gtr "%width%" ( echo Resizing file "%~1" start /wait "IView" %iview% "%~1" rename_pattern=## /resize_long=%width% /aspectratio /resample /jpgq=%quality% /convert="%~1" rem pattern here and below ) goto :eof :resize2 echo Checking file "%~1" start /wait "IrfanView" %iview% %1 /info=%tmpfile% set imagewidth=0 for /f "tokens=4 delims= " %%b in ('type %tmpfile% ^| find /i "image dimensions"') do set /a imagewidth=%%b if "%imagewidth%" gtr "%width%" ( echo Resizing file "%~1" start /wait "IView" %iview% "%~1" /rename_pattern=m## /resize_width=%width% /resize_height=%height% /resample /jpgq=%quality% /convert="%~1" ) goto :eof rem End of the script :end if exist %tmpfile% del %tmpfile% pause endlocal
Leave a comment: