Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

need help with a basic script to resize image then resize the canvas

$
0
0

I am new to photoshop scripting, and have come across a need to force an image to be 8"x10" at 300dpi (whether it is vertical or horizontal)

 

I need to maintain the correct orientation in the file, so an Action will not work, I believe I have to implement a script to accomplish this.

 

I have the below script so far, but I am not certain of how to input the variables / paramters

 

doc = app.activeDocument;
if (doc.height > doc.width) doc.resizeImage("2400 pixels","3600 pixels", "300", "BICUBIC");
if (doc.height > doc.width) doc.resizeCanvas("2400 pixels","3000 pixels", "MIDDLECENTER");

if (doc.height < doc.width) doc.resizeImage("3600 pixels","2400 pixels",300,"BICUBIC");
if (doc.height < doc.width) doc.resizeCanvas(3000,2400,"MIDDLECENTER");

 

When I run this script, I get the following error:

 

Error 1245: Illegal argument - argument 4

- Enumerated value expected

Line: 5

if (doc.height < doc.width) doc.resizeImage("3600 pixels","2400 pixels",300,"BICUBIC");

 

error.jpg

 

The fact that its failing on lien 5 lets nme know that I have the "If" portions of my script correct, I just dont know how to accomplish the functions correctly.

Any help would be appreciated!

 

 

Thanks,

Brian


Viewing all articles
Browse latest Browse all 12244

Trending Articles



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