Copy link to clipboard
Copied
Hi everyone, I'd like to share a script.
Some time ago I wrote a script for bin-packing in Illustrator (posted here on the forum) and recently another user asked me if I could make a version for Indesign, which I have now done and I've published to github (the repo has scripts for both Indesign and Illustrator).
To read more about the scripts, including instructions, you can visit the github repo or to jump right in you can directly download the scripts.
What is bin packing?
Bin packing is arranging things so that they fit into "bins". In Illustrator, the bins are artboards, and in Indesign the bins are pages.
This is the sort of thing you can do in Illustrator (packing 35 items into 2 artboards):
And here's an Indesign example, packing 146 items onto 4 pages:
(This animation is using the option "Divide Bins at Guides", which keeps the items clear of the guides by a set margin.)
I hope someone will find the scripts useful. Feel free to leave feedback here or via the github repo.
- Mark
Copy link to clipboard
Copied
Amazing Mark!
Copy link to clipboard
Copied
Thanks Brian! As usual I am standing on the shoulders of giants!
Copy link to clipboard
Copied
Aren't we all?
Copy link to clipboard
Copied
Great work Mark!
Many nice settings (‘Divide Bins at Guides’, ‘Maximize’ options) will make this tool essential.
FYI, a much more rudimentary approach without UI stuff and extra options:
https://github.com/indiscripts/IdExtenso/tree/master/tests#rectpacktestjsx
I only mention it for the purpose of comparing the two underlying algorithms. IdExtenso's RectPack module is based on github.com/mapbox/potpack, while yours relies on Jake Gordon's Binary Tree Bin Packing Algorithm which is probably the root reference of all existing solutions. The different implementations might be interesting to analyze in terms of performance.
Best,
Marc
Copy link to clipboard
Copied
Hi @Marc Autret, thank you for your encouragement! I will be interested to compare the different approaches sometime—it fascinates me how such things work. As I'm sure you can tell I don't have a computer science background (or even programming background for that matter) and I struggle sometimes to understand, but I will press forward!
- Mark
Copy link to clipboard
Copied
Update 2024-10-23: I have added an option "Allow any rotation" which will rotate each item as needed to best fit inside a rectangle. This can improve packing significantly, depending on the shapes.
Here's an example—the bottom items are packed into the artboards at top. Without the new option, they would never have packed as well. Also note that the "J" and "q" are text items, not outlined.
- Mark
Find more inspiration, events, and resources on the new Adobe Community
Explore Now