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

Script for filling the bleed with adjacent picture

Participant ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

Hi guys,

Scripts are meant to help us doing repetitive and time consuming tasks, and I'm getting crazy about that one. So I'd willing to jump into wrting one. The thing is, starting from scratch isn't easy, especially when you're a begginner at scripting.

So I'd like to gather advice before going anywhere.

 

What is the problem :

Filling the bleed manually. Very time consuming.

On any document with some BG layout, the bleed has to be filled, we all know that. I use a lot of pictures and for some reasons I do not want put some part of them into the bleed area. At first I thought the script from Marc Autret (FillBleed) was gold. https://www.indiscripts.com/post/2018/03/fill-bleed-fix-image-frames-so-they-meet-bleed-edge

But the main issue of the script is that it extends the picture, killing the dpi ratio. These new low resolution small pictures are then refused by printing houses. Minimum dpi is 240. Expanding pictures i not then an accurate solution when printing professionnaly is required.

 

What is current and time consuming "solution" :

The only way to fill the bleed (as far as I know) is to duplicate/ flip the pictures and adjusts the size of them and position them next to each other, to the top/bottom/left/right/ top-left/ bottom-left… wherever it is necessary. 

 

What would the welcoming script do :

After selecting a picture/ textframe/ any object, it would

- open a window 

- propose a design (similar as the reference points at the top left of ID) where I can select which parts of bleed i want to mirror. Top-left/ Left/ Bottom-left etc. 

- Calculate the position of the original frame (to fill just enough of bleed, whatever the size of it or the actual position of the selected frame)

- Fill the bleed with extra frames of accurate size and flipped pictures.

The process sounds ok to me. Please, tell me if I'm missing something or if it isn't clear enough.

I would just love to hear advice from you guys, at least pointing a direction toward which functions to use to begin with. I would have liked "FillBleed" to be readable to get a start at least but it's crypted.
If I can save some time by get some clues, it'll be nice

 

Thanks for your time

 

Fred

TOPICS
Performance , Scripting

Views

855

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
Participant ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

Capture d’écran 2022-08-04 à 02.25.40.jpg

Sometimes, a picture speaks louder than a long prose.

This UI I've done should do the trick for the time being. That was the easiest part (thanks https://scriptui.joonas.me/ a lot)

Now, I need to get my brain boiling…

 

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
New Here ,
Mar 13, 2023 Mar 13, 2023

Copy link to clipboard

Copied

Hey @-Dain-

 

I was wondering, if you're making any progress on this script.

It would be a deal changer for my job, sadly I can't make scripts. 

I know adobe pdf has a mirror image for bleed function, but a lot of the times it slower then indesign. 

 

Kind regards, 

Tristan

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
Community Expert ,
Mar 14, 2023 Mar 14, 2023

Copy link to clipboard

Copied

Hi @Tristan Flex , I use this script in-house for checking the bleeds on the active spread. It only adjusts rectangles and text frames. Not sure if it would work in all cases—it might break with a rotated or sheared object?

 

 

 


//the tolerance in points—
//if the object is closer than bt to the page trim it gets adjusted
var bt = 10;

adjustBleeds()

var d,dp,tp,bb,rb,lb
function adjustBleeds(){
    if (app.documents.length == 0) {
        alert("No Documents Open")
        return
    } 
    app.scriptPreferences.measurementUnit = MeasurementUnits.POINTS;
    d = app.activeDocument;
    dp = d.documentPreferences;
    d.zeroPoint = [0,0];
    d.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;
    
    //get bleed settings
    tb = dp.documentBleedTopOffset;
    bb = dp.documentBleedBottomOffset;
    rb = dp.documentBleedOutsideOrRightOffset;
    lb = dp.documentBleedOutsideOrRightOffset;
    if (!dp.facingPages) {
        lb = dp.documentBleedInsideOrLeftOffset;
    }
    //the active spread’s page items
    var pi = app.activeWindow.activeSpread.allPageItems
    for (var i = 0; i < pi.length; i++){
        if (pi[i].constructor.name == "Rectangle" || pi[i].constructor.name == "TextFrame") {
            setBleed(pi[i])
        } 
    };   
    
    app.scriptPreferences.measurementUnit = AutoEnum.AUTO_VALUE;
}

/**
* Sets a page item that is within a tolerance (bt) to the page bleed offsets
* Set rectangles and text frames only
* @ param a 
* @ return value 
* 
*/
function setBleed(pi){
    //check if the page item is on the pasteboard
    if (pi.parentPage == null) {
        return
    }
    var pp = pi.parentPage;
    var px = pp.index;
    var pc = pp.parent.pages.length-1;
    var ps = pp.side;

    //page width and height
    var ph = pp.bounds[2]-pp.bounds[0];
    var pw = pp.bounds[3]-pp.bounds[1];

    var b = pi.geometricBounds;
    var ba = b;
    var ti = [0,0,0,0];
    var sc;
    
    //set top bleed
    if (b[0] < bt) {
        ba[0] = -tb
        if (pi.constructor.name == "TextFrame") {
            sc = 100/pi.absoluteVerticalScale
            ti[0] = (pi.textFramePreferences.insetSpacing[0]+tb+pi.geometricBounds[0])*sc 
            ti[1] = pi.textFramePreferences.insetSpacing[1];    
        } 
    } 
    //set bottom bleed
    if (b[2] > ph-bt) {
        ba[2] = ph + bb;
        if (pi.constructor.name == "TextFrame") {
            sc = 100/pi.absoluteVerticalScale
            ti[2] = (pi.textFramePreferences.insetSpacing[2]+bb)*sc
            ti[0] = pi.textFramePreferences.insetSpacing[0];
        } 
    }
    //set left bleed
    if (ps == PageSideOptions.LEFT_HAND || ps == PageSideOptions.SINGLE_SIDED && px == 0 && b[1] < bt) {
        ba[1] = -lb
        if (pi.constructor.name == "TextFrame") {
            sc = 100/pi.absoluteHorizontalScale
            ti[1] = (pi.textFramePreferences.insetSpacing[1]+lb+pi.geometricBounds[1])*sc
            ti[3] = pi.textFramePreferences.insetSpacing[3];
        } 
    } 
    //set right bleed
    if (ps == PageSideOptions.RIGHT_HAND || ps == PageSideOptions.SINGLE_SIDED && px == pc && b[3] > pw - bt) {
        ba[3] = pw + rb;
        if (pi.constructor.name == "TextFrame") {
            sc = 100/pi.absoluteHorizontalScale
            ti[3] = (pi.textFramePreferences.insetSpacing[3]+rb)*sc
            ti[1] = pi.textFramePreferences.insetSpacing[1];
        } 
    }
    pi.geometricBounds = ba

    if (pi.constructor.name == "TextFrame") {
        pi.textFramePreferences.insetSpacing = ti;
    }
}

 

 

 

Before and after:

 

Screen Shot 20.png

Screen Shot 22.png

 

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
New Here ,
Jul 10, 2023 Jul 10, 2023

Copy link to clipboard

Copied

Hey @-Dain- , 

 

not really what I was looking for, unfortunately. 

I was hoping you would find a way to mirror an image, like adobe pdf can do, but then in InDesign or Illustrator. 

Anyway, keep up the good work! 

 

Kind regards, 

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
New Here ,
Jul 10, 2023 Jul 10, 2023

Copy link to clipboard

Copied

LATEST

My bad wrong person 

thanks, @rob day 

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