在 PhotoShop 中调整批量图像的大小 [英] Resize batch images in PhotoShop

查看:24
本文介绍了在 PhotoShop 中调整批量图像的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常遇到将图像(很多)调整为正方形,然后使用 PhotoShop 保存它们的任务.例如,如果图像是 400x200,那么我需要将画布大小调整为 400x400.同样,如果图像为 321x850,则画布将调整为 850x850,如果图像为 521x250,则画布将调整为 521x521.

I am frequently presented with the task of resizing images (lots of them) to a square and then saving them with PhotoShop. For example, if an image is 400x200 then I would need to resize the canvas to be 400x400. Likewise, if an image is 321x850 then the canvas would be resized to 850x850 if, and if the image is 521x250 then the canvas would be resized to 521x521.

PhotoShop 有没有办法自动完成这个乏味的任务?我知道 PhotoShop 自动化,它记录你的动作,但这不是我想要的.如果你能指出我正确的方向,我对解决方案的编程没有问题.这可能吗?

Is there a way in PhotoShop to automate this tedious task? I know about PhotoShop automate, which records your actions, but that's not what I want. I have no problem programming the solution if you could point me in the right direction. Is this possible?

先谢谢你.这可以为我节省数小时的重复性工作.

Thank you in advance. This could save me hours and hours of tedious repetitive work.

推荐答案

Using javascript: You can use this answer选择所选文件夹中的所有文件并循环浏览它们.在循环中,您需要像这样打开每个文件:

Using javascript: You can use this answer to pick all the files in a chosen folder and loop through them. Within the loop you'll want to open each file like so:

var doc = open(fileList[i]);

然后检查长度与宽度:

if (doc.width !== doc.height) {             // if document is not already square...
    if (doc.width > doc.height) {               // if width is greater...
        doc.resizeCanvas(doc.width, doc.width)   // use this value for both sides...
    } else {                                      // else use height for both sides...
        doc.resizeCanvas(doc.height, doc.height)      // so you always get a square.
    }
}

保存并关闭:

doc.save();
doc.close();

根据您要查找的内容,还有 doc.resizeImage().

Depending on what you're looking for there is doc.resizeImage() as well.

Adobe 脚本指南

这篇关于在 PhotoShop 中调整批量图像的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆