我有一个高分辨率图像文件夹。它是JPG和24位透明PNG的混合。我想使用以下规则批量生成缩略图:
我是ImageMagick的新手,不知道要实现此结果需要运行哪些命令。最终,这是针对Jekyll项目的,但我很高兴能够通过命令行手动运行此过程。
任何帮助将非常感激!
ImageMagick命令行mogrify可能是您想要的并且可以执行您需要的操作。它处理充满图像的文件夹。参见https://imagemagick.org/Usage/basics/#mogrify和https://imagemagick.org/script/command-line-options.php#resize。该命令将类似于以下内容:
Create a new directory to hold your output, say, thumbnails.
Change directory to your folder with the images
mogrify -path path_to/thumbnails -resize 488x220 *
该命令将处理文件夹中的每个文件。如果您有其他格式,例如txt或其他您不想处理的图像,请修改命令以将其限制为仅png和jpg,如下所示:
mogrify -path path_to/thumbnails -resize 488x220 *.png *.jpg
add *.PNG *.JPG *.jpeg *.JPEG to the end of the line
,如果目录中的后缀有不同的大写和拼写。
其他编程语言有不同的API。参见https://imagemagick.org/script/sitemap.php#program-interfaces
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句