1

https://digital-photography-school.com/how-to-batch-resize-in-photoshop/

This doesn't seem to work, so I think a script way might be what I need.

https://www.adobe.com/devnet/photoshop/scripting.html

The resize method in its javascript reference guide doesn't seem to cover this (p.64).

(parts of the image can be hidden)

2
  • Could you add some examples of what you're trying to achieve and how the resize method in the javascript reference guide doesn't cover this? – Sergey Kritskiy Apr 8 at 13:08
  • It sounds like something which can be done without a script simply using an action. What is the difference between "covering the whole canvas" and "fit shortest length"? – Wolff Apr 8 at 16:18
1

Not entirely sure this is what you want....

If you want something to fill the canvas and maintain proportions, this script isn't for you.


I do this all the time. I struggled, like you, to find something that would not maintain proportions and merely fill the canvas, stretching or squishing as necessary.

I tried searching for where I may have originally found this script.. but honestly I have no clue. I may have even edited or corrected something else I found. It's been years since I first started using this script.

var doc = app.activeDocument;
var layer = doc.activeLayer;
layer.translate(new UnitValue(0-layer.bounds[0].as('px'),'px'), new UnitValue(0-layer.bounds[1].as('px'),'px'));
layer.resize((doc.width.value/(layer.bounds[2]-layer.bounds[0]))*100,(doc.height.value/(layer.bounds[3]-layer.bounds[1]))*100,AnchorPosition.TOPLEFT);

Will move a layer to top left corner of canvas, then resize to fill the canvas, not maintaining any proportion.

Note that nothing will be "hidden" using this script. When the script is called, all pixels on the highlighted layer in the Layer Panel will be forced to the canvas boundaries, regardless of what that does to the original proportions.

(If the original author presents themselves I'm happy to credit them.)

3
  • how to make it maintain proportion and resize the longer length to fit the canvas so that some parts can be hidden(fill the canvas)? – Ryan Case Apr 9 at 3:04
  • ermm ... you linked to viable answers to that question in the original question post.... but you need to start thinking of resizing the short edge , not the long edge if you want the canvas filled with cropping. Using the long edge will always leave empty spaces. – Scott Apr 9 at 8:01
  • oh yeah. what do you mean viable answers? – Ryan Case Apr 10 at 7:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.