/ Published in: DOS Batch
Worked great for trimming margins in scanned comics and books, much easier and faster than complex photoshop scripts. :)
1. Download & install ImageMagick from http://www.imagemagick.org/script/binary-releases.php#windows.
This is a command line utility to work with images. No ads, toolbars and other crap. It is freeware and open source.
You need file named ImageMagick--windows-static.exe
2. Create new file conv.bat with this snippet inside in a folder with images and launch it.
This will automatically trim all images in this folder and all its subfolders.
3. Optionally you can set different extension if you need to crop something other than jpegs's, and increase color tolerance - to detect larger borders. There are also other settings, like cropping only borders of certain color - you can read full documentation at http://www.imagemagick.org/Usage/crop/#trim .
It will also work on Linux and Mac since ImageMagick is a crossplatform tool, but you will have to modify .bat file to be compatible with Bash syntax.
1. Download & install ImageMagick from http://www.imagemagick.org/script/binary-releases.php#windows.
This is a command line utility to work with images. No ads, toolbars and other crap. It is freeware and open source.
You need file named ImageMagick--windows-static.exe
2. Create new file conv.bat with this snippet inside in a folder with images and launch it.
This will automatically trim all images in this folder and all its subfolders.
3. Optionally you can set different extension if you need to crop something other than jpegs's, and increase color tolerance - to detect larger borders. There are also other settings, like cropping only borders of certain color - you can read full documentation at http://www.imagemagick.org/Usage/crop/#trim .
It will also work on Linux and Mac since ImageMagick is a crossplatform tool, but you will have to modify .bat file to be compatible with Bash syntax.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
@echo off rem 1. Download & install ImageMagick from http://www.imagemagick.org/script/binary-releases.php#windows. rem This is a command line utility to work with images. No ads, toolbars and other crap. It is freeware and open source. rem You need file named ImageMagick-<version number>-windows-static.exe rem rem 2. Create new file conv.bat with this snippet inside in a folder with images. rem This will automatically trim all images in this folder and all its subfolders. rem Settings : rem Images extension rem jp*g will match both .jpg's and .jpeg's set extension=jp*g rem How much tolerance when matching color in percents rem Larger tolerance = broader color range is regarded same and trimmed rem Zero will mach only one exact color, use it for perfectly clean images in lossless formats (png, tif etc) rem Use small value for clean images in jpegs, 1%%-5%% is a good start rem More info on parameters - see http://www.imagemagick.org/Usage/crop/#trim convert "%%i" -fuzz "%tolerance%" -trim +repage "%%i" )