How to compress images in bulk on iOS/iPadOS
Earlier this year I have shared a tweet about compressing images on iOS and iPadOS using a shell app. The tweet has received a fair amount of interest so far and to further help people looking for the matter, I have decided to write a short blog post about it.
how to compress images on iOS/iPadOS:
— @pirafrank@mastodon.social (@pirafrank) January 25, 2021
1. download @iSH_app
2. apk add ImageMagick
3. mkdir -p /mnt/icloud_drive
4. mount -t ios . /mnt/icloud_drive
5. cd /mnt/icloud_drive
6. convert -format "jpg" -quality "75" old.jpg new.jpg@a_Shell_iOS has ‘convert’ built-in btw
It’s worth pointing out that there are a couple of other ways to do that. Images can be compressed using the pre-installed Shortcuts app, as pointed out in the tweet thread, or by using an online service. By the way, a shell approach may be helpful to reuse a script you already have, do some batch processing and protect your privacy (you don’t need to upload pictures anywhere).
Prerequisites:
and install the ImageMagick package:
apk add imagemagick
mount and convert!
Time to convert. But before I show you how to mount an external path, thanks to the awesome iSH app. It is a good option to read/write images straight where you need them. For example, you could use it with apps such as Secure ShellFish or FileBrowser Pro. In the example below, I use iCloud Drive which we all have:
mkdir -p /mnt/icloud_drive
mount -t ios . /mnt/icloud_drive
cd /mnt/icloud_drive
Since ImageMagick is now installed, we can use the same commands and options we are used to:
convert -format "jpg" -quality "75" old.jpg new.jpg
That’s it!
Thanks for reading. Hope it helps!