我有一个高分辨率图像的文件夹。它是JPG和24位透明PNG的混合体。我想用以下规则批量生成缩略图:
我是ImageMagick新手,不知道为了达到这个结果,我需要运行哪些命令。最终,这是一个Jekyll项目,但我很高兴能够通过命令行手动运行这个过程。
任何帮助都将不胜感激!
发布于 2019-05-25 17:59:02
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
https://stackoverflow.com/questions/56305138
复制相似问题