Skip to main content
Known Participant
February 9, 2018
Question

Algorithm for fitting different sized rectangles in a larger rectangle

  • February 9, 2018
  • 3 replies
  • 10998 views

I need script an algorithm to calculate best fit for rectangles in a larger rectangle.. and the larger rectangle changes size dynamically.

The dimensions of each rectangle include several 5 * 5 rectangles.

like the picture below.

pleas help me.

This topic has been closed for replies.

3 replies

Geppetto Luis
Legend
February 10, 2018
Tom Winkelmann
Inspiring
February 10, 2018

geppettol66959005

He wanna do this in Indesign

InDesign Scripting

Known Participant
February 9, 2018

giude me.

And as mentioned before you should post on the Scripting Forum.?

My description was obvious.

c.pfaffenbichler
Community Expert
Community Expert
February 9, 2018
My description was obvious.

You think so?

You did not make clear how many fields are indispensably necessary, how many images have to be placed, how the image can be clipped, … 

And as mentioned before you should post on the Scripting Forum.?

In post 1 I provided a Link to the Photoshop Scripting Forum:

First off you may want to post over at

Photoshop Scripting

Known Participant
February 9, 2018

The image should not be clipped.

jast place in page.

c.pfaffenbichler
Community Expert
Community Expert
February 9, 2018

First off you may want to post over at

Photoshop Scripting

I need script an algorithm to calculate best fit for rectangles in a larger rectangle.. and the larger rectangle changes size dynamically.

What exactly do you mean, especially by »changes size dynamically«?

And what about the white borders?

Please explain your intention in more detail.

The dimensions of each rectangle include several 5 * 5 rectangles.

Some of the images appear to be square, so what are the images’ proportions?

Known Participant
February 9, 2018

i want place images or textFrame in page.Like attached photo.

The dimensions of the document page may be dynamic.example : For the newspaper 50 * 70

For the magazine 30 * 20.

i want script i want place images or textFrame in page.

white borders is margin.

Some of the images appear to be square, so what are the images’ proportions?: example :The dimensions of a 10 × 2 image include 2 number 5 × 2 frame in horizontal direction.That is, each image is measured with a 5 * 2 fram. Please attention to the photo below.

ok?

.

c.pfaffenbichler
Community Expert
Community Expert
February 9, 2018

I fail to understand the principles governing the image-placement and -clipping so far.

How many images need to be placed, can certain images be dropped, do they have content that must not be clipped, …?

And as mentioned before you should post on the Scripting Forum.

But this seems like a bad fit of a task for Photoshop – Indesign (or possibly Illustrator) might provide preferable output (especially if texts are involved) and more convenience in image-placement.