Divide OR Crop Multiple Images from Single Scan
#41
Posted 25 October 2010 - 09:20 PM
That seemed to work great for me, thanks for the addition!
I didn't see it explained anywhere so if I missed it, I apologize, but what are the options:
Size Threshold
Abort Limit
Used for?
#42
Posted 12 December 2010 - 02:17 AM
/usr/lib/gimp/2.0/plug-ins/deskew: error while loading shared libraries: libgimpui-2.0.so.0: cannot open shared object file: No such file or directory
I'm running 2.6 on Karmic-amd64, so I'm guessing this plugin has a dependency on an earlier gimp lib. I'm only a budding linux guy, so a little guidance would be a big help.
#43
Posted 04 January 2011 - 04:17 PM
#44
Posted 31 March 2011 - 06:08 PM
garywitscher, on 22 November 2009 - 06:56 AM, said:
assistance in getting it all working ...
I recently used the Gimp and BatchDivideScannedImages to process 68 directories containing
310 scans into 872 photos.
I did this via the command line running Debian GNU/Linux 5.0 (it should
work the same on any system that is capable of running the Gimp). The final result after
more than 2 days of processing time (on an apple G4) gave me 868 photos. I got the
missed 4 photos by hand clipping three images that had not been completely divided.
I used a python script to 'walk' the directory structure that contained the scanned
images, creating a duplicate structure to store the photos in. For each directory of
scans I executed the following command:
gimp -ibdf '(script_fu_BatchDivideScannedImagesCL "/scanned-images-dir" 0 20 1500 5 3 100 100 "/directory-for-photos" 0 "photo-prefix_" 1)' -b '(gimp-quit 0)'
*** explanation of parameters
image- name of the dir where scanned images are located
inLayer- don't know why, just left this at zero
inThreshold- tried lots of values here (from 10-80), 20 gave me the best results
inSize- I scanned at 600px/in so I set this to 1500 to filter out unwanted selections
inLimit- don't know why, just left this at five
inCorner- the least used corner of the scanner bed (lower right for me).
inX- I used 100 to make sure I was away from the scanner edge effects
inY- I used 100 to make sure I was away from the scanner edge effects
inSaveFiles- not used for batch mode
inDir- name of the dir where the photos should be saved
inSaveType- type of image file, zero is for jpg
inFileName- add this text to the front of the filename
inFileNumber- the filename is indexed by a number (i.e. "00001"), this is the start number to use
*** other considerations and changes I made to DivideScannedImages.scm
I made some changes to the script and saved my own version as DivideScannedImagesCL.scm:
1) I commented out all references to 'display' in the script so that it wouldn't try to open
the gimp ui when processing the images. It was going to run on a headless server anyway
and it won't run at all if you use the "-i" gimp parameter with the gui enabled.
2) I added a 20 pixel radius to the background color selection code. As written the script
picks the background color from a single pixel located at X,Y. I found, that with my
scanner, picking out one pixel for the background color never gave me an accurate color.
A 20 pixel radius may be more than necessary, I had lots of room so it worked good for me.
3) I added a few lines near the start of the script that put a background border (50 pixels) around
the scanned image (using a 20 pixel radius for color selection). My scanner produces a brownish
border around the scan which will interfere with selecting any photos that are near to or pushed
up against the edge of the glass (the easiest way to align them). This border is an 'inside' border
and as such will mask the brown edge, creating a uniform background from edge to edge. It will
also clip a small edge off the photo (most photos are going to be 2500+ pixels wide anyway).
Here's the code, note the last line gives you the location where I inserted this into the script
(very near the top):
; start add inside border (gimp-selection-all img) (gimp-selection-shrink img 50) (gimp-selection-invert img) (set! drawable (car (gimp-image-get-active-drawable img))) (gimp-context-set-background (car (gimp-image-pick-color img inLayer (- width inX) (- height inY) FALSE TRUE 20))) (gimp-edit-bucket-fill-full drawable BG-BUCKET-FILL NORMAL-MODE 100 5 TRUE TRUE SELECT-CRITERION-COMPOSITE 100 100) (gimp-selection-none img) ; end add inside border ;set up saving
4) This represents near flawless accuracy in dividing scanned photos. It saved me many hours of time
I would have had to spend individually processing the scans (using the very awkward gui software that
comes with most scanners). Spend some time testing the threshold and size filters on your most
difficult scans to make sure they are effective. Really look at your scanned image background and
border before you commit to scanning large numbers of photos. You want a uniform background
color - in my opinion as white as you can get it - from edge to edge. You can adjust the scanning
software to produce the best possible background color.
5) Thank you Rob Antonishen for a wonderfully effective Gimp script.
Thanks to Rob for the original script and to you for your edits. I was looking for the CLI command and there it is.
However, I would also to use your version of the script (with the display steps commented and the 20 pixel background selection). Is there any place I can download your version from?
#45
Posted 02 April 2011 - 12:58 AM
naklinaam, on 31 March 2011 - 06:08 PM, said:
However, I would also to use your version of the script (with the display steps commented and the 20 pixel background selection). Is there any place I can download your version from?
Hi Rob,
Not sure if you still look at this forum, but if you do, I need some help.
I would like to be able to call the script from command line using a bash script. When I try to run the script in a batch mode from gimp,it works perfectly.
However, when I try to run the command from the command line, i get a message indicating that the execution was successful but it does nothing.
gimp -b '(script_fu_BatchDivideScannedImages "/media/D_DATA/ACK_tmp/" 0 20 1500 5 2 100 100 "/media/D_DATA/ACK_tmp/" 0 "photo-prefix_" 1)' -b '(gimp-quit 0)'
I removed the -idf options to see what is going on. Gimp opens up when I run the command, but it doe snot even open the files in the folder. Any suggestions?
#46
Posted 02 April 2011 - 07:36 PM
naklinaam, on 02 April 2011 - 12:58 AM, said:
Not sure if you still look at this forum, but if you do, I need some help.
I would like to be able to call the script from command line using a bash script. When I try to run the script in a batch mode from gimp,it works perfectly.
However, when I try to run the command from the command line, i get a message indicating that the execution was successful but it does nothing.
gimp -b '(script_fu_BatchDivideScannedImages "/media/D_DATA/ACK_tmp/" 0 20 1500 5 2 100 100 "/media/D_DATA/ACK_tmp/" 0 "photo-prefix_" 1)' -b '(gimp-quit 0)'
I removed the -idf options to see what is going on. Gimp opens up when I run the command, but it doe snot even open the files in the folder. Any suggestions?
I've never used it in batch mode. I'd suggest following garywitscher's instructions.
-Rob A>
#47
Posted 27 November 2011 - 05:24 AM
Are there any solutions which could quickly and easily cut my pictures in half where one image becomes another? Perhaps there's a polygon detection algorithm based on image differencing? It would be nice if the divide scanned images plug-in didn't need to rely on the whitespace between images in order to save on scanning time.
Thanks!
#48
Posted 29 November 2011 - 06:33 PM
lachoneus, on 27 November 2011 - 05:24 AM, said:
Thanks!
None I'm aware of.
If your images are all the same size there are number of de-tile scripts that can just cut up an image into rectangular regions, or along guides.
-Rob A>
#49
Posted 04 December 2011 - 04:30 AM
If I seem curt or dismissive, it's usually not because I'm trying to be. I'm just socially inept. :/
Gifts
I'll help you on two conditions:
1) I try to help, but I don't know everything, and I'm not an expert, so I might not be able to fix it.
2) If I don't respond right away, it not that I'm ignoring you, I'm just busy or something.
Oh, and I edit my posts more often than I make new ones, so use the Refresh/Reload button on your browser.
#50
Posted 04 December 2011 - 10:49 AM
#51
Posted 03 March 2012 - 02:53 PM
PhotoComix, on 04 December 2011 - 10:49 AM, said:
I come from here: http://www.gimptalk....lots-of-images/
Is there any way to get DivideScannedImages work with the "Guillotine" command? I want to set multiple "guide" lines over the scanned image and let the guillotine slice it up, but want DivideScannedImages to autosave the parts for me. is it possible? how? please tell me
#52
Posted 19 May 2012 - 12:27 PM
It is working for me in gimp 2.8 on a WinXP.
I have scanned a old photo album and will scan more.
While testing the script i encountered some problems.
1. I only get the pictures which have enough white space around. Here i hope the changes of "garywitscher" will help.
garywitscher, on 22 November 2009 - 06:56 AM, said:
http://www.gimptalk....post__p__326747
But after inserting your changes in the code, i get an error:
»Divide Scanned Images«:
Error: (<unknown> : 24249893) set!: unbound variable: drawable
Can you help me? I will also like to include your change with selecting a 20 pixel radius.
Can you send me your code?
2. I like to save the extracted pics with the same filename + a extension like "_a", "_b" and so on...
How to code that?
Thanks a lot in advance!
#53
Posted 19 May 2012 - 12:27 PM
It is working for me in gimp 2.8 on a WinXP.
I have scanned a old photo album and will scan more.
While testing the script i encountered some problems.
1. I only get the pictures which have enough white space around. Here i hope the changes of "garywitscher" will help.
garywitscher, on 22 November 2009 - 06:56 AM, said:
But after inserting your changes in the code, i get an error:
»Divide Scanned Images«:
Error: (<unknown> : 24249893) set!: unbound variable: drawable
Can you help me? I will also like to include your change with selecting a 20 pixel radius.
Can you send me your code?
2. I like to save the extracted pics with the same filename + a extension like "_a", "_b" and so on...
How to code that?
Thanks a lot in advance!
#54
Posted 19 May 2012 - 12:28 PM
It is working for me in gimp 2.8 on a WinXP.
I have scanned a old photo album and will scan more.
While testing the script i encountered some problems.
1. I only get the pictures which have enough white space around. Here i hope the changes of "garywitscher" will help.
garywitscher, on 22 November 2009 - 06:56 AM, said:
http://www.gimptalk....post__p__326747
But after inserting your changes in the code, i get an error:
»Divide Scanned Images«:
Error: (<unknown> : 24249893) set!: unbound variable: drawable
Can you help me? I will also like to include your change with selecting a 20 pixel radius.
Can you send me your code?
2. I like to save the extracted pics with the same filename + a extension like "_a", "_b" and so on...
How to code that?
Thanks a lot in advance!
#55
Posted 24 July 2012 - 08:55 AM
Anyway, I've another important issue: I see there's no quality setting for jpeg saving. It's important because I'm going to use your script with old photos I care, so I wish to use a high jpeg quality value. Would it be easy to modify your script to accomplish this? (yes, I know the script allows to output to BMP, which is lossless, but I prefer either jpeg with high quality, or LZW-compressed TIFF).
TIA,
asiga
#56
Posted 25 July 2012 - 08:03 PM
asiga, on 24 July 2012 - 08:55 AM, said:
It will use whatever your gimp default jpeg quality is set to.
-Rob A>
This post has been edited by RobA: 25 July 2012 - 08:03 PM

Help













