Jump to content

Is there an easy way or plugin to distribute objects in evenly spaced formation?


Go to solution Solved by Tactilis,

Recommended Posts

3 hours ago, RickGotTaken said:

I would like to do something similar to this stack exchange thread, but I can't figure out how.

 

If you are referring to the blocks on that site, then:

 

1.  On a new layer make one block first.

2. Then go to the plugin Trail.

 

Trail.png

 

30b8T8B.gif

How I made Jennifer & Halle in Paint.net

My Gallery | My Deviant Art

"Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon.

 
Link to comment
Share on other sites

28 minutes ago, Pixey said:

 

If you are referring to the blocks on that site, then:

 

1.  On a new layer make one block first.

2. Then go to the plugin Trail.

 

Trail.png

 

This just gives the boxes a trail, it doesn't seem to be doing the same thing as the image attached to the original stack exchange post.

To clear up any confusion, I would like to replicate the results found in the 1st/3rd example.

EXlep.jpg

Edit: I do not want to align just simple cubes, I would also like to align objects with slight detail.

Edited by RickGotTaken
Clearing confusion.
Link to comment
Share on other sites

18 minutes ago, RickGotTaken said:

image attached to the original stack exchange post.

 

Sorry, when I clicked on your link earlier, the site was down and I didn't see the whole image, just the blocks.

 

I think the only way is to create it yourself using the original image and layers:

Remember to 'merge down' a few layers, then duplicate and move accordingly to save time.

 

blocks-2.png

 

 

 

30b8T8B.gif

How I made Jennifer & Halle in Paint.net

My Gallery | My Deviant Art

"Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon.

 
Link to comment
Share on other sites

5 minutes ago, Pixey said:

 

Sorry, when I clicked on your link earlier, the site was down and I didn't see the whole image, just the blocks.

 

I think the only way is to create it yourself using the original image and layers:

Remember to 'merge down' a few layers, then duplicate and move accordingly to save time.

 

blocks-2.png

 

 

 

How would I use more/less objects than the original image though? Or am I misunderstanding what you're saying?

Link to comment
Share on other sites

1 hour ago, RickGotTaken said:

How would I use more/less objects than the original image though?

 

You could make all the different sized shapes first, and save each shape as a .png into a folder on your computer.

Then import them into paint.net and move them around as you like.

 

Are you new to using paint.net?  If so, there are many YouTube videos on the basics of using paint :)

 

30b8T8B.gif

How I made Jennifer & Halle in Paint.net

My Gallery | My Deviant Art

"Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon.

 
Link to comment
Share on other sites

A long time ago I created a litle tiling plugin which I didn't officially release. Might be worth a look: https://forums.getpaint.net/topic/14832-stereogram-tools-betas/

 

 

echodemo.png

 

What this plugin does is takes the top left corner of the image and tile it across and down the layer. If you want different sized objects, put each on it's own layer.

Link to comment
Share on other sites

34 minutes ago, Pixey said:

You could make all the different sized shapes first, and save each shape as a .png into a folder on your computer.

Then import them into paint.net and move them around as you like.

I am very confused. I was trying to ask how I would do what the 1st/3rd image does, but with more/less object and different sizes.

34 minutes ago, Pixey said:

Are you new to using paint.net?

No, I've been using it for a few years. I just don't understand what you mean.

31 minutes ago, Ego Eram Reputo said:

A long time ago I created a litle tiling plugin which I didn't officially release. Might be worth a look: https://forums.getpaint.net/topic/14832-stereogram-tools-betas/

 

 

echodemo.png

 

What this plugin does is takes the top left corner of the image and tile it across and down the layer. If you want different sized objects, put each on it's own layer.

I tried it, and it almost completely worked. The only problem is the top, bottom, left and right not being 30px apart like the objects are from eachother. (30px isn't something I chose, it's what is hard-coded into the plugin.)

Edited by RickGotTaken
Removed a linebreak.
Link to comment
Share on other sites

3 minutes ago, RickGotTaken said:

No, I've been using it for a few years. I just don't understand what you mean.

 

Sorry I must be misunderstanding you.  I thought you wanted to replicate the shapes you show on the posted image.

 

When you say 1/3rd example, this is confusing.

1/3 - Is this First to Third lines in total?

Or 1st to 3rd image on a particular line?

30b8T8B.gif

How I made Jennifer & Halle in Paint.net

My Gallery | My Deviant Art

"Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon.

 
Link to comment
Share on other sites

2 hours ago, Pixey said:

I thought you wanted to replicate the shapes you show on the posted image.


The OP has some objects.

 

He wants them to be distributed so that they have equal space between them.

The objects may be all the same width, as shown in the example in the 1st line. Or the objects may have different widths as shown in the 3rd example line.

 

The objects may have some some "slight detail", i.e. they may not be squares or rectangles.

 

Mathematically, he wants to calculate the spacing in pixels between the objects as follows:

 

N = number of objects

X_min = X coord of leftmost pixel of leftmost object 
X_max = X coord of rightmost pixel of rightmost object 

Spacing = ( (X_max - X_min) - (width_of_object_1 + width_of_object_2 + ... width_of_object_N) ) / (N - 1)

 

And then he wants the objects distributed evenly with the above pixel spacing between them.

 

 

Link to comment
Share on other sites

12 minutes ago, Tactilis said:

 

And then he wants the objects distributed evenly with the above pixel spacing between them.

 

Yep, I thought that was what he meant, thus saying that he make the images first, then distribute them accordingly.

 

But, as @BoltBait says, there's too much math involved in doing this manually 😲

30b8T8B.gif

How I made Jennifer & Halle in Paint.net

My Gallery | My Deviant Art

"Rescuing one animal may not change the world, but for that animal their world is changed forever!" anon.

 
Link to comment
Share on other sites

55 minutes ago, Pixey said:

When you say 1/3rd example, this is confusing.

I meant that I want to replicate either the 1st example, or the 3rd. I only want to do this with one object, so I'm assuming it would work similar to the 1st example.

 

21 minutes ago, Tactilis said:


The OP has some objects.

 

He wants them to be distributed so that they have equal space between them.

The objects may be all the same width, as shown in the example in the 1st line. Or the objects may have different widths as shown in the 3rd example line.

 

The objects may have some some "slight detail", i.e. they may not be squares or rectangles.

 

Mathematically, he wants to calculate the spacing in pixels between the objects as follows:

 

N = number of objects

X_min = X coord of leftmost pixel of leftmost object 
X_max = X coord of rightmost pixel of rightmost object 

Spacing = ( (x_max - x_min) - (width_of_object_1 + width_of_object_2 + ... width_of_object_N) ) / (N - 1)

 

And then he wants the objects distributed evenly with the above pixel spacing between them.

 

 

This is correct.

 

14 minutes ago, BoltBait said:

Working with Objects really isn't what Paint.NET does best. Perhaps another tool would be better for what you want to do.  Have you tried Inkscape or CorelDRAW?

No, I haven't. I'd rather stick to paint.net if possible since I am unfamiliar with the layout of any other art programs.

Link to comment
Share on other sites

1 hour ago, RickGotTaken said:

I'd rather stick to paint.net if possible


In which as you will need to do the spacing calculation as I indicated above and distribute the objects manually.

 

1. Find (X_max - X_min) by, for example, doing a Rectangle Select and adjusting the left and right sides of the selection to touch the leftmost and rightmost edges of the 1st and Nth object. The bounding rectangle width is displayed in the status bar.

 

2. You can measure the width of each object in turn by doing a Magic Wand selection of it (or using the Rectangle Select technique as above) and again reading the bounding rectangle width in the status bar.

 

3. Once you have calculated the required spacing, you could draw a horizontal line of that length on a new layer and use this as a measuring 'stick' to space out each object.

  • Move the stick immediately right of object 1
  • Move object 2 to the other end of the stick.
  • Move the stick immediately right of object 2
  • Move object 3 to the other end of the stick.
  • etc

It may seem a bit tedious doing this manually but it's a viable approach if you don't have too many images to process.

 

  • You're a Smart Cookie! 1
Link to comment
Share on other sites

13 hours ago, Tactilis said:

1. Find (X_max - X_min) by, for example, doing a Rectangle Select and adjusting the left and right sides of the selection to touch the leftmost and rightmost edges of the 1st and Nth object. The bounding rectangle width is displayed in the status bar.

Am I supposed to get the result of all the objects with their current spacing? I think I am but I'm not entirely sure.

 

13 hours ago, Tactilis said:

you could draw a horizontal line of that length on a new layer

Where do I put it to start though? The left of the canvas, or right of the canvas? Or the left of the leftmost object, or the right of the rightmost object?

 

13 hours ago, Tactilis said:

It may seem a bit tedious doing this manually but it's a viable approach if you don't have too many images to process.

I've done things more tedious before, this'll be fine.

 

Edit: What do I do if the length is a fraction? Do I round it to the nearest integer?

Edited by RickGotTaken
Extra question.
Link to comment
Share on other sites

3 hours ago, RickGotTaken said:

Am I supposed to get the result of all the objects with their current spacing? I think I am but I'm not entirely sure.

 

My assumption was that you wanted the leftmost and the rightmost objects to stay in their current position and to space out the intermediate objects between them.

 

 

3 hours ago, RickGotTaken said:

Where do I put it to start though? The left of the canvas, or right of the canvas? Or the left of the leftmost object, or the right of the rightmost object?

 

I wrote:

  • Move the stick immediately right of object 1
  • Move object 2 to the other end of the stick.
  • ...

 

Does the following diagram help explain?

 

The top row is the initial position with objects of different widths and spacings.

The bottom row is the final position with equal (calculated) spacing between the objects.

 

NB. For clarity, I have copied the measuring stick, rather than just moving it.

 

object-spacing.png

 

3 hours ago, RickGotTaken said:

What do I do if the length is a fraction? Do I round it to the nearest integer?

 

Yes.

 

Link to comment
Share on other sites

43 minutes ago, Tactilis said:

My assumption was that you wanted the leftmost and the rightmost objects to stay in their current position and to space out the intermediate objects between them.

Does this mean I don't include the leftmost and rightmost objects in the Rectangle Select? Because even if I don't, the number is still way too high to fit properly. I know I'm doing some part of the calculation wrong, but I don't know what part.

 

44 minutes ago, Tactilis said:

Does the following diagram help explain?

Yes.

Link to comment
Share on other sites

1 hour ago, RickGotTaken said:

Yes.


Great.

 

You are all sorted then.

 



But if not, then please post the .pdn containing the objects you wish to space out. You'll need to zip it first to upload to the forum. Alternatively, upload the .pdn to a file hosting site and provide a link.

Link to comment
Share on other sites

Just now, RickGotTaken said:

P.S: Why do I need to zip it to upload it to the forum about the program which made, and encourages you to use the file format?


Because:

 

1.  pdn is not one of the accepted file types. It says: "Accepted file types: gif, jpg, jpeg, png, txt, log, pdf, zip, webp, dll, cs, avif"

2. Because the forum software platform, which is used many 1000s of different forums knows nothing about paint.net

Link to comment
Share on other sites

1 minute ago, Tactilis said:

What was the point of posting a .pdn that contains a set of objects that are already equally spaced?

There's no gap at the end of the objects, so they are not equally spaced. I made this thread to to get help on how to create a gap at the end of the objects.

Edited by RickGotTaken
Accidently said "get rid of the gap".
Link to comment
Share on other sites

2 minutes ago, RickGotTaken said:

I made this thread to to get help on how to create a gap at the end of the objects.

 

At what point in any of your previous posts did you ask about a gap at the end of the objects?
 

I said:
  "He wants them to be distributed so that they have equal space between them" and

  "He wants the objects distributed evenly with the above pixel spacing between them.

 

And you said "Correct"

 

And I drew a diagram and asked if it helped explain.

 

And you said "Yes"

 

But what you want is something different.

 

 

The maths of the example shown in my diagram is very simple. Breaking it down into steps:


a. Find the total width from the leftmost to the rightmost object; i.e. (X_max - X_min)

b. Add up the widths of the individual objects; i.e. (width_1 + width_2 + ... width_N)

c. Subtract b from a; this gives you the total width of the space between the objects.

d. Divide the total space by (N - 1);  i.e. divide the total space by the number of gaps between the objects.

 

If you take time to understand how the above is worked out, then you will easily be able to adapt it for your newly revealed requirement to have equal space between the objects and similar space at the ends of the objects (hint: work out what your total image width is, sum up the objects widths, think about how many gaps you want).

 

 

 

 

Link to comment
Share on other sites

3 minutes ago, Tactilis said:

At what point in any of your previous posts did you ask about a gap at the end of the objects?

I didn't think it was necessary info.

 

4 minutes ago, Tactilis said:

I said:
  "He wants them to be distributed so that they have equal space between them" and

  "He wants the objects distributed evenly with the above pixel spacing between them.

I assumed it would be the same as including the left and right of the canvas, my bad.

 

7 minutes ago, Tactilis said:

a. Find the total width from the leftmost to the rightmost object; i.e. (X_max - X_min)

This still confuses me. Am I just supposed to measure the amount of pixels from the leftmost object to the rightmost object? My result was 1650, but I might be getting something wrong.

 

10 minutes ago, Tactilis said:

you will easily be able to adapt it for your newly revealed requirement

I'm not very good at math, but I'd assume it'd be something like removing the -1 from N.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...