• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Fit image frame to content script - only horisontally

Community Beginner ,
Jan 12, 2022 Jan 12, 2022

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?

TOPICS
Scripting

Views

121

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 12, 2022 Jan 12, 2022

Copy link to clipboard

Copied

LATEST

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]];
    } 
}

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines