Forum
Forum >
Suggestions
>
Topic: Improvement for arrange optimal: tiling/masonry grid layout (PROGRAMMATIC STEPS INCLUDED)
Hi, just wanted to share an layout technique I've been using for my images, which I think could be an improvement upon arrange > optimal. Currently it's a bit of a manual process, so I think It'd be a nice idea to add an automatic feature. It creates a masonry grid, somewhat similar to what pinterest uses.
Steps are as follows:
1. Normalize image areas to average area
(Select images, Normalize > Average Area)
This is done to ensure the images don't vary too much from each other in the following steps. Not sure this is entirely necessary, but I'd rather not have extreme images influence the following steps too much.
2. Normalize widths
(Select Images, Normalize > Average/Width)
Set all images to equal width. We're going to make columns of images out of these. This will change later, but this is the starting point for step 3.
3. Put images into columns of roughly equal column height.
(Moving images)
I sort of eyeball this and try to make each column of roughly equal column height, but if you're doing this programmatically, I'd recommend setting some sort of preferred height and using the Knuth-Plass algorithm to determine an optimal distribution. In this case the images are the "words" and the column height would be the line-width in the algorithm. If you use a greedy algorithm you might end up with very unbalanced columns and that would ruin the next step, so this is important to get right.
https://en.wikipedia.org/wiki/Knuth%E2%80%93Plass_line-breaking_algorithm
(Ask your favorite LLM about it.)
4. Normalize the height of the *columns* by scaling each column individually to match the preferred height.
(Because I'm a human I scale each column to the height of the first column or the longest column instead of preferred height)
The columns are of equal width, but not of equal height, because the the chance is very small that every column adds up to the same number.
Solution, scale each of the columns up or down until they reach the preferred height set in step 3. Because we got very close using human eyeballing/algorithm, the scale won't have to change that much. The columns will therefore all still be _roughly_ the same width, but the heights are now all equal.
5. Align the columns at the left and top
(ctrl + left, ctrl + up)
You now have a super nice image grid that is basically a rectangle, with all images inside laid out in columns that are almost the same width too. (Exactly the same width would be impossible.)
I hope whoever is programming pureref is able to follow what I'm trying to communicate. Sorry if it's hard to follow, it's 11pm and I just wanted to get this idea out there.
I think it would be better to optimize the automatic arrangement function instead of the current one. Add a custom column and row number option, for example, automatically wrapping to the next line if there are more than 6 images per row. Then, standardize the height as you suggested. At this point, you'll have many rows of 6 images each, and because the image height is uniform, each row will have very clear dividing lines. And with only 6 images per row, although their widths may vary, you can clearly distinguish where each row begins and ends.
To be honest, I don't think Pinterest's waterfall layout, which arranges everything into a rectangle, makes any sense; in fact, it looks very chaotic.
Because humans are accustomed to reading horizontally, arranging the images as I described allows you to clearly view them from left to right. By the sixth image, you'll know you've finished viewing this row and can switch to the next. I can even put related images, consecutive images, or images of the same scene from different angles in the same row for easy viewing.
In Pinterest's layout, you often notice that the images are arranged at varying heights. This means that within the same horizontal line, one column might have three images, another one, and yet another only two. This makes it impossible to discern the beginning and end of a row, causing you to miss some references. Similarly, it makes it difficult to identify which images form a series of reference images.
Agreed, I think they should open up API(payed version,idk), it would be cool to make plugins for pureref . Or possibly allow for MCP so we can let it talk to other programs. Would love this to talk to photoshop, figma, chrome, codex. :)