Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

GIMP python plugin to cut out scanned photos/documents from a single image

License

NotificationsYou must be signed in to change notification settings

dmig/gimp-scan-cutter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GIMP python plugin to cut out scanned photos/documents from a single image

This plugin is a complete rewrite of Script-fu pluginhttps://github.com/dmig/DivideScannedImages. For the moment it repeats original plugin functionalities and flaws.

To make it run, you’ll have to

  • Download and install the latest version ofGIMPhttp://www.gimp.org/downloads/
  • (Optionally) Build and installgimp-deskew-pluginhttps://github.com/dmig/gimp-deskew-plugin
  • Downloadgimp-scan-cutter.py and put it to the GIMP plug-ins folder.
    • On linux runwget https://raw.githubusercontent.com/dmig/gimp-scan-cutter/master/gimp-scan-cutter.py -O $HOME/.config/GIMP/2.10/plug-ins/ to install
    • On Windows save file toplug-ins directory under GIMP installation directory (like C:\Program Files\GIMP 2\share\gimp\2.0\plug-ins) or under user GIMP directory
  • Restart GIMP. You should now see the "Scan cutter" submenu listed at the bottom of the "Tools" menu with 2 items: 'Cut out photos...' and 'Batch cut out photos...'.

Tips

  • Unlike Adobe Photoshop, this plugin gives you some choice on how you want it to behave.
    • Many of these settings should be self-explanatory.
    • Important is that your scanned images have a consistent region that represents the “background color”. Typically this would be the corners of your scanned image.
    • The background colour can best be determined automatically via the specified offset from one of the corners. However, a background colour may also be manually defined via supplied colour picker
    • Ifgimp-deskew-plugin is not found to be present by the script, the "Run Deskew" option will have no effect

Feel free to experiment with the settings, especially:

  • Selection Threshold which controls how sensitive the background color is defined in terms of separating it from the foreground photos.
  • Size Threshold which controls the minimum size of any of the sub-images (rejects smaller items as noise)
  • Max number of items which specifies the maximum number items to be extracted from a single page.
  • In the batch mode theSource directory points to the folder of input scanned pages, and theTarget directory to a (preferrably empty) directory that will contain the output.
  • TheSave file suffix specifies the suffix that will be used for each output file, which is also sequentially numbered. E.g.Image_003.jpg cut outs would be namedImage_003-Crop-01.jpg,Image_003-Crop-02.jpg,Image_003-Crop-03.jpg, e.t.c.

Click on OK, and watch it run through your scanned image(s).

Comparing this solution to Photoshop's built-in filter surprised Francois Malan, in that this homebrew filter seemed to be much more reliable, even straight out of the box. It is also possible to customise the filter’s behavior to suite your specific stack of scans.

Note, however, thatgimp-scan-cutter can and will fail for difficult cases. Here are some more tips you should follow to maximize your chances of success:

  • The photos should not overlap or touch each other. If they do, they will not be divided from each other by the automatic script
  • The scanned page should be cropped in such a way that the to-be-identified items don't extend beyond the page background, and the page background should extend up to or beyond the image borders
    • e.g. – seeing the wooden floor (on which an album was placed while photographing it) will confuse the algorithm unless you carefully set up the “Background Sample X/Y offset” values.
  • The page background should be uniform (white or black are good), and have enough contrast relative to the photos
  • The page (including the background) should be evenly lit

History

About

GIMP python plugin to cut out scanned photos/documents from a single image

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp