Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

Resizing PNG with Pixel values; Save as artboard name and pixel value

$
0
0

Hello,

first off, I have never written a Javascript before and I am attempting to.  I have been reading like mad to wrap my head around the Extendscript Toolkit (ESTK) in CS6.  I see the awesome potential but I am concerned my idea may not be completely possible.  That's why I thought I would ask the experts here.

 

I have a client who needs cursors and icons for apps that are saved out in multiple, transparent PNG sizes and the output filename needs to reflect that name. So for example, I have 2 square artboards, one contains a red car, the other contains the same car but in green, and I want to save both of those as 96x96 pixels, 72 x72 pixels, 48x48, 36x36, and 24x24 (5 different sizes).  I would like the naming scheme to be taken from the artboard name (car_red, car_green) and the pixel value of each size, so the final name would be "car_red_0096x96.png", "car_red_0072x72.png", etc., etc.

 

The first thing I noticed is that there seems to be no SaveforWeb object in the ESTK.  I discovered ExportOptionsPNG24 which is nice, but it seems to only give a sizing property based on percent (horizontalScale, or verticalScale).  I would like to use the script to make any size artboard the exact pixel dimensions I need, and the percentage scaling property will not allow this, so is there a way to enter in pixel values and not percentage scale values?

 

This of course leads me to my next question: I was hoping to get the script to, at the press of a button, export the selected artboard to all 5 sizes, with a naming scheme that uses the artbaord name as a prefix and the pixel size as the suffix.  I was hoping to use the pixel value in the code to apply to the suffix

 

Is any of this possible?

 

Gratefully,

Dave


Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>