🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.photoshop.scripting
1 messages
1 total messages Started by TK Fri, 26 Mar 2010 13:06
Conditional Resize Not Working
#91
Author: TK
Date: Fri, 26 Mar 2010 13:06
28 lines
2101 bytes
I am trying to conditionally resize images based on their pixel range,
but when I run my script regardless of size my images are sizing down
to 900 pixels.

I think my conditional is incorrectly written, can someone help me
out?


#target photoshop
app.bringToFront();

function fitImage(newImgSize) {
var doc=activeDocument;
if (doc.width > doc.height) {doc.resizeImage(newImgSize, null, null,
ResampleMethod.BICUBICSHARPER);}
if (doc.width < doc.height) {doc.resizeImage(null, newImgSize,
null,ResampleMethod.BICUBICSHARPER);}
if (doc.width == doc.height) {doc.resizeImage(newImgSize, newImgSize,
null, ResampleMethod.BICUBICSHARPER);}
}

var doc = app.activeDocument;
var startRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;

if (parseInt(doc.height, 10) > '1200px') {fitImage (1800,300);}
else if (parseInt(doc.width, 10) > '1200px') {fitImage (1800,300);}
else {fitImage (900,300);}
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads