Sunday, March 28, 2010

Different kind of Fit Image?

Is it possible to get the fit image (or even a combination of image size tools) to fit the smallest dimension to a specific size?



Reason being is I'd like my action to fit the smallest dimension and than simply crop off the opposite dimension to end up with a square as the final image.
Different kind of Fit Image?
I think it could be done with an Action, but which part (side) of the image would you want cropped and which to keep?
Different kind of Fit Image?
I'm thinking along the lines of:



Make

i Background

a Layer. Increase Canvas Size to 200% both dimensions. Select Transparency Channel (double-click on the Layer thumbnail). Transform Selection%26gt;Rotate 90 degrees. Align to Left and Top (say) and Crop. Then Select Transparency Channel again, Crop.



That would give you a square of the Top for Portrait images and the Left for Landscape images I think.

Yea maybe I'll just have to have two separate actions for portrait or landscape. I just wondered if there was a trick I didn't know about.



Thanks for the responses!

I think you only need one. See my instructions, above. The only issue is which portion of the image you want to keep.

Brian, You could copy this into a jsx-file, put it into Presets 聽Scripts and give it a try:






// crop to a square of the documents shorter sides length;



// use it at your own risk;



#target photoshop



if (app.documents.length %26gt; 0) {



var myDocument = app.activeDocument;



var originalRulerUnits = preferences.rulerUnits;



preferences.rulerUnits = Units.PIXELS;



var theShorter = getTheShorter(Number(myDocument.width), Number(myDocument.height));



var dlg = new Window (''dialog'', ''select new length for shorter side in pixels'', [300,300,600,380]);



dlg.theNewLengthField = dlg.add('edittext', [12,12,285,35], theShorter, {multiline:false});



dlg.theNewLengthField.active = true;



dlg.buildBtn = dlg.add('button', [12,45,140,55], 'OK', {name:'ok'});



dlg.cancelBtn = dlg.add('button', [160,45,285,45], 'Cancel', {name:'cancel'});



var myReturn = dlg.show ();



if (myReturn == true) {



var theNewLength = Number(dlg.theNewLengthField.text);



if (myDocument.width %26gt;= myDocument.height) {



myDocument.resizeImage (null, theNewLength, null, ResampleMethod.BICUBIC);



// the anchor-positions are easily changed to TOPLEFT, BOTTOMRIGHT etc.;



myDocument.resizeCanvas (theNewLength, theNewLength, AnchorPosition.MIDDLECENTER)



}



else {



myDocument.resizeImage (theNewLength, null, null, ResampleMethod.BICUBIC);



myDocument.resizeCanvas (theNewLength, theNewLength, AnchorPosition.MIDDLECENTER)



}



};



preferences.rulerUnits = originalRulerUnits;



}



else {



alert (''no document open'')



};



function getTheShorter(a,b) {



if (a %26lt;= b) {



var x = a}



else {



var x = b};



return x;



};






oh wow thank you for writing that up for me! I'll have to give it a try
  • wet eyeshadow
  • No comments:

    Post a Comment