Find All Images With Given Attributes

I’m an iOS developer and with the release of Xcode 8 came a little issue. Apple introduced wide-color support on iOS 9. This meant that if you had 16 bit images then you couldn’t target older iOS versions, otherwise you would see something like this:

ERROR ITMS-90682: Invalid Bundle - The asset catalog at ‘Payload/XXXXX/’ can’t contain 16-bit or P3 assets if the app supports iOS 8 or earlier.

So this prompted the need for me to easily find 16-bit images. Apple did help with that but it was really Xcode-project specific and I wanted to have something more generic.

Note For iOS Devs (Others can skip) #

For those of you who are finding this page because you’ve had this error, do also check this page: and note the following:

If your Deployment Target is set to either 8.3 or 8.4 and you have an asset catalog then you will receive this same error message, even if you do not actually have 16-bit or P3 assets. In this case you will either need to lower your Deployment Target to 8.2, or move it up to 9.x.

Finding Images #

I came across ImageMagick. You can install it using MacPorts of Homebrew:

brew install imagemagick

It took me a few minutes and I composed this command:

find ./ -iname "*.png" -type f -exec identify -format '%depth %i' '{}' \; | awk '$1=16{print $1 "-bit:", $2 "\n"}'

This essentially prints all the png images in all subfolders that are 16 bit! let’s break it down a little:

Other Searches #

You can use this tool to search for images by size or other properties. Here’s an example of a command that searches for images that are 1024 by 1024 pixels.

find ./ -iname "*.png" -type f -exec identify -format '%w %h %i' '{}' \; | awk '$1=1024 && $2=1024 {print $1, "x", $2, ":", $3, "\n"}'

Sources & Useful Links #


Now read this

A Day At Square

I work at Square as a Senior iOS Engineer and here’s what a typical day looks like for me. Sunrise – 6AM-7:30AM # I usually get up at 6am, brush my teeth, feed my pets and jump in my car to get to work around 7:30am. I don’t usually eat... Continue →