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

How to embed images in an INX file using script

Participant ,
Sep 07, 2010 Sep 07, 2010

Hi All,

Kindly help me in embedding images in INX file using Indesign Javascript.

I have used the following code to embed images in an indd document and exporting that document to inx. But the images in inx are not embedded by default.

var linksCount = myDocument.links.count();
var linksOnPage = myDocument.links;
for(var x=0;x<linksCount;x++){
    var linkedItem = linksOnPage.item(0);
    linkedItem.unlink();
}

myDocument.save(new File("filename.indd"));

myDocument.exportFile(ExportFormat.INDESIGN_INTERCHANGE, File("filename.inx"), app.pdfExportPresets.item("[Press Quality]"));

Thanks in advance,

Anitha

TOPICS
Scripting
1.3K
Translate
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
Contributor ,
Sep 07, 2010 Sep 07, 2010

Hi

I think your script has two mistakes

  1. you embed only first link image in for loop => set x for linksOnPage
  2. exporting to inx isnot need PDF export preset => remove app.pdfExportPresets.item("[Press Quality]") from exportFile()

this work for me.

myDocument = app.documents[0];

var linksCount = myDocument.links.count();
var linksOnPage = myDocument.links;
for(var x=0;x < linksCount;x++){
    var linkedItem = linksOnPage.item(x);
    linkedItem.unlink();
}



myDocument.save(new File("filename.indd"));

myDocument.exportFile(ExportFormat.INDESIGN_INTERCHANGE, File("filename.inx"));

thank you

Translate
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 ,
Sep 07, 2010 Sep 07, 2010

Hi,

Thanks a lot for giving the solution. It worked. But the file size of the INX is so huge when compared to INDD document.

Please provide me some solution to reduce the size of the INX file.

Thanks,
Anitha

Translate
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 ,
Sep 08, 2010 Sep 08, 2010

Then throw out the images.

Your INDD file size also grows (by exactly the amount of the total file size of your images, if I'm not mistaken), but exporting it to INX makes it much, much worse. INX is an uncompressed ASCII file, and the binary information of images expands *hugely* when you convert it into ASCII notation.

If you only want to decrease the file size to be able to send it around per mail, compress the INX file itself. Plain ASCII text compresses wonderfully, often to 50% and sometimes much less than that.

Translate
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 ,
Sep 08, 2010 Sep 08, 2010

Hi Jongware,

Thanks for your reply. As you said, the file size increases when the number of images increases. I can't throw out the images because the customer needs the images to be embedded in the file. Can you please provide some sample script which compresses the INX.

Thanks,

Anitha

Translate
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 ,
Sep 08, 2010 Sep 08, 2010
LATEST

wot script? just right-click the file and choose "Compress [filename]" (Mac OS X) or "Send to ->  Compressed (Zipped) Folder" (Windows).

If you want to have a script to automatically zip up your file, it needs more work (e.g., downloading an external zip program and calling that as an external command), & I can't help you with that.

Translate
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