如何轻松创建特定图像的多种尺寸? [英] How can I create multiple sizes of a specific image easily?

查看:57
本文介绍了如何轻松创建特定图像的多种尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个图像,特别是矢量图像,所以它可以是我需要的任何尺寸.但是,我需要创建 8 个不同大小的不同图像文件.以下是尺寸:

I have an image, specifically a vector image so it can be any size I need it to be. However, I need to create 8 different image files of different sizes. Here are the sizes:

  • AppIconMask@3x~ipad.png 180x180
  • AppIconMask@3x~iphone.png 180x180
  • AppIconMask@2x~ipad.png 152x152
  • AppIconMask@2x~iphone.png 120x120
  • GameAppIconMask@2x.png 84x84
  • SpotlightAppIconMask@2x.png 80x80
  • TableIconMask@2x.png 58x58
  • NotificationAppIconMask@2x.png 40x40

有什么方法可以使用快速脚本(最好在 Mac 或通用版本上)将 .ai、.svg 甚至 .png 图像转换为具有这些文件名和大小的 8 个不同的 .png 图像?

Is there any way to use a quick script (preferably on Mac or universal) that would convert a .ai, .svg or even a .png image into 8 different .png images with these file names and sizes?

谢谢!

推荐答案

您可以在 ImageMagick 中执行以下操作:

You can do that in ImageMagick as follows:

(Unix 语法)

convert -density 300 image.svg +write mpr:img +delete \
\( mpr:img -resize 180x180 +write AppIconMask@3x~ipad.png \) \
\( mpr:img -resize 180x180 +write AppIconMask@3x~iphone.png \) \
\( mpr:img -resize 152x152 +write AppIconMask@2x~ipad.png \) \
\( mpr:img -resize 120x120 +write AppIconMask@2x~iphone.png \) \
\( mpr:img -resize 84x84 +write GameAppIconMask@2x.png \) \
\( mpr:img -resize 80x80 +write SpotlightAppIconMask@2x.png \) \
\( mpr:img -resize 58x58 +write TableIconMask@2x.png \) \
\( mpr:img -resize 40x40 +write NotificationAppIconMask@2x.png \) \
null:

(Windows 语法)

(Windows syntax)

convert -density 300 image.svg +write mpr:img +delete ^
( mpr:img -resize 180x180 +write AppIconMask@3x~ipad.png ) ^
( mpr:img -resize 180x180 +write AppIconMask@3x~iphone.png ) ^
( mpr:img -resize 152x152 +write AppIconMask@2x~ipad.png ) ^
( mpr:img -resize 120x120 +write AppIconMask@2x~iphone.png ) ^
( mpr:img -resize 84x84 +write GameAppIconMask@2x.png ) ^
( mpr:img -resize 80x80 +write SpotlightAppIconMask@2x.png ) ^
( mpr:img -resize 58x58 +write TableIconMask@2x.png ) ^
( mpr:img -resize 40x40 +write NotificationAppIconMask@2x.png ) ^
null:

我不确定您是否可以在文件名中使用 @ 或 ~.根据您的操作系统允许并根据需要编辑名称.

I am not sure you can use @ or ~ in your filenames. Edit the names as desired and permitted by your OS.

这篇关于如何轻松创建特定图像的多种尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆