RSS/Atom feed Twitter
Site is read-only, email is disabled

Cropping to multiple aspect ratios (was Using "Tool Options" in Scripts)

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

4 of 4 messages available
Toggle history

Please log in to manage your subscriptions.

Using "Tool Options" in Scripts or as shortcuts Frank Barknecht 04 Feb 21:28
  Using "Tool Options" in Scripts or as shortcuts David Gowers 04 Feb 23:20
   Using "Tool Options" in Scripts or as shortcuts Frank Barknecht 04 Feb 23:45
  Cropping to multiple aspect ratios (was Using "Tool Options" in Scripts) Akkana Peck 05 Feb 04:33
Frank Barknecht
2009-02-04 21:28:58 UTC (almost 16 years ago)

Using "Tool Options" in Scripts or as shortcuts

Hi,

I have to do some tedious work, namely crop many images to four aspect ratios: 4:3, 3:4, 1:1 and 4:1. For each image I need to select the picture detail to preserve manually, so this cannot be automated. But I'd like to automate as much as possible from the rest of this task.

I tried to write a Script-Fu for this, but while the Rectangle Selection tool offers a nice input element for a fixed aspect ratio in its Tool Options, this setting is not available in the "gimp-rect-select" procedure, which only offers x, y, width and height. So it seems this is not the right place to look.

I already saved some Tool Presets for setting the options to 4:3, 3:4, ... aspect ratios, but it seems, Tool Options can only be restored by using the Mouse, which I'd like to avoid as much as possible. Is there a way to add a keyboard shortcut to a certain Tool Preset, which I overlooked?

Any other hints how to make my job less tedious?

Ciao

David Gowers
2009-02-04 23:20:28 UTC (almost 16 years ago)

Using "Tool Options" in Scripts or as shortcuts

Hi!

On Thu, Feb 5, 2009 at 6:58 AM, Frank Barknecht wrote:

Hi,

I have to do some tedious work, namely crop many images to four aspect ratios: 4:3, 3:4, 1:1 and 4:1. For each image I need to select the picture detail to preserve manually, so this cannot be automated. But I'd like to automate as much as possible from the rest of this task.

I tried to write a Script-Fu for this, but while the Rectangle Selection tool offers a nice input element for a fixed aspect ratio in its Tool Options, this setting is not available in the "gimp-rect-select" procedure, which only offers x, y, width and height.

That's because it's redundant in that context, since a little basic math can produce width/height values from an aspect ratio.

I already saved some Tool Presets for setting the options to 4:3, 3:4, ... aspect ratios, but it seems, Tool Options can only be restored by using the Mouse, which I'd like to avoid as much as possible. Is there a way to add a keyboard shortcut to a certain Tool Preset, which I overlooked?

AFAIK no -- I've been wanting this for a while, and I haven't found a reasonable way to implement it myself.

Any other hints how to make my job less tedious?

You may be able to use tools like xdotool to automatically transfer the aspect ratio into the rectangle-select tool options after the user chooses which.

David

Frank Barknecht
2009-02-04 23:45:52 UTC (almost 16 years ago)

Using "Tool Options" in Scripts or as shortcuts

Hallo,
David Gowers hat gesagt: // David Gowers wrote:

On Thu, Feb 5, 2009 at 6:58 AM, Frank Barknecht wrote:

I tried to write a Script-Fu for this, but while the Rectangle Selection tool offers a nice input element for a fixed aspect ratio in its Tool Options, this setting is not available in the "gimp-rect-select" procedure, which only offers x, y, width and height.

That's because it's redundant in that context, since a little basic math can produce width/height values from an aspect ratio.

Yeah, makes sense.

I already saved some Tool Presets for setting the options to 4:3, 3:4, ... aspect ratios, but it seems, Tool Options can only be restored by using the Mouse, which I'd like to avoid as much as possible. Is there a way to add a keyboard shortcut to a certain Tool Preset, which I overlooked?

AFAIK no -- I've been wanting this for a while, and I haven't found a reasonable way to implement it myself.

Actually Photoshop, at least the version I also have access to, misses that feature as well AFAICT, so we're not alone. :)

Ciao

Akkana Peck
2009-02-05 04:33:38 UTC (almost 16 years ago)

Cropping to multiple aspect ratios (was Using "Tool Options" in Scripts)

Frank Barknecht writes:

I have to do some tedious work, namely crop many images to four aspect ratios: 4:3, 3:4, 1:1 and 4:1. For each image I need to select the picture detail to preserve manually, so this cannot be automated.

[ ... ]

I already saved some Tool Presets for setting the options to 4:3, 3:4, ... aspect ratios, but it seems, Tool Options can only be restored by using the Mouse, which I'd like to avoid as much as possible. Is there

[ ... ]

Any other hints how to make my job less tedious?

I do that a lot too -- making desktop backgrounds for monitors of several different sizes -- and I'm always irritated by how many steps it takes.

I had never actually used those Save Tool Options presets, and your message made me look into them -- I should have done that long ago! It helps with the most tedious step. But still, there are quite a few steps left, so it's still tedious. Getting this far inspired me to try to automate more of the job, and the result is a python script: http://shallowsky.com/software/gimp/wallpaper.py

The script has a list of resolutions it knows about (1680x1050, 1024x768, 1366x768 and so forth). You use rect select in the original image (using tool presets to set the aspect ratio correctly) and make a rectangular selection. Then call the script, which registers in Image->Selection to Wallpaper. The script compares its list of resolutions with the selection's aspect ratio and picks the closest one. Then it copies the selection, pastes it as a new image, and scales it to what it thinks is the right size based on the aspect ratio. The original image is still there so you can go back and do the next size/aspect ratio.

I know your task is a little different -- you don't have the Scale step, so my script might not help you much. And using rect select isn't really as good as using crop, because rect select doesn't stop at the edges of the image, so you have to be super careful not to go over when you make the selection. (I'll probably add something to the script to correct for that, as well as adding something to save automatically to a directory chosen based on the size.) But I thought I'd share the script since it might give you ideas, or might help someone else who does desktop backgrounds like I do.

...Akkana