Copy link to clipboard
Copied
I am trying to find a script that allows me to fit image frames to content that allows me to choose hight (horisontally) only.
I am currently using the scale-graphics-script from adobe, but it does not give me the option to only fit the hight.
The case is that I work with easy catalog to create huge prints with hundreds of images. There are templates set up and when a product does not have an image, the image frame still takes up space. I need the image frame to collaps to content or to a setting of ex. 3 mm if no content. I cannot have it fit to frame vertically as this causes other elements to move out of place.
Can anyone help?
Copy link to clipboard
Copied
Hi @lindab27276074 Does this work when you have an image directly selected?
//A selected image
var s = app.activeDocument.selection[0];
fitWidth(s);
/**
* Expands an image’s parent frame’s width to match the image width
* @param an image
* @return void
*
*/
function fitWidth(o){
if (o.constructor.name == "Image") {
var ib = o.geometricBounds;
var pb = o.parent.geometricBounds;
o.parent.geometricBounds = [pb[0],ib[1],pb[2],ib[3]];
}
}