Skip to main content
Participating Frequently
March 18, 2019
Question

Is it possible to auto select of active document only images in Illustrator by Script?

  • March 18, 2019
  • 3 replies
  • 1434 views

Hi All,

I have a task, to crop only images of PDF and export it as PNG formate.

But I am facing an issue to select the image by a script.

My planning to complete the task :

     Open pdf (manually)

     Select all images of the current document crop it and export as png by using the script.

Facing issue to the auto select image by the script.

Kindly help

Thank you.

This topic has been closed for replies.

3 replies

Lumenn
Inspiring
March 20, 2019

It is possible to recognize images, so you can try to go with negation.

Loop through pageItems, and check if they aren't rasterItem

CarlosCanto
Community Expert
Community Expert
March 18, 2019

do you want to "extract" all images? or do you actually want to "crop" them as in removing some pixels from images?

Participating Frequently
March 19, 2019

Hi Carlos Canto,

Thank you for reply.

Yes, I want to extract all images (jpg, png, chat graph etc.) of a pdf page and export them as EPS or PNG formate.

Example: 

In above image, I opened a pdf page and I have selected the image area manually for your reference.
My requirement is to export these images as EPS or PNG.

CarlosCanto
Community Expert
Community Expert
March 19, 2019

have you tried opening your pdf with Photoshop? it has an option to open images as separate files, it basically extracts them for you.

Lumenn
Inspiring
March 18, 2019

Hey, i think it depednds on what files do you process, but in most cases, you can find all images with:

app.activeDocument.rasterItems;

This will return you a table with all images in the document.