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

rasterize of AppleScript

New Here ,
Sep 27, 2021 Sep 27, 2021

Copy link to clipboard

Copied

How to use applescript's rasterize, and how to set the parameters inside, I haven't found it after searching for a long time, please help

TOPICS
Scripting

Views

396

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

correct answers 1 Correct answer

Engaged , Sep 27, 2021 Sep 27, 2021

Yeah, that `rasterize` command is really poorly designed. Alas, a lot of the newer commands in AI were added by engineers with limited understanding of AppleScript or good UI/UX design.

 

Here’s a simple example, to rasterize the entire document’s content at 72dpi:

 

tell application "Adobe Illustrator"
	tell document 1
		rasterize source art page items with options {resolution:72}
	end tell
end tell

 

(There’s also the `export` command, if you want to save a document as PNG/JPEG/etc.)

Votes

Translate

Translate
Adobe
Engaged ,
Sep 27, 2021 Sep 27, 2021

Copy link to clipboard

Copied

Yeah, that `rasterize` command is really poorly designed. Alas, a lot of the newer commands in AI were added by engineers with limited understanding of AppleScript or good UI/UX design.

 

Here’s a simple example, to rasterize the entire document’s content at 72dpi:

 

tell application "Adobe Illustrator"
	tell document 1
		rasterize source art page items with options {resolution:72}
	end tell
end tell

 

(There’s also the `export` command, if you want to save a document as PNG/JPEG/etc.)

Votes

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 ,
Sep 27, 2021 Sep 27, 2021

Copy link to clipboard

Copied

Thank you so much, but there is still a problem. When I tried to find multiple artboards, he only rasterized one of them, and the contents of the other artboards disappeared. I expect all artboards to be rasterize.

 

Also, I only recently started trying to use AppleScript, so I am not very familiar with this. I really appreciate your help.

 

Votes

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
Engaged ,
Sep 29, 2021 Sep 29, 2021

Copy link to clipboard

Copied

By default, `rasterize` uses the bounds of artboard 1. You can specify a different area to rasterize via the `inside` parameter:

 

tell application "Adobe Illustrator"
	tell document 1
		set boundRect to {0, 1024, 2048, 0} -- {left,top,right,bottom} in points
		rasterize source art page items with options {resolution:72} inside boundRect
	end tell
end tell

Votes

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
Engaged ,
Sep 29, 2021 Sep 29, 2021

Copy link to clipboard

Copied

LATEST

Alternatively, for the `source art` parameter you can pass only the page items that lie on a specific artboard, leaving page items on other artboards untouched. Alas, AI doesn’t allow you to write `page items of artboard "NAME"`, which would be ideal, so you will have to figure out which page items lie on a particular artboard for yourself.

 

The easiest solution is to put each artboard’s content into a different layer while building the artwork, allowing you to write `rasterize source art page items of layer "NAME" …`. Otherwise, you’ll need get the bounding boxes of all path items in the document, then sort those into separate lists according to which artboard they lie on, although that’s more work to implement and will run slower.

 

I can’t really provide more specific recommendations without knowing more about your documents and why you want to rasterize them.

Votes

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