DonationCoder.com Software > Post New Requests Here
GIMP script to batch split + rotate TIFF images
Nod5:
I request a GIMP script that will batch split and then rotate TIFF images.
I will make a bunch of scans as TIFF images (two booklet sized pages on each image) that I want transformed like this:
1. split in half, 2. rotated , 3. make one pdf of all the rotated, single page image files
I'm only looking for help with step 1 & 2 here.
I've briefly looked into learning GIMP scripting myself (might come in handy) but chances are someone here already knows scripting for GIMP and can kickstart me on this. :tellme:
edit: I should add that I my input for this will be one TIFF containing multiple images (not multiple separate TIFF files with one image in each)
Ehtyar:
GIMP is not the place for batch image processing. I would recommend you try something like ImageMagick.
Ehtyar.
Nod5:
Ok, but I got the impression that GIMP scripting would be pretty versatile. I've glanced at ImageMagick (and GraphicsMagick ) before but never gotten around to learn the details (or at least not learned them enough to remember them). So ok, I extend the request to them too so if anyone with experience with them can whip up a script (or rather a long command line string) to do what I'm after in step 1 & 2 then that'd be great. You see this week I have not enough spare time or spare free brain space to myself read manuals for these tools so that's why I'm making a request instead.
ewemoa:
Perhaps the following will get the ball rolling:
* http://imagemagick.org/script/mogrify.php
* http://imagemagick.org/script/command-line-options.php#rotate
* http://imagemagick.org/script/command-line-options.php#crop
* http://imagemagick.org/script/command-line-options.php#extract
* http://imagemagick.org/script/command-line-processing.php#geometry
Translated -- how about something like the following?
* use mogrify to rotate
* use mogrify with crop or extract to get at one page
* use mogrify with crop or extract to get at the other page
Perhaps there are other options to mogrify that would be better choices :)
Don't know what platform is relevant here, but if it's Windows, may be the following will be of some use:
http://www.imagemagick.org/discourse-server/viewtopic.php?f=8&t=12926
Nod5:
Great, that got me going a bit! Rotation: done.
--- ---mogrify.exe -rotate -90 "___filepath___"Split in halfs: problems. This gives me one of the two pages on each image. But crops away the other.
--- ---mogrify.exe -rotate -90 -crop 100%x50% "___filepath___"But I can't yet grasp how to target the right half of the image via the geometry option
http://imagemagick.org/script/command-line-processing.php#geometry
When I've sorted the blanks I think this strategy would work (done in steps via AHK):
1. make two copies of the TIFF
2. on copy1 do -rotate -90 -crop 100%x50%
3. on copy2 do __________ [crop that leaves the right hand half of the image]
4. _______ thus combining them like this: copy1subimage1, copy2subimage1, copy1subimage2, ... (or extract them and name the output in that order)
5. make pdf
edit:
on second thought, rotate upside down, chop , rotate back should do it.
Tried to put it together in AHK but it is not running. Some error in the AHK code I think. Time to sleep, I'll try again tomorrow. Anyone else spotting errors?
--- ---FileCopy, %1%, 1.tiff
FileCopy, %1%, 2.tiff
mogpath = C:\test\ImageMagick-6.5.0-0\mogrify.exe
RunWait, %comspec% /c ""%mogpath%" -rotate -90 -chop 50x0`%
"%A_Scriptdir%\1.tif""
RunWait, %comspec% /c ""%mogpath%" -rotate 90 "%A_Scriptdir%\2.tif""
RunWait, %comspec% /c ""%mogpath%" -chop 50x0`%
"%A_Scriptdir%\2.tif""
RunWait, %comspec% /c ""%mogpath%" -rotate 180 "%A_Scriptdir%\2.tif""
Navigation
[0] Message Index
[#] Next page
Go to full version