Convert embedded image to a linked

New Here ,
Dec 23, 2009 Dec 23, 2009

Copy link to clipboard

Copied

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?

Views

22.2K

Likes

translate

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
Most Valuable Participant ,
Dec 23, 2009 Dec 23, 2009

Copy link to clipboard

Copied

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

Likes

translate

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
Adobe Community Professional ,
Dec 23, 2009 Dec 23, 2009

Copy link to clipboard

Copied

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.itemLink == null)
            {
            var image = File (output_folder + "/unembedded_" + String (i) + ".jpg");
            g.exportFile (ExportFormat.jpg, image);
            g.parent.place (image);
            }
        }
    }

Likes

translate

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
Enthusiast ,
Jan 05, 2021 Jan 05, 2021

Copy link to clipboard

Copied

@Peter Kahrel 

Found this repo of scripts of yours and the dumb-pasted-images.jsx works fine. Atleast when you add AI in the dropdown. The EPS failed and returned java error. I tried copy/paste to photoshop and noticed they were placed vectors. Knowing this is simply added AI in the dropdown and it works liek a champ

 

here' you can find that script if other needs it. He has many very usefull scripts. In line 81 add AI before or after EPS and try the script again.

https://creativepro.com/files/kahrel/indesign/unembed_images.html

Likes

translate

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
Adobe Community Professional ,
Dec 23, 2009 Dec 23, 2009

Copy link to clipboard

Copied

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

Likes

translate

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 ,
Dec 23, 2009 Dec 23, 2009

Copy link to clipboard

Copied

Sorry to be a pest... how exactly do I run that?  I've only scripted in non-adobe programs; Rhino 3D and AutoCAD

Likes

translate

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
Most Valuable Participant ,
Dec 23, 2009 Dec 23, 2009

Copy link to clipboard

Copied

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

Likes

translate

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
Advisor ,
Dec 23, 2009 Dec 23, 2009

Copy link to clipboard

Copied

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.

Likes

translate

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
LEGEND ,
Dec 23, 2009 Dec 23, 2009

Copy link to clipboard

Copied

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.

Likes

translate

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
Advisor ,
Dec 23, 2009 Dec 23, 2009

Copy link to clipboard

Copied

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.

Likes

translate

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
Adobe Community Professional ,
Dec 24, 2009 Dec 24, 2009

Copy link to clipboard

Copied

> 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

Likes

translate

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
LEGEND ,
Dec 24, 2009 Dec 24, 2009

Copy link to clipboard

Copied

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

Likes

translate

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
Adobe Community Professional ,
Dec 24, 2009 Dec 24, 2009

Copy link to clipboard

Copied

> 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

Likes

translate

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
Adobe Community Professional ,
Dec 24, 2009 Dec 24, 2009

Copy link to clipboard

Copied

> 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.exportFile (ExportFormat.jpg, image);

like this

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

Then you run the Image processor script in PhotoShop.

Peter

Likes

translate

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
Adobe Community Professional ,
Dec 28, 2009 Dec 28, 2009

Copy link to clipboard

Copied

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

Peter

Likes

translate

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
Adobe Community Professional ,
Dec 24, 2009 Dec 24, 2009

Copy link to clipboard

Copied

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

Likes

translate

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
LEGEND ,
Dec 24, 2009 Dec 24, 2009

Copy link to clipboard

Copied

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.

Likes

translate

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
Most Valuable Participant ,
Dec 24, 2009 Dec 24, 2009

Copy link to clipboard

Copied

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

Likes

translate

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
Adobe Community Professional ,
Dec 24, 2009 Dec 24, 2009

Copy link to clipboard

Copied

Change the highlighted items in these two lines:

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

to this:

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

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

Peter

Likes

translate

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
Adobe Community Professional ,
Dec 24, 2009 Dec 24, 2009

Copy link to clipboard

Copied

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

Likes

translate

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
LEGEND ,
Dec 24, 2009 Dec 24, 2009

Copy link to clipboard

Copied

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

Likes

translate

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
Most Valuable Participant ,
Dec 23, 2009 Dec 23, 2009

Copy link to clipboard

Copied

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

Likes

translate

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
Adobe Community Professional ,
Dec 23, 2009 Dec 23, 2009

Copy link to clipboard

Copied

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

Likes

translate

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
LEGEND ,
Dec 23, 2009 Dec 23, 2009

Copy link to clipboard

Copied

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

Likes

translate

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