我正在寻找一个 photoshop Action (也许这是不可能的,任何其他应用程序推荐也会有所帮助)。我想拍摄一组照片并使它们具有特定的纵横比,例如:4:3。
所以我有一个 150 像素宽 x 200 像素高的图像。我想要的是图像的 Canvas 宽度为 267 像素,新区域填充了某种颜色。
所以我能想到的有两种可能:
1) Photoshop Action 可以做到这一点,但我必须拉出当前高度,乘以 1.333333,然后将该值放入 Canvas 调整大小的宽度框中。是否可以在 Photoshop Action 中计算值?
2) 一些其他应用程序内置了此功能。
非常感谢任何帮助。
最佳答案
哇,我现在(写完答案后)看到很久以前有人问过这个问题。 . .那好吧。这个脚本可以解决问题。
此 Photoshop 脚本将调整任何图像 Canvas 的大小,使其具有 4:5 的纵横比。您可以通过更改 arWidth 和 arHeight 来更改应用的纵横比。填充颜色将设置为当前背景颜色。您可以创建一个操作来打开文件,应用此脚本,然后关闭文件以执行批处理。
关闭 Photoshop。
将此 javascript 复制到 Photoshop 的 Presets\Scripts 文件夹中名为“Resize Canvas.jsx”的新文件中。
启动 Photoshop,它应该出现在"file"-“脚本”菜单中。
#target photoshop
main ();
function main ()
{
if (app.documents.length < 1)
{
alert ("No document open to resize.");
return;
}
// These can be changed to create images with different aspect ratios.
var arHeight = 4;
var arWidth = 5;
// Apply the resize to Photoshop's active (selected) document.
var doc = app.activeDocument;
// Get the image size in pixels.
var pixelWidth = new UnitValue (doc.width, doc.width.type);
var pixelHeight = new UnitValue (doc.height, doc.height.type);
pixelWidth.convert ('px');
pixelHeight.convert ('px');
// Determine the target aspect ratio and the current aspect ratio of the image.
var targetAr = arWidth / arHeight;
var sourceAr = pixelWidth / pixelHeight;
// Start by setting the current dimensions.
var resizedWidth = pixelWidth;
var resizedHeight = pixelHeight;
// The source image aspect ratio determines which dimension, if any, needs to be changed.
if (sourceAr < targetAr)
resizedWidth = (arWidth * pixelHeight) / arHeight;
else
resizedHeight = (arHeight * pixelWidth) / arWidth;
// Apply the change to the image.
doc.resizeCanvas (resizedWidth, resizedHeight, AnchorPosition.MIDDLECENTER);
}
关于image - Photoshop Action 对图像进行一定比例的填充,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4307691/