use*_*010 3 image-processing automator padding batch-processing image-scaling
在 Mac OS 中使用 Automator 我正在尝试批量填充和缩放图像。我尝试将图像与填充一起批量缩放到特定大小。
我已经尝试使用 Created Automator Application>Library>Photos>Pad Images
然后给画布尺寸,然后在填充选项之前缩放图像
Automate Pad Image 操作使用黑色作为默认颜色填充画布。遗憾的是,无法修改此默认操作。
您可以做的是添加一个“运行 AppleScript”操作来调用 sips 命令行工具以使用您想要的颜色填充图像。
为此,请单击 Automator 侧栏中的实用程序操作并添加“运行 AppleScript”操作。
将默认 AppleScript 代码替换为以下代码:
on run {input, parameters}
repeat with this_file in input
set this_path to the quoted form of the POSIX path of this_file
do shell script "sips " & this_path & " -p 50 50 --padColor FFFFFF -i"
end repeat
return input
end run
Run Code Online (Sandbox Code Playgroud)
-p 参数指定填充的宽度和高度。--padColor 参数指定颜色。在这种情况下,颜色为白色。FFFFFF 等于 RGB 颜色的 255、255、255。
您可以在终端的命令行中键入“sip --help”以查看该命令可以执行的所有酷事。
| 归档时间: |
|
| 查看次数: |
2928 次 |
| 最近记录: |