Terminal Commands - automatically resize iPhone app icons with MacOS X bash command prompt | Apple iOS Xcode YouTube Seminar #25


GNU bash, version 3.2.57(1)-release


- resize iPhone app iCons with bash command line
- how to use exif, sips and loop command
- show the demonstration with command prompt


Resize iPhone app icons with linux bash command line with sips


* Here is the highlight of YouTube tutorial.

There are a lot of web services that provide the function to resize your iPhone app. But, Apple frequently change the set of iCons whenever they update Xcode. You may suddenly have to prepare another new iCon. The security of image file is also what we should think.

In this situation, let me show you how to create app icons automatically with bash command.

First, let's see what kind of security information is included in your image file. You need Homebrew for the following command.

brew install exiftool

After you install that, you can use the following commands.


exiftool 1024.png
exiftool -all= ./*.png



The upper one is for checking the information of image file and the lower one is for deleting them.

Before you learn the auto function, you need to know how loop command works. Let me show you beforehand.


for i in 20 29 40;
do echo $i;
done;



In this code, the number 20, 29 or 40 will be the names of image files and their sizes. The variable "i" can be used in this loop function.

By using the loop command, you can copy necessary image files.


mkdir iConiPhone;
for i in 20 29 40;
do cp 1024.png iConiPhone/$i.png;
done;



On the other hand, with sips command, you can resize multiple image files at once. The directory named iConiPhone will have the resized images.


for j in 20 29 40;
do sips -Z $j iConiPhone/$j.png;
done;



Please watch my video tutorial. That would be easier to understand them. See the movement of the codes.


To get the source code, check the comment of my YouTube

Back to Table List

2020年02月21日