Gimptalk - Premier Gimp Community: Divide OR Crop Multiple Images from Single Scan - Gimptalk - Premier Gimp Community

Jump to content

  • 3 Pages +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

Divide OR Crop Multiple Images from Single Scan

#41 User is offline   esac 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 25-October 10

Posted 25 October 2010 - 09:20 PM

Rob,

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?
0

#42 User is offline   bregia 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 12-December 10

Posted 12 December 2010 - 02:17 AM

I love the looks of this plugin, but I simply can't figure out how to get deskew to load. I'm getting the following error when I run the cmd line version:

/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.
0

#43 User is offline   helpmeplz 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 04-January 11

Posted 04 January 2011 - 04:17 PM

Can someone tell me what all the options mean and how to use them? I have an image, if i use the fuzzy select tool, all the individual photos get selected perfectly but with this script nothing happens. Please help me?
0

#44 User is offline   naklinaam 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 31-March 11

Posted 31 March 2011 - 06:08 PM

View Postgarywitscher, on 22 November 2009 - 06:56 AM, said:

Just in case someone is wanting to do what I wanted to do and needs a little
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?
1

#45 User is offline   naklinaam 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 31-March 11

Posted 02 April 2011 - 12:58 AM

View Postnaklinaam, on 31 March 2011 - 06:08 PM, said:

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?


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?
0

#46 User is offline   RobA 

  • Member
  • PipPip
  • Group: Members
  • Posts: 714
  • Joined: 05-November 07

Posted 02 April 2011 - 07:36 PM

View Postnaklinaam, on 02 April 2011 - 12:58 AM, said:

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?


I've never used it in batch mode. I'd suggest following garywitscher's instructions.

-Rob A>
Posted Image
Fantasy Cartography and Mapping by RobA
0

#47 User is offline   lachoneus 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 27-November 11

Posted 27 November 2011 - 05:24 AM

DivideScannedImages.scm worked great for many of my scanned images. However, unfortunately, I scanned them to minimize the number of scans by putting them right next to each other because my scanner takes a while to scan at high resolution. Now I have a bunch of scanned images, some of which are attached to each other because there wasn't whitespace between them.

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!
0

#48 User is offline   RobA 

  • Member
  • PipPip
  • Group: Members
  • Posts: 714
  • Joined: 05-November 07

Posted 29 November 2011 - 06:33 PM

View Postlachoneus, on 27 November 2011 - 05:24 AM, said:

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!


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>
Posted Image
Fantasy Cartography and Mapping by RobA
0

#49 User is offline   Demented 

  • Mildly Coherent Bespectacled Man
  • PipPip
  • Group: Members
  • Posts: 759
  • Joined: 21-April 09
  • LocationUS

Posted 04 December 2011 - 04:30 AM

I'm a bit tired, so I'm skipping everything everyone's already said. Just want to say that GIMP 2.7.3 has something called "David's Batch Processor". If you can upgrade to it, then that might be something for you. But I'm not sure if that's actually part of GIMP 2.7, or if it's a plugin that got installed with my plugin bundle.
Links to Tutorials, Programs, and Awesome!
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.
0

#50 User is offline   PhotoComix 

  • GT Senior Moderator
  • Group: Senior Moderators
  • Posts: 11,288
  • Joined: 13-June 05

Posted 04 December 2011 - 10:49 AM

it is no included in gimp, if you install will work also in gimp 2.6 anyway i can't see how it could help to divide scanned images
0

#51 User is offline   evil gnome 

  • Member
  • PipPip
  • Group: Members
  • Posts: 10
  • Joined: 02-March 12

Posted 03 March 2012 - 02:53 PM

View PostPhotoComix, on 04 December 2011 - 10:49 AM, said:

it is no included in gimp, if you install will work also in gimp 2.6 anyway i can't see how it could help to divide scanned images

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
0

#52 Guest_MtHunter_*

  • Group: Guests

Posted 19 May 2012 - 12:27 PM

Hello all! I am new here. I found this thread and this really cool script from rob.
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.

View Postgarywitscher, 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!
0

#53 Guest_MtHunter_*

  • Group: Guests

Posted 19 May 2012 - 12:27 PM

Hello all! I am new here. I found this thread and this really cool script from rob.
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.

View Postgarywitscher, 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!
0

#54 Guest_MtHunter_*

  • Group: Guests

Posted 19 May 2012 - 12:28 PM

Hello all! I am new here. I found this thread and this really cool script from rob.
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.

View Postgarywitscher, 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!
0

#55 User is offline   asiga 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 24-July 12

Posted 24 July 2012 - 08:55 AM

I just tested your last version of the script on Mac OSX with Gimp 2.6.11, and it works. Thanks a lot for your great work with this script. Well, I don't have the deskew plugin for OSX, but I hope to be able to get it.

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
0

#56 User is offline   RobA 

  • Member
  • PipPip
  • Group: Members
  • Posts: 714
  • Joined: 05-November 07

Posted 25 July 2012 - 08:03 PM

View Postasiga, on 24 July 2012 - 08:55 AM, said:

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).



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

Posted Image
Fantasy Cartography and Mapping by RobA
0

Share this topic:


  • 3 Pages +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic