Reputation: 105
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:
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?
Thank you!
Upvotes: 1
Views: 595
Reputation: 53192
You can do that in ImageMagick as follows:
(Unix 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:
(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.
Upvotes: 3
Reputation: 168
You can create a Photoshop action if you are familiar with Photoshop. There might even be an action for it available for download.
A second option is to place 1 high-res version on the server, and have a script like GD or ImageMagick convert to your size. Some php might also be required.
Each of the above can achieve the results needed. It depends on if you want the work done on the server or on your personal pc/laptop.
Upvotes: 0