|
Nod5
|
 |
« on: March 12, 2009, 05:15:20 PM » |
|
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.  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)
|
|
|
|
« Last Edit: March 12, 2009, 05:26:41 PM by Nod5 »
|
Logged
|
|
|
|
|
Ehtyar
|
 |
« Reply #1 on: March 12, 2009, 11:46:40 PM » |
|
GIMP is not the place for batch image processing. I would recommend you try something like ImageMagick. Ehtyar.
|
|
|
|
|
Logged
|
|
|
|
|
Nod5
|
 |
« Reply #2 on: March 13, 2009, 02:13:05 AM » |
|
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.
|
|
|
|
|
Logged
|
|
|
|
|
|
ewemoa
|
 |
« Reply #3 on: March 13, 2009, 03:52:33 AM » |
|
Perhaps the following will get the ball rolling: 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.or...topic.php?f=8&t=12926
|
|
|
|
|
Logged
|
|
|
|
|
Nod5
|
 |
« Reply #4 on: March 13, 2009, 05:34:04 PM » |
|
Great, that got me going a bit! Rotation: done. Split in halfs: problems. This gives me one of the two pages on each image. But crops away the other. [ copy or print] 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/sc...e-processing.php#geometryWhen 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? [ copy or print] 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""
|
|
|
|
« Last Edit: March 13, 2009, 06:01:10 PM by Nod5 »
|
Logged
|
|
|
|
|
Ehtyar
|
 |
« Reply #5 on: March 13, 2009, 05:56:21 PM » |
|
Perhaps if you supplied a sample image we'd be more able to help you with actual command lines.
Ehtyar.
|
|
|
|
|
Logged
|
|
|
|
|
Nod5
|
 |
« Reply #6 on: March 13, 2009, 06:17:17 PM » |
|
I'm attaching a mockup file that roughly illustrates the format of the input (I used imagemagick to join two tiffs together... so I'm slowly learning something  )
|
|
|
« Last Edit: March 13, 2009, 06:21:16 PM by Nod5 »
|
Logged
|
|
|
|
|
|
|
Nod5
|
 |
« Reply #8 on: March 14, 2009, 05:58:16 AM » |
|
TIFFRotateSplitMakePDF v090314, http://nod5.dcmembers.com...ffrotatesplitmakepdf.htmlby Nod5, with help from ewemoa input: multiimage file.tif with two scanned pages per image (= a bookspread, tilted 90 degrees) what the script does: rotate 90 degrees, split each image in two (L/R page), output file.pdf with all split images in page order tiffrotatesplitmakepdf.zip contains .exe , .ahk (source) and md5 hashes. made in Autohotkey. requires: http://www.imagemagick.org/ Thank you ewemoa! 
|
|
|
|
|
Logged
|
|
|
|
|
ewemoa
|
 |
« Reply #9 on: March 14, 2009, 06:32:18 AM » |
|
Congratulations! Glad that it's working for you  (Thanks to Ehtyar for bringing up ImageMagick -- it's been years since I've used it -- didn't know there was a Windows port!)
|
|
|
|
|
Logged
|
|
|
|
|
|
|
mouser
|
 |
« Reply #11 on: March 14, 2009, 06:53:47 AM » |
|
nice 
|
|
|
|
|
Logged
|
|
|
|
|
Ehtyar
|
 |
« Reply #12 on: March 14, 2009, 03:58:08 PM » |
|
No probs guys. I ran across it when I started using PHP, ImageMagick does a much better job than GD. The way GraphicsMagick talks itself up is interesting, I can't imagine all their claims can be justified as easily as they're spoken.
Nice job Nod5.
Ehtyar.
|
|
|
|
|
Logged
|
|
|
|
|
davisjt1977
|
 |
« Reply #13 on: March 18, 2009, 01:28:16 AM » |
|
Just starting. This script is exactly what I need. Have downloaded & installed AHK & ImageMagick. But get error that I have not been able to resolve. ImageMagick directory not found. Set it in TIFFRotateSplitMakePDF.ini But I have edited this file w/ complete path. Pls help thanks
|
|
|
|
Logged
|
|
|
|
|
Nod5
|
 |
« Reply #14 on: March 19, 2009, 05:19:24 PM » |
|
Welcome to DC davisjt1977! The default ini is a bit confusing - you have to remove the comment character ( ; ) in it. Check if you've done that. So this won't work: [ copy or print] ;imagemagickdirectory=C:\program files\ImageMagick-6.5.0-0 this works: [ copy or print] imagemagickdirectory=C:\program files\ImageMagick-6.5.0-0 edit: I've now updated the program so that the comment character from now on never gets added to the ini: http://nod5.dcmembers.com...ffrotatesplitmakepdf.htmlv090319 ini bugfix
|
|
|
|
« Last Edit: March 19, 2009, 05:26:51 PM by Nod5 »
|
Logged
|
|
|
|
|
davisjt1977
|
 |
« Reply #15 on: April 23, 2009, 09:44:44 AM » |
|
Thanks Got it working This is a fantastic tool & I have customized it to my situation. 
|
|
|
|
|
Logged
|
|
|
|
|
Nod5
|
 |
« Reply #16 on: April 24, 2009, 03:21:47 AM » |
|
Cool! If you think any customization you add might be useful to others too then just post the code and I'll see if I can add it to the program. 
|
|
|
|
|
Logged
|
|
|
|
|
ewemoa
|
 |
« Reply #17 on: September 01, 2011, 10:10:48 PM » |
|
FWIW, I recently had occasion to reuse the splitting functionality described earlier in this topic: convert inputimage.extension -gravity east -crop 50%x100% outputimage.extension To get at the other half, I used: [ copy or print] convert inputimage.extension -gravity west -crop 50%x100% outputimage.extension Using the +repage option seemed to give better results as well: [ copy or print] convert inputimage.extension -gravity east -crop 50%x100% +repage outputimage.extension convert inputimage.extension -gravity west -crop 50%x100% +repage outputimage.extension FWIW, it may be that +repage is only of relevance to one of the two invocations. This was in the context of transforming an existing PDF somewhat similar in format to the TIFF described. The original PDF in this case had side-by-side pages (instead of one above another) on each page (so no rotation required). Perhaps the original program can be modified to operate on such PDFs 
|
|
|
|
« Last Edit: September 01, 2011, 10:14:42 PM by ewemoa »
|
Logged
|
|
|
|
|