I have around 200 images of varying sizes that I want to get to a 75 px sq thumbnail. I can make an action resize and save for web but the crop tool is difficult. Could I somehow get the crop tool to start at the top left of each image and restrain the sq by the left side of the image to be cropped?
Thanks
Thanks
Martin
If you make layer, and canvas size the doc with huge dimensions (maxx) then dup layer and rot 90, then intersect the layers' transparencies, then make guides upper left at (this time) 75/75, then copy merged of small dimension selection (intersected trans) then align left and top, then transform, then transform again on the original layer.
But shouldn't this be automated? Even web gal doesn't do it. (??)
Slow down.
I am not sure what half of that means and the other half is pure guesswork.
What I want to end up with is a small thumb that has to be same size as all the other thumbs - 75 x 75. It would be straight forward if all my original images were Sq but they are random sizes.
I can automate by using an action for resize and save for web which is neat. I could also do it for images of the same ratio. What I can't do is get the crop on different size/ratio images.
Thanks
Martin
Martin
If you want to auto-crop your images, ie process them without looking at them, you can size them to the short dimension and crop using canvas size. It's not like I process a lot of batch images, so I'm interested to know of a way to batch short-edge sizing, which I can't figure out.
The long way I proposed was to canvas size the image to something much larger than your largest possible image (lets say 2000 x 2000). Then, make your image a layer by double clicking on it. Then duplicate the layer and rotate the duplicate by 90 degrees. Now select the intersection of the original layer and the new rotated layer's transparency (load selection). You should now have a square selection that's the size of the short dimension. You can now create a new layer and fill with white (or any color) using the square selection. Now, draw two guides in the top left that are exactly (shift key pressed while zoomed way in, if recording your action you'll see the correct unit recorded) 75 pixels from the corner (top and left). Now select all and align to selection for both top and left (aligning the square layer to top left). Now, transform that layer (ctrl-t) and snap it to the guides (just drag up the bottom right corner to the guides, with snap on). If you now select the original image layer and "transform again", it will transform that layer to have a short dimension of 75. Now select that layer's transparency and crop. Throw away the other two layers. Of course you've now got transparent pixels at the edge of your image. So ctrl-j, ctrl-e four times to kill off the transparency (make the pixels solid again).
Whew. I'd love to understand the best way to:
1) transform images to the short dimension
2) not have the edge of an image (rectangle) drop in opacity when transforming
Or script it, as JJ points out. My guess is that script it what, three lines?
Now, transform that layer (ctrl-t) and snap it to the guides (just drag
up the bottom right corner to the guides, with snap on).
OK, so the above isn't even actionable because the scaling is always based on percentage, even if you type px in the scale window. I'll slink away now...
doc = app.activeDocument;
var saveFile = new File(decodeURI(activeDocument.fullName.fsName).slice(0,-4) +"-thumb.jpg");
var startRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
fitImageShortSide(75);
app.activeDocument.resizeCanvas(75, 75, AnchorPosition.TOPLEFT);
SaveForWeb(saveFile,60);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
app.preferences.rulerUnits = startRulerUnits;
function fitImageShortSide(newImgSize) {
if (doc.width > doc.height) {
doc.resizeImage(undefined, newImgSize, undefined, ResampleMethod.BICUBICSHARPER);
}
if (doc.width < doc.height) {
doc.resizeImage(newImgSize, undefined, undefined, ResampleMethod.BICUBICSHARPER);
}
if (doc.width == doc.height) {
doc.resizeImage(newImgSize, newImgSize, undefined, ResampleMethod.BICUBICSHARPER);
}
}
function SaveForWeb(saveFile,jpegQuality) {
var sfwOptions = new ExportOptionsSaveForWeb();
sfwOptions.format = SaveDocumentType.JPEG;
sfwOptions.includeProfile = false;
sfwOptions.interlaced = 0;
sfwOptions.optimized = true;
sfwOptions.quality = jpegQuality;
app.activeDocument.exportDocument(saveFile, ExportType.SAVEFORWEB, sfwOptions);
}
I guess it's a script but that sort of thing is way beyond me. I'll look at the help files and see if I can sort it out but if anyone can offer a few pointers - what's the minimum I nee to know - it would be great.
I offer this as an explanation for the delay in coming back to say thanks rather than a request to save me the bother of learning new stuff!
Kind regards
Martin
Once you have saved the script, open one of you documents and record a new action that does:-
File - Scripts - (select the new script) stop recording.
This will have resized your document,saved it and closed the original.
This new action can now be used in batch.
Hope it all makes sense Martin.
Paul.