Gimp-Python way to create square-selection Marquee, that user sizes and places? - 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: Gimp-Python way to create square-selection Marquee, that user sizes and places? (/Thread-Gimp-Python-way-to-create-square-selection-Marquee-that-user-sizes-and-places) |
Gimp-Python way to create square-selection Marquee, that user sizes and places? - charlweed - 10-17-2022 I want to have gimp help automate the create of 512 square images. Gimp would open each image file in a directory, the user would make a square selection, press a hotkey, and gimp would rescale that selection to 512 by 512 and save it to a different directory. I (used to, it’s been a few years) know how to open each file in a dir, scale, and save. I don’t know how to GIMP-PYTHON a moveable selection, or to have a hotkey trigger further processing. I have gimp 2.10.32 (revision 1), but I’m willing to try pre-release gimp 2.99 if that will be much better at what I’m trying to do. Thanks! RE: Gimp-Python way to create square-selection Marquee, that user sizes and places? - charlweed - 10-17-2022 (10-17-2022, 06:00 PM)charlweed Wrote: I want to have gimp help automate the create of 512 square images. ... Sticking with gimp 2.10, I'm going to try to use "gimp_image_select_rectangle", in one script, and put the saving and scaling in another. I don't know if this is a good way to start. RE: Gimp-Python way to create square-selection Marquee, that user sizes and places? - Ofnuts - 10-18-2022 Been there, done (nearly) that. The result is in my ofn-file-next script that you can adapt to your needs. It is used like this:
The difference with your requirements:
Code: #! /bin/bash (it resizes to 600px wide, and does a slight sharpening to mitigate the blur due to the resize). I since found a way to write the script without looping on the files (easier if you are on Windows). You can also use mogrify instead of convert to resize the files directly without making a new copy. RE: Gimp-Python way to create square-selection Marquee, that user sizes and places? - charlweed - 10-25-2022 Thanks Ofnuts! I'll take a look. |