Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
resizing PNG images to use them for iOS development
AppStore supports images of size 40X40, 60X60,58X58, 87X87, 120X120, 180X180 ,1024X1024 and 80X80 (all in pixels).
It might be a tiresome job (for lazy ppl like me ) to resize a given image to above supported formats using Preview.
This is the reason god invented CLI. To avoid pixel-ation of images let's use an 1024X1024 image to be resized . Let's create
8 copies of this image.
Rename the original image to 1024.png
Using the following commands to create multiple copies
cp 1024.png 80.png
cp 1024.png 60.png
cp 1024.png 180.png
cp 1024.png 120.png
cp 1024.png 87.png
cp 1024.png 58.png
cp 1024.png 40.png
cp 1024.png 1024.png
Now resize the images using SIPS CLI
sips -Z 1024 40.png
sips -Z 1024 60.png
sips -Z 1024 58.png
sips -Z 1024 87.png
sips -Z 1024 80.png
sips -Z 1024 120.png
sips -Z 1024 180.png
sips -Z 1024 1024.png
Select all the images and open them .
Select all the images in Preview app and click on
File -> Export Selected Images -> Select a folder to export images -> Options -> Disable Alpha -> Choose (export your images)
Now upload the images to Image.xcassets and upload the corresponding images
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.