我经常被要求将图像(很多)调整为正方形,然后使用 PhotoShop 保存它们。例如,如果图像是 400x200,那么我需要将 Canvas 的大小调整为 400x400。同样,如果图像为 321x850,则 Canvas 将调整为 850x850,如果图像为 521x250,则 Canvas 将调整为 521x521。
PhotoShop 有没有办法自动完成这项繁琐的任务?我知道 PhotoShop 自动化,它会记录你的 Action ,但这不是我想要的。如果你能指出我正确的方向,我对解决方案的编程没有问题。这可能吗?
提前谢谢你。这可以为我节省数小时的繁琐重复工作。
最佳答案
使用javascript:您可以使用this answer选择所选文件夹中的所有文件并循环浏览它们。在循环中,您需要像这样打开每个文件:
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()
。
关于canvas - 在 PhotoShop 中调整批量图像的大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11538242/