Batch processing - detecting various colours to crop to edge of scanned document JPG? - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions) +--- Thread: Batch processing - detecting various colours to crop to edge of scanned document JPG? (/Thread-Batch-processing-detecting-various-colours-to-crop-to-edge-of-scanned-document-JPG) Pages:
1
2
|
RE: Batch processing - detecting various colours to crop to edge of scanned document JPG? - mkilpatr - 06-30-2022 (06-30-2022, 11:40 AM)Ofnuts Wrote: There is no way in a script to see where you clicked. What a script sees is the result of click (for instance a selection, a path, or a guide). That's a bit of a shame that there can be no one-click "crop to this point" command, but at least you can start in the bottom-right corner and drag beyond the top-left without having to be accurate, according to what you say above. That means it isn't a fiddly, slow selection process. RE: Batch processing - detecting various colours to crop to edge of scanned document JPG? - rich2005 - 06-30-2022 Maybe as a starter, Gimp can add a pair of guides at a point using the measure tool. Ctrl-Alt and a click-and-click again adds the guides. The bottom right corner. To get those to crop, bound to be a better way but... Add guides at the top left corner Already have the guides bottom right corner Make a selection from the guides Invert selection and fill to remove the discolored border. Zealous crop to the content. In the zip two files, for_crop.py Guides-to-selection-mk2.scm the .py goes in your plugins folder / .scm in your scripts folder. Still hands on, add your bottom-right guides, invoke the plugin Tools -> for_crop Make a keyboard shortcut (I used Z ) a bit quicker. Example: https://i.imgur.com/oYi4TRG.mp4 about 40 seconds. What it does not do is (1) Save/Export the image (2) move on to the next image, although Ofnuts has such a plugin. see: earlier post. One for Ofnuts: Image -> Crop to Selection menu entry but not in pdb ? RE: Batch processing - detecting various colours to crop to edge of scanned document JPG? - Ofnuts - 06-30-2022 (06-30-2022, 12:09 PM)mkilpatr Wrote: That's a bit of a shame that there can be no one-click "crop to this point" command,Because there would have to be 9 such "Crop to this point". Top left corner is your own personal case, but one can easily make a case for the three other corners, and then add the four middle of sides and the center. A useful interface isn't the addition of the needs of the million users, but a compromise between coverage and ease of access. RE: Batch processing - detecting various colours to crop to edge of scanned document JPG? - Ofnuts - 06-30-2022 (06-30-2022, 02:50 PM)rich2005 Wrote: One for Ofnuts: Image -> Crop to Selection menu entry but not in pdb ? There has never been a one-to-one mapping between UI functions and the PDB. Some UI functions require two or more PDB calls (gimp_selection_bounds(image) & gimp_image_crop(image, new_width, new_height, offx, offy) for instance) but the opposite can also be true. |