(02-21-2025, 08:07 PM)SMcNeill Wrote: Again, you're not maintaining your set ratios.
Yes, a 7x3 grid is going to hold 21 items, but it's not going to be able to match your 16:9 ratio.
7x3 is going to scale to a 21:9 ratio, which doesn't match what you started with originally at all.
If that ratio is something that doesn't have to be maintained, then why's it even there to start with? What's the point for it?
1x1 is square.
1x2 is... not square.
2x1 is... not square.
If I have 2 items, I can put them in a 1x2 grid, or a 2x1 grid, but those grids aren't going to be SQUARE -- which was the whole initial requirement for things.
It's only at:
1x1 that we have a square.
2x2 that we have a square.
3x3 that we have a square.
4x4 that we have a square.
Your description sets the ratio that you want to find a solution for, but then the solutions you are finding doesn't match that ratio.
Let's say you want to sort out how large a SQUARE grid you need to hold 12 items.
3x3 IS square, but it can only hold 9 items.
4x3 isn't square, but it can hold 12 items.
4x4 IS square, but it holds 16 items. You have 4 empty spaces left over on your grid.
Is the 4x3 a better answer? Sure, it might be -- but it's NOT a SQUARE grid like the ratio demanded it to be.
If you don't need to maintain the ratio, all you need to do is simple math and look for values that multiply to the closest number for you. The best answer would always just be a simple 1xnumber grid. It'd never have any spaces left over.
(02-21-2025, 08:15 PM)Pete Wrote: 4:3 = 8x6 so 48 cells available, only 20 used would be 28 empty.
The math is certainly correct, so the question would be will it work in practice.
Maybe the problem is you are wanting more of a collage effect for uneven distribution like fitting jigsaw pieces together. This cell approach, using mixed photo sizes, is a grid, meaning smaller photos get placed in the center of the grid sized to the largest photo.
Pete
Thanks so much you guys, for taking the time to explain... I am going to have to digest this over the weekend, just don't have time right now.
What I did do was take Steve's ratios and put them into my program, and then had both programs output their results to a tab-delimited file, and ran tests on various counts (20, 555, 1014, 1200, 2000, 12900, 15400, 14400, 87500, 1414000 items) and brought that into Excel to compare them side by side, and output some table ML with a simple formula. Below is the test data. I'm going to read through what you guys said and make sense of it. Thanks again for listening and explaining...
Program | Items | H-Ratio | V-Ratio | Columns | Rows | Total Cells | Empty Cells | Layout |
---|---|---|---|---|---|---|---|---|
Steve | 20 | 2 | 3 | 4 | 6 | 24 | 4 | Classic 35mm (4x6; 6x9; etc.) |
madsci | 20 | 2 | 3 | 3 | 7 | 21 | 1 | Classic 35mm (4x6, 6x9, etc.) |
Steve | 555 | 2 | 3 | 20 | 30 | 600 | 45 | Classic 35mm (4x6; 6x9; etc.) |
madsci | 555 | 2 | 3 | 19 | 30 | 570 | 15 | Classic 35mm (4x6, 6x9, etc.) |
Steve | 1014 | 2 | 3 | 28 | 42 | 1176 | 162 | Classic 35mm (4x6; 6x9; etc.) |
madsci | 1014 | 2 | 3 | 26 | 39 | 1014 | 0 | Classic 35mm (4x6, 6x9, etc.) |
Steve | 1200 | 2 | 3 | 30 | 45 | 1350 | 150 | Classic 35mm (4x6; 6x9; etc.) |
madsci | 1200 | 2 | 3 | 28 | 43 | 1204 | 4 | Classic 35mm (4x6, 6x9, etc.) |
Steve | 2000 | 2 | 3 | 38 | 57 | 2166 | 166 | Classic 35mm (4x6; 6x9; etc.) |
madsci | 2000 | 2 | 3 | 36 | 56 | 2016 | 16 | Classic 35mm (4x6, 6x9, etc.) |
Steve | 12900 | 2 | 3 | 94 | 141 | 13254 | 354 | Classic 35mm (4x6; 6x9; etc.) |
madsci | 12900 | 2 | 3 | 92 | 141 | 12972 | 72 | Classic 35mm (4x6, 6x9, etc.) |
Steve | 14400 | 2 | 3 | 98 | 147 | 14406 | 6 | Classic 35mm (4x6; 6x9; etc.) |
madsci | 14400 | 2 | 3 | 97 | 149 | 14453 | 53 | Classic 35mm (4x6, 6x9, etc.) |
Steve | 15400 | 2 | 3 | 102 | 153 | 15606 | 206 | Classic 35mm (4x6; 6x9; etc.) |
madsci | 15400 | 2 | 3 | 101 | 153 | 15453 | 53 | Classic 35mm (4x6, 6x9, etc.) |
Steve | 87500 | 2 | 3 | 242 | 363 | 87846 | 346 | Classic 35mm (4x6; 6x9; etc.) |
madsci | 87500 | 2 | 3 | 241 | 364 | 87724 | 224 | Classic 35mm (4x6, 6x9, etc.) |
Steve | 1414000 | 2 | 3 | 972 | 1458 | 1417176 | 3176 | Classic 35mm (4x6; 6x9; etc.) |
madsci | 1414000 | 2 | 3 | 970 | 1458 | 1414260 | 260 | Classic 35mm (4x6, 6x9, etc.) |
Steve | 20 | 1 | 1 | 5 | 5 | 25 | 5 | Square (profile pictures; social media) |
madsci | 20 | 1 | 1 | 5 | 5 | 25 | 5 | Square (profile pictures, social media) |
Steve | 555 | 1 | 1 | 24 | 24 | 576 | 21 | Square (profile pictures; social media) |
madsci | 555 | 1 | 1 | 24 | 24 | 576 | 21 | Square (profile pictures, social media) |
Steve | 1014 | 1 | 1 | 32 | 32 | 1024 | 10 | Square (profile pictures; social media) |
madsci | 1014 | 1 | 1 | 32 | 32 | 1024 | 10 | Square (profile pictures, social media) |
Steve | 1200 | 1 | 1 | 35 | 35 | 1225 | 25 | Square (profile pictures; social media) |
madsci | 1200 | 1 | 1 | 35 | 35 | 1225 | 25 | Square (profile pictures, social media) |
Steve | 2000 | 1 | 1 | 45 | 45 | 2025 | 25 | Square (profile pictures; social media) |
madsci | 2000 | 1 | 1 | 45 | 45 | 2025 | 25 | Square (profile pictures, social media) |
Steve | 12900 | 1 | 1 | 114 | 114 | 12996 | 96 | Square (profile pictures; social media) |
madsci | 12900 | 1 | 1 | 114 | 114 | 12996 | 96 | Square (profile pictures, social media) |
Steve | 14400 | 1 | 1 | 121 | 121 | 14641 | 241 | Square (profile pictures; social media) |
madsci | 14400 | 1 | 1 | 120 | 120 | 14400 | 0 | Square (profile pictures, social media) |
Steve | 15400 | 1 | 1 | 125 | 125 | 15625 | 225 | Square (profile pictures; social media) |
madsci | 15400 | 1 | 1 | 125 | 125 | 15625 | 225 | Square (profile pictures, social media) |
Steve | 87500 | 1 | 1 | 296 | 296 | 87616 | 116 | Square (profile pictures; social media) |
madsci | 87500 | 1 | 1 | 296 | 296 | 87616 | 116 | Square (profile pictures, social media) |
Steve | 1414000 | 1 | 1 | 1190 | 1190 | 1416100 | 2100 | Square (profile pictures; social media) |
madsci | 1414000 | 1 | 1 | 1190 | 1190 | 1416100 | 2100 | Square (profile pictures, social media) |
Steve | 20 | 5 | 7 | 5 | 7 | 35 | 15 | 5 x 7 photo |
madsci | 20 | 5 | 7 | 3 | 7 | 21 | 1 | 5 x 7 photo |
Steve | 555 | 5 | 7 | 20 | 28 | 560 | 5 | 5 x 7 photo |
madsci | 555 | 5 | 7 | 19 | 30 | 570 | 15 | 5 x 7 photo |
Steve | 1014 | 5 | 7 | 30 | 42 | 1260 | 246 | 5 x 7 photo |
madsci | 1014 | 5 | 7 | 26 | 39 | 1014 | 0 | 5 x 7 photo |
Steve | 1200 | 5 | 7 | 30 | 42 | 1260 | 60 | 5 x 7 photo |
madsci | 1200 | 5 | 7 | 29 | 42 | 1218 | 18 | 5 x 7 photo |
Steve | 2000 | 5 | 7 | 40 | 56 | 2240 | 240 | 5 x 7 photo |
madsci | 2000 | 5 | 7 | 37 | 55 | 2035 | 35 | 5 x 7 photo |
Steve | 12900 | 5 | 7 | 100 | 140 | 14000 | 1100 | 5 x 7 photo |
madsci | 12900 | 5 | 7 | 95 | 136 | 12920 | 20 | 5 x 7 photo |
Steve | 14400 | 5 | 7 | 105 | 147 | 15435 | 1035 | 5 x 7 photo |
madsci | 14400 | 5 | 7 | 101 | 143 | 14443 | 43 | 5 x 7 photo |
Steve | 15400 | 5 | 7 | 105 | 147 | 15435 | 35 | 5 x 7 photo |
madsci | 15400 | 5 | 7 | 104 | 149 | 15496 | 96 | 5 x 7 photo |
Steve | 87500 | 5 | 7 | 255 | 357 | 91035 | 3535 | 5 x 7 photo |
madsci | 87500 | 5 | 7 | 250 | 350 | 87500 | 0 | 5 x 7 photo |
Steve | 1414000 | 5 | 7 | 1005 | 1407 | 1414035 | 35 | 5 x 7 photo |
madsci | 1414000 | 5 | 7 | 1004 | 1409 | 1414636 | 636 | 5 x 7 photo |
Steve | 20 | 4 | 3 | 8 | 6 | 48 | 28 | Older PC monitor + analog TV (640x480; 1024x768; etc.) |
madsci | 20 | 4 | 3 | 7 | 3 | 21 | 1 | Older PC monitor + analog TV (640x480, 1024x768, etc.) |
Steve | 555 | 4 | 3 | 28 | 21 | 588 | 33 | Older PC monitor + analog TV (640x480; 1024x768; etc.) |
madsci | 555 | 4 | 3 | 28 | 20 | 560 | 5 | Older PC monitor + analog TV (640x480, 1024x768, etc.) |
Steve | 1014 | 4 | 3 | 40 | 30 | 1200 | 186 | Older PC monitor + analog TV (640x480; 1024x768; etc.) |
madsci | 1014 | 4 | 3 | 38 | 27 | 1026 | 12 | Older PC monitor + analog TV (640x480, 1024x768, etc.) |
Steve | 1200 | 4 | 3 | 44 | 33 | 1452 | 252 | Older PC monitor + analog TV (640x480; 1024x768; etc.) |
madsci | 1200 | 4 | 3 | 40 | 30 | 1200 | 0 | Older PC monitor + analog TV (640x480, 1024x768, etc.) |
Steve | 2000 | 4 | 3 | 52 | 39 | 2028 | 28 | Older PC monitor + analog TV (640x480; 1024x768; etc.) |
madsci | 2000 | 4 | 3 | 53 | 38 | 2014 | 14 | Older PC monitor + analog TV (640x480, 1024x768, etc.) |
Steve | 12900 | 4 | 3 | 132 | 99 | 13068 | 168 | Older PC monitor + analog TV (640x480; 1024x768; etc.) |
madsci | 12900 | 4 | 3 | 132 | 98 | 12936 | 36 | Older PC monitor + analog TV (640x480, 1024x768, etc.) |
Steve | 14400 | 4 | 3 | 140 | 105 | 14700 | 300 | Older PC monitor + analog TV (640x480; 1024x768; etc.) |
madsci | 14400 | 4 | 3 | 140 | 103 | 14420 | 20 | Older PC monitor + analog TV (640x480, 1024x768, etc.) |
Steve | 15400 | 4 | 3 | 144 | 108 | 15552 | 152 | Older PC monitor + analog TV (640x480; 1024x768; etc.) |
madsci | 15400 | 4 | 3 | 144 | 107 | 15408 | 8 | Older PC monitor + analog TV (640x480, 1024x768, etc.) |
Steve | 87500 | 4 | 3 | 344 | 258 | 88752 | 1252 | Older PC monitor + analog TV (640x480; 1024x768; etc.) |
madsci | 87500 | 4 | 3 | 342 | 256 | 87552 | 52 | Older PC monitor + analog TV (640x480, 1024x768, etc.) |
Steve | 1414000 | 4 | 3 | 1376 | 1032 | 1420032 | 6032 | Older PC monitor + analog TV (640x480; 1024x768; etc.) |
madsci | 1414000 | 4 | 3 | 1375 | 1029 | 1414875 | 875 | Older PC monitor + analog TV (640x480, 1024x768, etc.) |
Steve | 20 | 4 | 5 | 8 | 10 | 80 | 60 | Art prints + medium format (8x10; 16x20) |
madsci | 20 | 4 | 5 | 4 | 5 | 20 | 0 | Art prints + medium format (8x10, 16x20) |
Steve | 555 | 4 | 5 | 24 | 30 | 720 | 165 | Art prints + medium format (8x10; 16x20) |
madsci | 555 | 4 | 5 | 21 | 27 | 567 | 12 | Art prints + medium format (8x10, 16x20) |
Steve | 1014 | 4 | 5 | 32 | 40 | 1280 | 266 | Art prints + medium format (8x10; 16x20) |
madsci | 1014 | 4 | 5 | 28 | 37 | 1036 | 22 | Art prints + medium format (8x10, 16x20) |
Steve | 1200 | 4 | 5 | 32 | 40 | 1280 | 80 | Art prints + medium format (8x10; 16x20) |
madsci | 1200 | 4 | 5 | 30 | 40 | 1200 | 0 | Art prints + medium format (8x10, 16x20) |
Steve | 2000 | 4 | 5 | 44 | 55 | 2420 | 420 | Art prints + medium format (8x10; 16x20) |
madsci | 2000 | 4 | 5 | 40 | 50 | 2000 | 0 | Art prints + medium format (8x10, 16x20) |
Steve | 12900 | 4 | 5 | 104 | 130 | 13520 | 620 | Art prints + medium format (8x10; 16x20) |
madsci | 12900 | 4 | 5 | 101 | 128 | 12928 | 28 | Art prints + medium format (8x10, 16x20) |
Steve | 14400 | 4 | 5 | 108 | 135 | 14580 | 180 | Art prints + medium format (8x10; 16x20) |
madsci | 14400 | 4 | 5 | 107 | 135 | 14445 | 45 | Art prints + medium format (8x10, 16x20) |
Steve | 15400 | 4 | 5 | 112 | 140 | 15680 | 280 | Art prints + medium format (8x10; 16x20) |
madsci | 15400 | 4 | 5 | 110 | 140 | 15400 | 0 | Art prints + medium format (8x10, 16x20) |
Steve | 87500 | 4 | 5 | 268 | 335 | 89780 | 2280 | Art prints + medium format (8x10; 16x20) |
madsci | 87500 | 4 | 5 | 264 | 332 | 87648 | 148 | Art prints + medium format (8x10, 16x20) |
Steve | 1414000 | 4 | 5 | 1064 | 1330 | 1415120 | 1120 | Art prints + medium format (8x10; 16x20) |
madsci | 1414000 | 4 | 5 | 1063 | 1331 | 1414853 | 853 | Art prints + medium format (8x10, 16x20) |
Steve | 20 | 16 | 9 | 16 | 9 | 144 | 124 | Standard HD display (1920x1080; 1280x720; etc.) |
madsci | 20 | 16 | 9 | 7 | 3 | 21 | 1 | Standard HD display (1920x1080, 1280x720, etc.) |
Steve | 555 | 16 | 9 | 32 | 18 | 576 | 21 | Standard HD display (1920x1080; 1280x720; etc.) |
madsci | 555 | 16 | 9 | 33 | 17 | 561 | 6 | Standard HD display (1920x1080, 1280x720, etc.) |
Steve | 1014 | 16 | 9 | 48 | 27 | 1296 | 282 | Standard HD display (1920x1080; 1280x720; etc.) |
madsci | 1014 | 16 | 9 | 45 | 23 | 1035 | 21 | Standard HD display (1920x1080, 1280x720, etc.) |
Steve | 1200 | 16 | 9 | 48 | 27 | 1296 | 96 | Standard HD display (1920x1080; 1280x720; etc.) |
madsci | 1200 | 16 | 9 | 48 | 25 | 1200 | 0 | Standard HD display (1920x1080, 1280x720, etc.) |
Steve | 2000 | 16 | 9 | 64 | 36 | 2304 | 304 | Standard HD display (1920x1080; 1280x720; etc.) |
madsci | 2000 | 16 | 9 | 61 | 33 | 2013 | 13 | Standard HD display (1920x1080, 1280x720, etc.) |
Steve | 12900 | 16 | 9 | 160 | 90 | 14400 | 1500 | Standard HD display (1920x1080; 1280x720; etc.) |
madsci | 12900 | 16 | 9 | 152 | 85 | 12920 | 20 | Standard HD display (1920x1080, 1280x720, etc.) |
Steve | 14400 | 16 | 9 | 176 | 99 | 17424 | 3024 | Standard HD display (1920x1080; 1280x720; etc.) |
madsci | 14400 | 16 | 9 | 160 | 90 | 14400 | 0 | Standard HD display (1920x1080, 1280x720, etc.) |
Steve | 15400 | 16 | 9 | 176 | 99 | 17424 | 2024 | Standard HD display (1920x1080; 1280x720; etc.) |
madsci | 15400 | 16 | 9 | 166 | 93 | 15438 | 38 | Standard HD display (1920x1080, 1280x720, etc.) |
Steve | 87500 | 16 | 9 | 400 | 225 | 90000 | 2500 | Standard HD display (1920x1080; 1280x720; etc.) |
madsci | 87500 | 16 | 9 | 396 | 221 | 87516 | 16 | Standard HD display (1920x1080, 1280x720, etc.) |
Steve | 1414000 | 16 | 9 | 1600 | 900 | 1440000 | 26000 | Standard HD display (1920x1080; 1280x720; etc.) |
madsci | 1414000 | 16 | 9 | 1587 | 891 | 1414017 | 17 | Standard HD display (1920x1080, 1280x720, etc.) |
Steve | 20 | 11 | 14 | 11 | 14 | 154 | 134 | legal paper (11x14) |
madsci | 20 | 11 | 14 | 3 | 7 | 21 | 1 | legal paper (11x14) |
Steve | 555 | 11 | 14 | 22 | 28 | 616 | 61 | legal paper (11x14) |
madsci | 555 | 11 | 14 | 20 | 28 | 560 | 5 | legal paper (11x14) |
Steve | 1014 | 11 | 14 | 33 | 42 | 1386 | 372 | legal paper (11x14) |
madsci | 1014 | 11 | 14 | 28 | 37 | 1036 | 22 | legal paper (11x14) |
Steve | 1200 | 11 | 14 | 33 | 42 | 1386 | 186 | legal paper (11x14) |
madsci | 1200 | 11 | 14 | 30 | 40 | 1200 | 0 | legal paper (11x14) |
Steve | 2000 | 11 | 14 | 44 | 56 | 2464 | 464 | legal paper (11x14) |
madsci | 2000 | 11 | 14 | 39 | 52 | 2028 | 28 | legal paper (11x14) |
Steve | 12900 | 11 | 14 | 110 | 140 | 15400 | 2500 | legal paper (11x14) |
madsci | 12900 | 11 | 14 | 100 | 129 | 12900 | 0 | legal paper (11x14) |
Steve | 14400 | 11 | 14 | 110 | 140 | 15400 | 1000 | legal paper (11x14) |
madsci | 14400 | 11 | 14 | 106 | 136 | 14416 | 16 | legal paper (11x14) |
Steve | 15400 | 11 | 14 | 121 | 154 | 18634 | 3234 | legal paper (11x14) |
madsci | 15400 | 11 | 14 | 110 | 140 | 15400 | 0 | legal paper (11x14) |
Steve | 87500 | 11 | 14 | 264 | 336 | 88704 | 1204 | legal paper (11x14) |
madsci | 87500 | 11 | 14 | 262 | 334 | 87508 | 8 | legal paper (11x14) |
Steve | 1414000 | 11 | 14 | 1056 | 1344 | 1419264 | 5264 | legal paper (11x14) |
madsci | 1414000 | 11 | 14 | 1054 | 1342 | 1414468 | 468 | legal paper (11x14) |
Steve | 20 | 17 | 22 | 17 | 22 | 374 | 354 | Standard letter size (8.5x11) |
madsci | 20 | 17 | 22 | 3 | 7 | 21 | 1 | Standard letter size (8.5x11) |
Steve | 555 | 17 | 22 | 34 | 44 | 1496 | 941 | Standard letter size (8.5x11) |
madsci | 555 | 17 | 22 | 20 | 28 | 560 | 5 | Standard letter size (8.5x11) |
Steve | 1014 | 17 | 22 | 34 | 44 | 1496 | 482 | Standard letter size (8.5x11) |
madsci | 1014 | 17 | 22 | 27 | 38 | 1026 | 12 | Standard letter size (8.5x11) |
Steve | 1200 | 17 | 22 | 34 | 44 | 1496 | 296 | Standard letter size (8.5x11) |
madsci | 1200 | 17 | 22 | 30 | 40 | 1200 | 0 | Standard letter size (8.5x11) |
Steve | 2000 | 17 | 22 | 51 | 66 | 3366 | 1366 | Standard letter size (8.5x11) |
madsci | 2000 | 17 | 22 | 39 | 52 | 2028 | 28 | Standard letter size (8.5x11) |
Steve | 12900 | 17 | 22 | 102 | 132 | 13464 | 564 | Standard letter size (8.5x11) |
madsci | 12900 | 17 | 22 | 99 | 131 | 12969 | 69 | Standard letter size (8.5x11) |
Steve | 14400 | 17 | 22 | 119 | 154 | 18326 | 3926 | Standard letter size (8.5x11) |
madsci | 14400 | 17 | 22 | 105 | 138 | 14490 | 90 | Standard letter size (8.5x11) |
Steve | 15400 | 17 | 22 | 119 | 154 | 18326 | 2926 | Standard letter size (8.5x11) |
madsci | 15400 | 17 | 22 | 109 | 142 | 15478 | 78 | Standard letter size (8.5x11) |
Steve | 87500 | 17 | 22 | 272 | 352 | 95744 | 8244 | Standard letter size (8.5x11) |
madsci | 87500 | 17 | 22 | 260 | 337 | 87620 | 120 | Standard letter size (8.5x11) |
Steve | 1414000 | 17 | 22 | 1054 | 1364 | 1437656 | 23656 | Standard letter size (8.5x11) |
madsci | 1414000 | 17 | 22 | 1045 | 1354 | 1414930 | 930 | Standard letter size (8.5x11) |