Quickly Create App Icons by Resizing Your Main Image With a Bash Script
Tags: bashscript, bash, xcode, appicon
Published: 2024-05-09 12:53:00

_I just wanted to start out by saying that this is an abridged version of my [original published version from June 4, 2023 that you can find on my website here](https://www.simplykyra.com/quickly-create-app-icons-by-resizing-your-main-image-with-a-bash-script/)._

---

When I first get excited about a new app idea I like to create a new project and I enjoy creating a new app icon so I'm excited seeing it on my phone and developing the idea. That said, I hate going through and resizing the image multiple times to generate all the differently sized images that Apple requires. This is made even worse if there's a minor design detail that needs to be corrected or even if I want to justify updating the icon as I have to go through the entire process all over again. 

Thus I needed to come up with a way to make, at least, the image resizing quicker and this script solves it! I've saved [my script in its entirety to a Github Gist which you can find here](https://gist.github.com/SimplyKyra/a1aaa5925a24892acc35383d2654adf2). 

This script works by taking in your image file, confirming it's a square, and then resizing it to seven unique dimensions each with its filename showing its particular size as it's appended to the beginning of its name. As each dimension is dictated by it's own line (so for example the 1024 by 1024 size is created with: `magick "$1" -resize 1024x1024 "1024 - $1"`) you can easily update the script to include new ones or remove obsolete ones. Currently the script outputs the resized image at the following seven dimensions: 1024x1024, 512x512, 256x256, 128x128, 64x64, 32x32, and 16x16.

When making my app icon I try to make an app icon at least as large as the largest size I'd need so in my case the minimum would be 1024 by 1024. Once the icon is made I call my script and pass in the app icon image's filename `createAppIcons.sh myImg.jpeg` and, once executed, all the newly resized images are in the directory with my original one. 

![Image shows three windows including the terminal, finder window, and preview with all the newly created images opened in it.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d268hr0s16fxy0jitljh.png)

With the images made I move the finder window over to Xcode and drag each individual image over to its corresponding spot in the assets app icon window.

![Image shows the finder window overlapping with Xcode so I can easily drag and drop each one.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6vpxfpin1zk5u8d233b1.png)

And with that the app icon is ready to go... and the script is ready to speed up the process the next time I need to switch it out.

Hope this helps you out and you're having a great day!

That said, if you want more details about this script or even have it broken down and explained better than the [Github Gist above](https://gist.github.com/SimplyKyra/a1aaa5925a24892acc35383d2654adf2) then you can check out [my original and longer version of this post from June 4, 2023](https://www.simplykyra.com/quickly-create-app-icons-by-resizing-your-main-image-with-a-bash-script/) where explain it all in more detail including it's background, requirements, and all the in depth information you'd need!