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

How to remove linked images, but keep image frame?

New Here ,
Aug 22, 2018 Aug 22, 2018

Copy link to clipboard

Copied

I'd like to deliver a copy of my InDesign file to someone, but without the linked images.

Is there a way to break the links to all the images, but still keep the image frame, in such a way that the images could be re-linked later?

Views

6.4K

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

correct answers 1 Correct answer

Guru , Aug 22, 2018 Aug 22, 2018

Here I wrote a 'quick & dirty' script.

I assume that all images were placed into rectangles: not ovals, polygons, etc. If this is not the case, remove lines 13 and 15.

Before

2018-08-23_7-07-32.png

After

2018-08-23_7-07-59.png

You can Undo/Redo the whole script

2018-08-23_7-08-22.png

var scriptName = "Remove links",

doc;

app.doScript(PreCheck, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "\"" + scriptName + "\" script");

//===================================== FUNCTIONS ======================================

function Main() {

    var links = doc.links;

   

...

Votes

Translate

Translate
Community Expert ,
Aug 22, 2018 Aug 22, 2018

Copy link to clipboard

Copied

Just deliver the InDesign file. When the recipient of the file will open it, there will be an alert message telling that links are missing, but the preview will stay in the file.

Maybe I did not fully understand the question…

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 ,
Aug 22, 2018 Aug 22, 2018

Copy link to clipboard

Copied

Sorry if my question was not clear enough.

I would like the delivered file to NOT have the preview of the images, just blank image frames.

Is this possible?

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
Guru ,
Aug 22, 2018 Aug 22, 2018

Copy link to clipboard

Copied

Here I wrote a 'quick & dirty' script.

I assume that all images were placed into rectangles: not ovals, polygons, etc. If this is not the case, remove lines 13 and 15.

Before

2018-08-23_7-07-32.png

After

2018-08-23_7-07-59.png

You can Undo/Redo the whole script

2018-08-23_7-08-22.png

var scriptName = "Remove links",

doc;

app.doScript(PreCheck, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "\"" + scriptName + "\" script");

//===================================== FUNCTIONS ======================================

function Main() {

    var links = doc.links;

    if (doc.links.length == 0) ErrorExit("The document has no links.", true);

    for (var i = links.length-1; i >= 0; i--) {

        try {

            if (links.parent.parent.constructor.name == "Rectangle") {

                links.parent.remove();

            }

        }

        catch (err) {

            //$.writeln(i + " - " + err);

        }

    }

}

//--------------------------------------------------------------------------------------------------------------------------------------------------------

function PreCheck() {

    if (app.documents.length == 0) ErrorExit("Please open a document and try again.", true);

    doc = app.activeDocument;

    if (doc.converted) ErrorExit("The current document has been modified by being converted from older version of InDesign. Please save the document and try again.", true);

    if (!doc.saved) ErrorExit("The current document has not been saved since it was created. Please save the document and try again.", true);

    Main();

}

//--------------------------------------------------------------------------------------------------------------------------------------------------------

function ErrorExit(error, icon) {

    alert(error, scriptName, icon);

    exit();

}

//--------------------------------------------------------------------------------------------------------------------------------------------------------

Here in the Links section I posted a similar script which removes only missing links.

Hope it helps!

— Kas

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 ,
Aug 23, 2018 Aug 23, 2018

Copy link to clipboard

Copied

Hi Kasyan,

and how should the links be retrieved when the document comes back?

One could store the links as text string with a label in the frame with insertLabel( frame.id.toString() , link.filePath.toString() ) The information could be retrieved by another script that uses extractLabel( frame.id.toString() ) and linked again, but that would also mean we have to store some other information about the linked graphic like size and relative position in the frame.


And one could hope, that the frame is never replaced with a different one.

Regards,
Uwe

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
Guru ,
Aug 23, 2018 Aug 23, 2018

Copy link to clipboard

Copied

Hi Uwe,

I failed to read (carefully) the last part. Sorry!

I thought the OP would make a 'stripped of links' copy and send it to someone else keeping the original version with links.

Of course, this can be implemented either by inserting-extracting labels containing the image path, or by creating a sort of database (csv/txt-file) with frame id and the relative file path.

— Kas

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
Guru ,
Aug 23, 2018 Aug 23, 2018

Copy link to clipboard

Copied

Here I made a new version: two scripts (both are quick & dirty).

1. Remove links — now remembers the original link path in label

2018-08-23_20-11-21.png

var scriptName = "Remove links",

doc;

app.doScript(PreCheck, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "\"" + scriptName + "\" script");

//===================================== FUNCTIONS ======================================

function Main() {

    var frame, link,

    links = doc.links;

    if (doc.links.length == 0) ErrorExit("The document has no links.", true);

    for (var i = links.length-1; i >= 0; i--) {

        try {

            link = links;

            frame = link.parent.parent;

            if (frame.constructor.name == "Rectangle") {

                frame.label = link.filePath;

                link.parent.remove();

            }

        }

        catch (err) {

            //$.writeln(i + " - " + err);

        }

    }

}

//--------------------------------------------------------------------------------------------------------------------------------------------------------

function PreCheck() {

    if (app.documents.length == 0) ErrorExit("Please open a document and try again.", true);

    doc = app.activeDocument;

    if (doc.converted) ErrorExit("The current document has been modified by being converted from older version of InDesign. Please save the document and try again.", true);

    if (!doc.saved) ErrorExit("The current document has not been saved since it was created. Please save the document and try again.", true);

    Main();

}

//--------------------------------------------------------------------------------------------------------------------------------------------------------

function ErrorExit(error, icon) {

    alert(error, scriptName, icon);

    exit();

}

//--------------------------------------------------------------------------------------------------------------------------------------------------------

2. Restore removed links — restores images by placing them if the label is not empty and the file exists.

2018-08-23_20-25-37.png

var scriptName = "Restore removed links",

doc;

app.doScript(PreCheck, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "\"" + scriptName + "\" script");

//===================================== FUNCTIONS ======================================

function Main() {

    var frame, path, file;

    for (var i = 0; i < doc.rectangles.length; i++) {

        try {

            frame = doc.rectangles;

           

            if (frame.label != "") {

                path = frame.label;

                file = new File(path);

               

                if (file.exists) {

                    frame.place(path);

                }

            }

        }

        catch (err) {

            //$.writeln(i + " - " + err);

        }

    }

}

//--------------------------------------------------------------------------------------------------------------------------------------------------------

function PreCheck() {

    if (app.documents.length == 0) ErrorExit("Please open a document and try again.", true);

    doc = app.activeDocument;

    if (doc.converted) ErrorExit("The current document has been modified by being converted from older version of InDesign. Please save the document and try again.", true);

    if (!doc.saved) ErrorExit("The current document has not been saved since it was created. Please save the document and try again.", true);

    Main();

}

//--------------------------------------------------------------------------------------------------------------------------------------------------------

function ErrorExit(error, icon) {

    alert(error, scriptName, icon);

    exit();

}

//--------------------------------------------------------------------------------------------------------------------------------------------------------

The scripts handle only the simplest situation: don't handle cropping, scaling, rotation, flipping of images, etc.

Anyway, the OP's description is very brief and I have no idea about his specific requirements, So, this is more an illustration of the approach to be used than a script working in all situations,

— Kas

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 ,
Aug 24, 2018 Aug 24, 2018

Copy link to clipboard

Copied

Hi Kas,

yes, this is the solution I suggested.

Maybe I'd do it not with property label because the links, names of the formerly linked images, can easily be seen from the Script Label Panel, but yes, basically that's the way.

Regards,
Uwe

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 ,
Aug 24, 2018 Aug 24, 2018

Copy link to clipboard

Copied

Or, even better, because there will be no trace in the document sent away, a log file could store the id numbers of the conainer frames associated with all necessary information like file path and other properties about cropping, scaling, rotation, skewing. Then with a second script the OP could retrieve the info and the links by using the log.

Regards,
Uwe

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
Guru ,
Aug 25, 2018 Aug 25, 2018

Copy link to clipboard

Copied

LATEST

Hi Uwe,

I know about the insert/extractLabel commands using which you can't open the lock (see the file path) without having (knowing) the key. (BTW, I use mostly them in my scripting practice).

I used label intentionally to illustrate the approach: to make the screenshot above.

In any case, the OP remains silent so I think he isn’t interested in this topic anymore.

Regards,
Kasyan

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 ,
Aug 23, 2018 Aug 23, 2018

Copy link to clipboard

Copied

If you export the file as IDML the link previews will be stripped out.

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