Scanned Page Processing Script - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP) +---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions) +---- Thread: Scanned Page Processing Script (/Thread-Scanned-Page-Processing-Script) |
Scanned Page Processing Script - Gimpy222 - 12-24-2019 I have hundreds of scanned pages from a large 100 year old book that need sized consistently. I'm using Gimp 2.8.10 Currently I select the portion of the page left to right that has text and the very edge of the page top and bottom. I then select grow by 250 pixels then crop to selection then canvas size 2000 px by 3300 px, CENTERED then mode grayscale then levels 50, .5, 200 the result is exactly what I need I don't know anything about writing scripts. Can this all be done with a single click after the selection is made? If so, how? Thanks Sandy RE: Scanned Page Processing Script - Ofnuts - 12-24-2019 Yes, but why do you grow the selection (vs making that selection directly)? Is the initial selection close to the text and this adds margin? With a click, no, but with a keystroke once you have set up a shortcut, yes... Can you post a sample page? RE: Scanned Page Processing Script - Gimpy222 - 12-24-2019 (12-24-2019, 10:59 PM)Ofnuts Wrote: Yes, but why do you grow the selection (vs making that selection directly)? Is the initial selection close to the text and this adds margin? Thank you for your reply. Yes the selection is to the exact edge of the text. This process adds perfect margins. It's difficult to make a 2000 x 3300 selection directly with the text area centered left and right. By selecting the text block and growing 250 then sizing to 2000 X 3300, the text is perfectly centered left and right. Top and bottom margins very close to original page. Sandy RE: Scanned Page Processing Script - Ofnuts - 12-24-2019 Sample image? RE: Scanned Page Processing Script - Gimpy222 - 12-25-2019 Highly degraded images to meet 500kb max file size [attachment=3677] selection [attachment=3678] grow 250 [attachment=3679] crop to selection [attachment=3680] canvas size 2000 X 3300 - centered [attachment=3684] desired margins [attachment=3685] grayscale then levels 50, .5, 200 [attachment=3686] Final result. (looks much better using original image) [attachment=3687] RE: Scanned Page Processing Script - Ofnuts - 12-25-2019 Here it is... for installation instructions see here, in the "Installation" section at the bottom. The filter can be found as Filters>Enhance>Crop and enhance but is best assigned to a keystroke with Edit>Keyboard shortcuts (find it by entering "gimpy222" in the search bar). Three remarks:
RE: Scanned Page Processing Script - Gimpy222 - 12-25-2019 Thank you so much. Works like I need, except errors on the Levels bit. This line maybe: pdb.gimp_drawable_levels(layer,HISTOGRAM_VALUE,levelsBlack/255.,levelsWhite/255.,False,levelsGamma,0.,1.,False) [attachment=3689] RE: Scanned Page Processing Script - Ofnuts - 12-25-2019 What version of Gimp are you using? See attached, modified to work with Gimp 2.8 RE: Scanned Page Processing Script - Gimpy222 - 12-26-2019 Yes Gimp 2.8 Works perfect. Thank you very much. Sandy |