RE: http://forums.adobe.com/thread/422824?tstart=0

Upload Area - Upload Files Here, link to them from the appropriate Forum

Moderators: Tom, Kukurykus

Paul MR

RE: http://forums.adobe.com/thread/422824?tstart=0

Post by Paul MR »

RE: http://forums.adobe.com/thread/422824?tstart=0
Re: Complex Script For Automating Conversion of High Res Images to Web

This is for CS4 only.
larsen67

RE: http://forums.adobe.com/thread/422824?tstart=0

Post by larsen67 »

Paul, I found a fit image function in your script while digging about for some things I need. I have changed a bit to suit my needs question is can't I just do this or is this not right?

Code: Select all// Resize Image to fit newSize with newRes
function FitImage(newSize, newRes) {
      if (docWidth >= docHeight) {
         docRef.resizeImage(newSize, undefined, newRes, ResampleMethod.BICUBICSMOOTHER);
         }
      else {
         docRef.resizeImage(undefined, newSize, newRes, ResampleMethod.BICUBICSMOOTHER);
         } 
}
Paul MR

RE: http://forums.adobe.com/thread/422824?tstart=0

Post by Paul MR »

Hi mark, for fit image it might be best to test if it is sqare as well.....
Code: Select allvar startRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;

fitImage(800,300);
app.preferences.rulerUnits = startRulerUnits;

function fitImage(newImgSize,res) {
   var doc = app.activeDocument;
   if (res == undefined) res = undefined;
      if (doc.width > doc.height) {
         doc.resizeImage(newImgSize, undefined, res, ResampleMethod.BICUBICSMOOTHER);
         }
      if (doc.width < doc.height) {
         doc.resizeImage(undefined, newImgSize, res, ResampleMethod.BICUBICSMOOTHER);
         }
      if (doc.width == doc.height) {
         doc.resizeImage(newImgSize, newImgSize, res, ResampleMethod.BICUBICSMOOTHER);
         }
}
larsen67

RE: http://forums.adobe.com/thread/422824?tstart=0

Post by larsen67 »

Paul, thats what I was asking really doesn't the first "if" catch landscape & square else its portrait? that I only had a quick test but if you only declare one value in resize then you get proportional resize by default. So I think it could be used.