Indesign Scripting. Image type is empty string.

Community Beginner ,
Jul 20, 2021 Jul 20, 2021

Copy link to clipboard

Copied

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?

Screenshot 2021-07-20 at 11.08.27.pngScreenshot 2021-07-20 at 11.08.41.png

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);
   }
}

 

TOPICS
Scripting

Views

51

Likes

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 ,
Jul 20, 2021 Jul 20, 2021

Copy link to clipboard

Copied

Hi Alex,

your code should work.

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

 

Alert-imageTypeName.PNG

 

German InDesign 2021 version 16.3.0.24 on Windows 10.

 

Regards,
Uwe Laubender

( ACP )

Likes

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 Beginner ,
Jul 20, 2021 Jul 20, 2021

Copy link to clipboard

Copied

Hey, thanks for try and reply.

Likes

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 ,
Jul 20, 2021 Jul 20, 2021

Copy link to clipboard

Copied

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 )

Likes

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 Beginner ,
Jul 20, 2021 Jul 20, 2021

Copy link to clipboard

Copied

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.

 

Screenshot 2021-07-20 at 12.37.51.pngScreenshot 2021-07-20 at 12.37.59.pngScreenshot 2021-07-20 at 12.38.04.pngScreenshot 2021-07-20 at 12.38.11.png

Likes

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 ,
Jul 20, 2021 Jul 20, 2021

Copy link to clipboard

Copied

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 )

Likes

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 Beginner ,
Jul 20, 2021 Jul 20, 2021

Copy link to clipboard

Copied

LATEST

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.

Likes

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