Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
calculating ratios to find optimal grid layout
#7
(02-20-2025, 11:33 PM)madscijr Wrote:
(02-20-2025, 10:33 PM)PhilOfPerth Wrote:
(02-20-2025, 09:58 PM)madscijr Wrote: For example, say you have 15 pictures. You might want to lay those out to fit a picture frame in vertical orientation. Say the ratio of horizontal to vertical is 3:5. 
So the pictures would be arranged as a 3x5 grid, like 

01 02 03
04 05 06
07 08 09
10 11 12
13 14 15

If you wanted a horizontal orientation, the ratio now becomes 5:3, a 5x3 grid, like 

01 02 03 04 05
06 07 08 09 10
11 12 13 14 15

If you had a square frame, you would arrange them in a 4x4 grid: 

01 02 03 04
05 06 07 08
09 10 11 12
13 14 15 XX

where the last space is empty. 

Depending on the # of pictures that need to be arranged, that number is going to more evenly fit into some picture frames' aspect ratios better than others, i.e., a perfect fit would mean no spaces are left empty, but 1 space left empty is better than 2 or more. 

So what this program does is, given a count representing the # of pictures (or items), it displays how evenly that many items are going to fit into different aspect ratios, in order of the best fit (least empty spaces) to the worse (most empty spaces).

As a tool it helps you decide what aspect ratio picture frame to get to display a given # of pictures, or if the frame or screen size's aspect ratio is already determined, it lets you know how many pictures you would need to add or remove for a perfect fit (if needed).

Yeah, well... good luck with that!  Big Grin
A good, clear explanation of something that I for one have tried to do several times, with limited success. 
I await with bated breath a simple (and brief) rendition. Exclamation
Thanks for the warm / enthusiastic response! I think I frustrated poor Steve and if that was the only reaction I was going to get, I'd feel like I need to hire a writer to better explain my programs, LoL. 

The real trick is going to be figuring that out for a mixed bag of pictures of different orientations (up/down or longways) and sizes. Currently version 1 assumes all of a uniform size and perfectly square. It shouldn't be too hard to modify to handle non-square (where all are the same orientation), but I haven't yet thought about mixed orientation or size, or a good way to automatically arrange them so as to fit best AND be aesthetically pleasing (not too random but not too regular). I have a feeling that could open a Pandora's box of sub-problems, so my current plan is to present as simple a layout as possible, then let the user tweak it by moving the pictures around with the mouse...
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, W.A.) Big Grin
Please visit my Website at: http://oldendayskids.blogspot.com/
Reply


Messages In This Thread
RE: calculating ratios to find optimal grid layout - by PhilOfPerth - Yesterday, 11:13 AM



Users browsing this thread: 13 Guest(s)