Skip navigation
ColinBooth777
Currently Being Moderated

Convert embedded image to a linked

Dec 23, 2009 8:30 AM

I have a large file, with hundreds of embedded images.  Is there a way to make each export into its own file so that they are all linked, and therefore the file is much smaller and more manageable?

 
Replies
  • Currently Being Moderated
    Dec 23, 2009 8:39 AM   in reply to ColinBooth777

    Select the links in the links panel and from the links panel menu select unembed link.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 23, 2009 8:45 AM   in reply to ColinBooth777

    I use the script listed below for that.

     

    Peter

     

    // Unembed images without links: write them to disk and create a link
    // Images are saved as JPEGs in the document's folder using the name
    // "unembedded_" followed by a sequential number

    try {unembed_images ()}
        catch (e) {alert (e.message + "\r(line " + e.line + ")")};

    function unembed_images ()
        {
        // Alternative: baselineEncoding
        app.jpegExportPreferences.jpegRenderingStyle =  JPEGOptionsFormat.progressiveEncoding;
        // Options: maximum, high, medium, low
        app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.maximum;
        // Any resolution
        app.jpegExportPreferences.resolution = 300;
        var output_folder = String (app.documents[0].filePath);
        var g = app.documents[0].allGraphics;
        for (var i = 0; i < g.length; i++)
            {
            if (g[i].itemLink == null)
                {
                var image = File (output_folder + "/unembedded_" + String (i) + ".jpg");
                g[i].exportFile (ExportFormat.jpg, image);
                g[i].parent.place (image);
                }
            }
        }
     
    |
    Mark as:
  • Currently Being Moderated
    Dec 23, 2009 8:47 AM   in reply to ColinBooth777

    Bob's method is better if you can see filenames in the Links panel. But if you can't see any links, which is usually the case when images had been pasted into InDesign, then the script can be used.

     

    Peter

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 23, 2009 8:56 AM   in reply to ColinBooth777

    If there are no links in the panel, then all you'll have is very low res preview images. Turning those into links will do nothing to improve the quality.

     

    Bob

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 23, 2009 12:11 PM   in reply to ColinBooth777

    Copy the text of a script into a plain-text editor (such as Notepad on Windows) and save it using any name but with the extension .jsx in your scripts folder. To find out where that folder is and how to run the script, see here:

    http://www.kahrel.plus.com/indesign/script-info.html#scriptlocations

     

    Peter

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 23, 2009 2:21 PM   in reply to Bob Levine

    A pasted image (which does not show up in Links panel) is not a preview, and the resolution of the original image is preserved. However the pasted image is always RGB.

     

    Not trying to condone pasting images. It is bad practice – it bloats the file, the source image name is lost, and there is no direct means to edit the image in Photoshop.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 23, 2009 2:51 PM   in reply to Printer_Rick

    An image pasted from Photoshop, at least on Windows, IS, most emphatically, not full resolution (though as I recall, the Info panel erroneously reports the resolution of the original). I believe the problem exists on Mac as well, thought he info panel may behave differently. I can't speak about other sources because I don't paste images and haven't tested.

     

    I've attached a PDF of a demonstration file I made for my classes.

    Attachments:
     
    |
    Mark as:
  • Currently Being Moderated
    Dec 23, 2009 3:30 PM   in reply to Peter Spier

    Just did a paste vs. place test and exported to PDF (on a mac). Images are same resolution in Acrobat, 300 PPI. Since the placed image was RGB they look identical in the PDF.

     

    (Side note for color management nerds – if you paste a grayscale image, the result is the same as assigning Gray Gamma 2.2 profile in Photoshop, then converting to the InDesign document RGB color space. ID has no gray color management and defaults to Gray Gamma 2.2)

     

    My big question is, why in the world don't the pasted images show up in the Links panel? I never paste images myself but I come across pasted images all the time. It would be ideal if InDesign showed them as embedded links, instead of letting them float on the page without any identification.

     

    I really like the script posted earlier but I wish it saved out the images as TIFF instead of JPEG.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 23, 2009 4:49 PM   in reply to Printer_Rick

    I'm sorry, Rick. I don't know what you're doing or looking at but pasting an image is most certainly NOT going to give you a full resolution graphic. It's a low res screen preview and ID can't link to something that's only sitting on the clipboard.

     

    Bob

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 23, 2009 5:29 PM   in reply to ColinBooth777

    Pasting a previously placed image would give you full res -- in essence you are pasting the pointer to the image...

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 24, 2009 4:14 AM   in reply to Peter Spier

    Peter,

     

    I did the same test that Rick did: copied a high-res image in PS, pasted that in ID, then placed the same image. So I had a document with two images that looked the same, but with just one link in the Links panel. When I exported this to PDF (press quality setting), the images took equally long to process, and later in Avrobat I couldn't see any difference between the two (see attached file). So I got the same results as Rick.

     

    Your test shows clear differences. Do you have any idea why your test comes out different? I'm curious -- I don't know very much about images and resolution.

     

    Thanks,

     

    Peter

    Attachments:
     
    |
    Mark as:
  • Currently Being Moderated
    Dec 24, 2009 4:43 AM   in reply to Peter Kahrel

    Well, what do you know. Here's a lesson in not relying on past experience with old technology.

     

    The PDF I posted above was made several years ago for a calss I used to teach, and at the time CS3 was state of the art. The file was created in Windows, and I know something was different about what happened on Mac -- I think it was the resolution reporting in the info panel, but I really don't remember. There is no question there was a probelm then. I may even have reported it as a bug.

     

    Fast forward to the present. I just repeated the test myself using CS3 (5.0.4) and the resoluion issue is still present, and in CS4 (6.0.4) and you guys are correct -- the pasted image is now full res. It is still RGB, however, when the original is CMYK. Apparently the clipboard handling is fixed, at least to a degree, and I'll change my rant in the future.

     

    Thanks for the update to both Peter K and Rick.

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 24, 2009 4:44 AM   in reply to Peter Kahrel

    An easier test could be this: copy/paste an image, unembed it using the script, and see what size it is. I tested with a JPG file 4,687,585 bytes long. When pasted in an ID document and written to disk by the script it was 3,828,529 bytes. The script used the current JPEG settings of maximum quality, 300 ppi.

     

    So it came out a bit smaller -- don't know what that means.

     

    Peter

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 24, 2009 4:47 AM   in reply to Printer_Rick

    > I wish it saved out the images as TIFF instead of JPEG.

     

    Unfortunately that's not possible. The only options are JPG, EPS, and PNG. I forgot to mention that the JPG settings used are the application's current settings.

     

    Peter

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 24, 2009 4:52 AM   in reply to Peter Kahrel

    pkahrel wrote:

     

    An easier test could be this: copy/paste an image, unembed it using the script, and see what size it is. I tested with a JPG file 4,687,585 bytes long. When pasted in an ID document and written to disk by the script it was 3,828,529 bytes. The script used the current JPEG settings of maximum quality, 300 ppi.

     

    So it came out a bit smaller -- don't know what that means.

     

    Peter

    I think it means that the image is being re-compressed, just as it would be if you resaved a jpeg as a new jpeg file in Photoshop.

     

    Peter

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 24, 2009 4:56 AM   in reply to Peter Kahrel

    pkahrel wrote:

     

    > I wish it saved out the images as TIFF instead of JPEG.

     

    Unfortunately that's not possible. The only options are JPG, EPS, and PNG. I forgot to mention that the JPG settings used are the application's current settings.

     

    Peter

    Peter,

     

    Here's a really ugly scenario, but something to think about. Can you export as .eps, open those in Photoshop and save there to a new folder as either tiff or psd, then "relink to folder" in ID? I know you could do the conversion as a batch in Photoshop and relink in ID as separate operations, but I don't know enough about scripting to know if an ID script would be able to handle it.

     

    Peter

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 24, 2009 5:25 AM   in reply to Peter Spier

    Quite the advancement. Perhaps to filed along with the advancement in pulling graphics out of Word files.

     

    Peter K, can that script be changed to save as PNG? Might be a safer file format as far as compression goes.

     

    Bob

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 24, 2009 6:37 AM   in reply to Peter Spier

    > Here's a really ugly scenario ...

     

    You can't script that from within InDesign, but PhotoShop has an image processor (File > Scripts > Image Processor). This is a script that ships with PS (CS3, don't know about CS4). You can convert all images by the folder to JPG, PSD and TIFF. Works very well.

     

    Peter

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 24, 2009 6:51 AM   in reply to Bob Levine

    Change the highlighted items in these two lines:

     

    var image = File (output_folder + "/unembedded_" + String (i) + ".jpg");
    g[i].exportFile (ExportFormat.jpg, image);

     

    to this:

     

    var image = File (output_folder + "/unembedded_" + String (i) + ".png");
    g[i].exportFile (ExportFormat.pngFormat, image);

     

    I'll put something together with some dialog to pick a format.

     

    Peter

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 24, 2009 6:59 AM   in reply to Peter Kahrel

    > You can't script that from within InDesign,

     

    That wasn't very clear. You'd first unembed all pasted images in InDesign. To do that, in the script change the highlighted items in these two lines:

     

    var image = File (output_folder + "/unembedded_" + String (i) + ".jpg");
    g[i].exportFile (ExportFormat.jpg, image);

     

    like this

     

    var image = File (output_folder + "/unembedded_" + String (i) + ".eps");
    g[i].exportFile (ExportFormat.epsType, image);

     

    Then you run the Image processor script in PhotoShop.

     

    Peter

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 28, 2009 8:49 AM   in reply to Peter Kahrel

    Here's the script mentioned earlier: http://www.kahrel.plus.com/indesign/dump_pasted_images.html

     

    Peter

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points