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

Re: Shape-Grid zip

Mon Apr 25, 2011 9:55 am

Ok, here's an update - I added a function where you can do any shape you like.

The way it works is, you make a selection in the size of the image, and the script scales the selection to the size you've selected in the settings, then makes a grid of that shape. Try it out!

http://www.fileden.com/files/2010/2/7/2 ... grid1_1.py

(also, I rewrote a large part of the script, I think it should be a bit faster now even with other settings)

Re: Shape-Grid zip

Mon Apr 25, 2011 10:35 am

hopi2.jpg
hopi2.jpg (58.43 KiB) Viewed 1948 times


well, that's cute! a very interesting effect

Re: Shape-Grid zip

Mon Apr 25, 2011 10:48 am

I like the new plug-in but I'm having trouble with the selection one. It comes out very tiny. I may be doing something wrong there. I used the paths tool to make a small random shape then ran the script. I tried it with small rectangle selections and small elliptical ones too and had the same results.

Also, would it be possible to have a reset button?

Re: Shape-Grid zip

Mon Apr 25, 2011 11:04 am

OK, I tried a larger shape, a star that is 150 radius and 75 radius. I stroked it onto the final image. The original image was 500x500px to start with and the script enlarged it to 1105 x 1105px.

I cropped this down to 500x500px.
Image


These are the settings I used.

Image

Re: Shape-Grid zip

Mon Apr 25, 2011 11:12 am

You need to make the selection in the size of the image. The script automatically scales it to the size you set in the settings.

It's not a perfect system... if the image size gets changed by the script then the shape gets "smaller", because resizing the image also affects the selection (it gets padded with empty space). But it works adequately for now...

here's an example
Selection:
Image
Result:
Image

Re: Shape-Grid zip

Mon Apr 25, 2011 11:26 am

OK. I tried it using a star the size of the image (500x500) and cut the amount of stars down to 4 x & y. That made a smaller image but the stars were decently sized.

I tried making 10 stars using the same settings and it shrank the stars way down and made an image 1055x1055.

Image

Re: Shape-Grid zip

Mon Apr 25, 2011 11:42 am

Oregonian wrote:I tried making 10 stars using the same settings and it shrank the stars way down and made an image 1055x1055.


You can prevent the shrinking by resizing the image beforehand. For now I can't think of a better fix for that...

Re: Shape-Grid zip

Mon Apr 25, 2011 12:04 pm

dd wrote:You can prevent the shrinking by resizing the image beforehand. For now I can't think of a better fix for that...

That's the problem with specifying the number of rows and columns. I'd much prefer to just specify the object size and have the entire layer filled with the grid... just like Filters>Render>Pattern>Grid... does it.

I can see some utility for specifying rows and columns that are smaller than the image size.

But I'd be inclined to crop the grid to the existing image/layer size if the rows and columns exceed the existing image or layer size. That's the way I'd want it to work if I were writing it and/or using it.
(I wrote embedded software in a previous life.)

Re: Shape-Grid zip

Mon Apr 25, 2011 1:29 pm

Yes, you may have a point there... I could add a checkbox option to crop the image back to original size after the script is finished.

Re: Shape-Grid zip

Mon Apr 25, 2011 6:38 pm

I have a couple of issues with the new py grid plug-in.

1. If you don't open an existing image it throws errors when implemented. So, naturally, it requires an image open to use it, however, when you create a grid of any size, of x number of rows and columns, it creates a new transparent layer with the grid that isn't the same size of the original image. I would prefer if the plug-in resized the image to the new grid layer, without me having to make those adjustments.

2. If you use the selection option, and enlarge the size of the shape diameter, the plug-in disregards it. This is not the result I am expecting. If I create a selection and want it to be 100px in size, I would expect the plug-in to make 100 px shapes in a grid.

Re: Shape-Grid zip

Tue Apr 26, 2011 4:23 am

Well... this wasn't my own code originally, I was just adapting other people's code to suit my needs better... if anyone wants to continue the work with this script, feel free to pick up where I left, I think I'm going to concentrate on my own scripts for now at least.

Re: Shape-Grid zip

Tue Apr 26, 2011 6:06 am

Yikes! I hope I didn't touch a nerve. It wasn't my intention to do so.

Just old college computer lab habits of mine when testing other classmates' code (although in an entirely different language). This does not diminish the fact I appreciate your taking the time to do what you did by putting the scripts together into a python file. Thanks a bunch for doing that. :)

Re: Shape-Grid zip

Tue Apr 26, 2011 7:53 am

No, don't worry about it. I just feel that the more I work on this code the messier it gets - probably because it wasn't my code originally, it's written so differently from what I personally would do... I'd have to rewrite the entire script, but I don't think I have the time/energy to do it right now... which is why I'm saying, if anyone wants to continue with this script from where I left off, be my guest. :)

Re: Shape-Grid zip

Tue Apr 26, 2011 8:13 am

I just like that fact that I could remove a few extra scripts....I find the chaos of all these scripts a bit annoying.

Re: Shape-Grid zip

Tue Apr 26, 2011 8:38 am

Same here i am very glad dd revised them into one.It's a cool script in my opinion. :)

Re: Shape-Grid zip

Tue Apr 26, 2011 1:04 pm

Here's a combined hack -

This one moves the filter to File->Create->Shape Grid (as it creates the image).

it also speeds things up a fair bit by making the selections incremental then filling once at the end rather than filling on the go.

Name and registration changed to avoid conflicts with James' original.

-Rob A>

Re: Shape-Grid zip

Tue Apr 26, 2011 2:29 pm

My version didn't have incremental selections... my version made the selection once, then moved the selection for every iteration.

Re: Shape-Grid zip

Sun May 08, 2011 11:11 pm

I had to go back and read the posts on the use of selections for a grid a few times, because dd's script to perform this process is a great one. It just took some time for me to understand what was meant by making the selection the size of the image. Actually, it should have read, make the selection as large as your resulting grid size (with your chosen settings input).

Just in case anyone else stumbles across this and has problems like I did, do the following:

First, just run the plug-in with your desired settings, regardless of the selection size. Once you have your new grid image (everything will be smaller than you expect, but fret not), then resize the selection using the scale tool (mode set to selection), and drag the selection to fit within the new grid layer.

Rerun the script a second time, and turn off the previous layer.

Yes there are other ways to do this, but this way, you don't have to guess what the resulting grid size will be, running the script with your settings will create it for you.

Thanks again, dd!

Re: Shape-Grid zip

Mon May 09, 2011 2:20 am

No problem :)

Re: Shape-Grid zip

Sun Jan 05, 2014 5:56 am

:bump
Nice too see how idea and script evolved

BUT reading now i got a bit confused, related to many scripts a few in several version

which the script that integrate most of shapes ?
and if more then 1 scripts (in the topic are discussed several , Sam Brooklin, Mahvin, RobA, Rod) which the most relevant differences?
Post a reply