Use ImageMagick to split images for App Store screenshots
Split Images for App Store Screenshots Using ImageMagick
I recently working and update for AlkitabKit and when creating App Store screenshots, I usually design them in Canva.
To keep the layout consistent, I first create a long rectangular image that includes all the screenshots in one canvas. This also to facilitate if I want to make design that has device mockup span across two images.
For example, if I want to create 4 screenshots, I would start with a 2640 x 1434 canvas in Canva. However, due to Canva’s width limitations, I export the image at double the size (5280 x 2868).
Previously, I used an online tool to split the image into separate screenshots, but then I thought:
"Can this be done offline with some command line tools?"
And yes, turns out there's a command line tools that you can use to manipulate or edit images. It's called ImageMagick. It can convert, edit, resize, crop, split, and apply effects to images—all without needing a GUI. It’s lightweight and fast.
Step 1: Install ImageMagick
If you haven’t installed ImageMagick, you can do so using Homebrew:
brew install imagemagick
Step 2: Use This Script to Split the Image
Here’s a simple Bash script to split an image into 4 equal parts based on width:
#!/bin/zsh
# Check if an image path is provided
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <image_path>"
exit 1
fi
input_image="$1"
# Get image dimensions
width=$(identify -format "%w" "$input_image")
height=$(identify -format "%h" "$input_image")
# Number of slices (4 in this case)
num_parts=4
slice_width=$((width / num_parts))
# Extract filename and extension
filename=$(basename -- "$input_image")
extension="${filename##*.}"
filename="${filename%.*}"
# Split the image
convert "$input_image" -crop "${slice_width}x${height}" +repage +adjoin "${filename}_part_%02d.${extension}"
echo "✅ Splitting completed! Files saved as ${filename}_part_XX.${extension}"
Step 3: Run the Script
Save the script as split_screenshots.sh, then make it executable:
chmod +x split_screenshots.sh
Once done, you can run it with your exported image:
./split_screenshots.sh app_screenshot.png
Step 4: Profit!
Now, instead of manually splitting images using a website, you can instantly split them using a single command and it's all completely offline.