Skip to main content
Inspiring
July 20, 2021
Question

Indesign Scripting. Image type is empty string.

  • July 20, 2021
  • 3 replies
  • 416 views

Hey everyone, i'm working on a script for exporting all images from the indd file and faced wired issued with one the template. For some reason when i retrieving image type i'm getting empty string (in other templates everything works fine). I haven't any information why it can be empty. Has anyone faced something like this?

Example of script which i used:

var doc = app.activeDocument;
var masterSpreads = doc.masterSpreads;
var masterPage = masterSpreads.itemByName('A-Cover');
var images = masterPage.allGraphics;

for (var i = 0; i < images.length; i++) {
   if (images[i] instanceof Image) {
      alert("Name: " + images[i].itemLink.name + ", type: " + images[i].imageTypeName);
   }
}

 

This topic has been closed for replies.

3 replies

Community Expert
July 20, 2021

Hm. I'd be surprised if I'd see an issue with my InDesign 14.0.3.433 on Windows 10.

Another test with that particular version is showing: No issue.

 

So perhaps this is an issue with your particular document?

Test if you see a result if you export the document to IDML, open the IDML file as document and save to a different name. Or copy one of the embedded images to a new document. Or unembed the images.

 

If this is a real bug with InDesign it could be a bug with the Mac OS version.

To test this run your code on a Windows machine.

 

Regards,
Uwe Laubender

( ACP )

Inspiring
July 20, 2021

Tried it on Windows and tried case with IDML file and nothing changed. But then i tried unembed image, it had been saved, then i tried to add this saved image to newly created document and everything works fine there, i can retrieve its type! So, it definately problem with specific indd file.

Community Expert
July 20, 2021

Is your result only with this particular image file?

Or do you get the problem with all placed image files?

 

What's your exact version of InDesign and OS ?

 

Regards,
Uwe Laubender

( ACP )

Inspiring
July 20, 2021

Hi! Thanks for reply, i'm using macos bigsur v11.4 and InDesign v14.0.3, also the same result i'm getting ofn server version of InDesing with same version. In this particular template all of jpeg images return empty string instead of type.

 

Community Expert
July 20, 2021

Hi Alex,

your code should work.

Just tested your code with a placed and embedded JPEG image on master A-Cover:

 

 

German InDesign 2021 version 16.3.0.24 on Windows 10.

 

Regards,
Uwe Laubender

( ACP )

Inspiring
July 20, 2021

Hey, thanks for try and reply.