-
1. Re: LongSideResize.jsx not working correctly
R_Kelly Mar 25, 2012 12:45 PM (in response to Wight-Walker)Do you have a link to the script?
-
2. Re: LongSideResize.jsx not working correctly
Wight-Walker Mar 26, 2012 2:22 AM (in response to R_Kelly)You'll find the download @ http://www.adobe.com/cfusion/exchange/index.cfm?event=dl&extid=1044732
Here's the code:
if (!app.documents.length > 0) {
alert("No active document");
}
else {
//Change this value to how long you would like the longest side to be
var longSide = 500;
var docRef = app.activeDocument;
var docWidth = docRef.width.as("px");
var docHeight = docRef.height.as("px");
//if image is horizontal, resize with width being biggest parameter
if (docWidth > docHeight)
{
var multiplier = longSide/docWidth;
docRef.resizeImage(longSide, docHeight*multiplier, 72, ResampleMethod.BICUBIC );
}
else
{
var multiplier = longSide/docHeight;
docRef.resizeImage(docWidth*multiplier, longSide, 72, ResampleMethod.BICUBIC );
}
}
I slightly modified the code to allow images greater that 1900px to be left at their default size:
//Change this value to how long you would like the longest side to be
var longSide = 900;
var docRef = app.activeDocument;
var docWidth = docRef.width.as("px");
var docHeight = docRef.height.as("px");
if (docWidth > 1900) {}
else {
//if image is horizontal, resize with width being biggest parameter
if (docWidth > docHeight)
{
var multiplier = longSide/docWidth;
docRef.resizeImage(longSide, docHeight*multiplier, 72, ResampleMethod.BICUBICSHARPER );
}
else
{
var multiplier = longSide/docHeight;
docRef.resizeImage(docWidth*multiplier, longSide, 72, ResampleMethod.BICUBICSHARPER );
}
}Both scripts resize UP in CS6 beta whereas in CS5 they resize DOWN correctly to 900x900.
-
3. Re: LongSideResize.jsx not working correctly
R_Kelly Mar 26, 2012 3:09 AM (in response to Wight-Walker)In cs6 try setting your ruler units to pixels and see if the scripts work.
If they do then add these lines to the top of the script:
var originalUnit = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
And add this line to the bottom of the script:
app.preferences.rulerUnits = originalUnit;
Also you can use the File>Scripts> Image Processor or Automate>Fit Image to do the same thing.
-
4. Re: LongSideResize.jsx not working correctly
Wight-Walker Mar 26, 2012 4:27 AM (in response to R_Kelly)Thanks, that works perfectly.
I don't think that using the Image Processor would help.
As part of editing imges for web publishing, I initially create post processed images that fit the resolution of my monitor, this mixture of images i.e. portrait (1080x1631), landscape (1631x1080) & panoramic (1920xwhatever) are then further reduced to portrait (596x900), landscape (900x596) & panoramic (1920xwhatever) at reduced file size.
This simple script file allows me to include it in a batch process that handles the mixture of sizes.
-
5. Re: LongSideResize.jsx not working correctly
R_Kelly Mar 26, 2012 3:36 PM (in response to Wight-Walker) -
6. Re: LongSideResize.jsx not working correctly
Wight-Walker Mar 27, 2012 5:35 AM (in response to R_Kelly)Have used this & it works fine on images that are 'x' by 'y' and/or 'y' by 'x' but the script files also allows me process a 3rd size differently in just the one process.




