Switch to full style
Post all Gimp scripts and script writing questions here
Post a reply

Use Shrink or Grow by 1 pixel on command

Wed Mar 10, 2021 1:35 pm

I am a very technical gimp user. I would like to know if I could make a script that would shrink or grow a selected region by one pixel on command? Is there anyway to go about doing this. It would be very important for my workflow. Thanks

Re: Use Shrink or Grow by 1 pixel on command

Wed Mar 10, 2021 3:13 pm

This is faster than launching a script.
In the preferences: Dialog defaults set up grow and shrink defaults to 1 pixel.

shrinkgrow.png
shrinkgrow.png (34.96 KiB) Viewed 5071 times


Then, in the preferences: Interface, create shortcuts for grow and shrink.
Using a key combo wins!

shrinkgrow2.png
shrinkgrow2.png (42.93 KiB) Viewed 5071 times


A script would be easy to write I guess, there's just 2 procedures
gimp-selection-grow and gimp-selection-shrink, but in my opinion it would be a useless script.

Re: Use Shrink or Grow by 1 pixel on command

Wed Apr 14, 2021 3:48 pm

Thanks for your help, but I want it to automatically scale up and down without bringing up the "grow/shrink dialog". This doesn't seem to do that.

Re: Use Shrink or Grow by 1 pixel on command

Wed Apr 14, 2021 3:57 pm

https://imgur.com/MmLv3zr

The goal would be to press a key to grow and shrink the "marching ants" selection. Skipping the dialog entirely.

Re: Use Shrink or Grow by 1 pixel on command

Wed Apr 14, 2021 4:28 pm

I guess you need (to write) a script that does it without the dialog then.
It's a good first goal and you will score way sooner than me, if I start now it will be ready around Christmas.

Re: Use Shrink or Grow by 1 pixel on command

Wed Apr 14, 2021 4:59 pm

Where are some resources that I can learn how to make Scripts for Gimp? Will I be using the Script-FU? I'm definitely up for this challenge.

Re: Use Shrink or Grow by 1 pixel on command

Thu Apr 15, 2021 8:37 am

I'd just google for it, read the basics first and do some beginner tuts.
Python is more popular nowadays for many reasons, but you have to decide that yourself.
Maybe you want to try scheme for this easy script.

https://www.gimp.org/tutorials/Basic_Scheme/

https://gimpbook.com/scripting/

Re: Use Shrink or Grow by 1 pixel on command

Thu Apr 15, 2021 2:06 pm

For me the easier is Python. With Scheme, you have to keep refreshing every time you write a section of the code. With Python, you only do it once you register the plugin with GIMP, you can make any changes without refreshing.

Re: Use Shrink or Grow by 1 pixel on command

Fri Apr 16, 2021 8:16 am

See "ofn-shrink-grow-selection" on https://sourceforge.net/projects/gimp-t ... s/scripts/

A script dedicated to Scrum masters and their boring "daily" "ceremonies" (yes, they have a strange vocabulary, it's the new business cult).

Re: Use Shrink or Grow by 1 pixel on command

Fri Apr 16, 2021 4:23 pm

ofnuts wrote:See "ofn-shrink-grow-selection" on https://sourceforge.net/projects/gimp-t ... s/scripts/

A script dedicated to Scrum masters and their boring "daily" "ceremonies" (yes, they have a strange vocabulary, it's the new business cult).


The script was updated 30 minutes ago? What does it do. I am testing it now.

Re: Use Shrink or Grow by 1 pixel on command

Fri Apr 16, 2021 5:08 pm

Thank you. This is really cool. I recorded myself using your script to make fast stroke text.

https://streamable.com/jbax7b

Re: Use Shrink or Grow by 1 pixel on command

Fri Apr 16, 2021 5:15 pm

It is still kind of rough along the edges. Default grow does not have this problem. I am still going to keep this script as I find it useful.
https://i.imgur.com/3YUzXwS.png

Re: Use Shrink or Grow by 1 pixel on command

Fri Apr 16, 2021 5:39 pm

contrast_ wrote:
ofnuts wrote:See "ofn-shrink-grow-selection" on https://sourceforge.net/projects/gimp-t ... s/scripts/

A script dedicated to Scrum masters and their boring "daily" "ceremonies" (yes, they have a strange vocabulary, it's the new business cult).


The script was updated 30 minutes ago? What does it do. I am testing it now.


Just code optimization. I figured out away to cut the code by a good third (20 lines from 34)
Post a reply