I need to shrink PNG files like the ones generated as the default macOS screenshot. SIPS was my first stop since it's faster than any other solution but I haven't quite been able to find the right command.

This is my starting point to reformat to PNG:

/usr/bin/sips -s format png  "$f" --out "${f%.*}.png"

Which options are needed?

--setProperty bitsPerSample 

Bits/sample looks promising but I'm not sure what to enter here.
Does 32 mean 32 colors in this context, for example?

Can I use SIPS to quickly reduce the number of colors to shrink file size?

  • 1
    bitsPerSample is referring to the color depth of the image. – tubedogg Oct 25 '16 at 20:46
  • So, if I reduced the color depth, the PNG should shrink, right? Based on the link you sent, I should set this to --setProperty bitsPerSample 4 for 16 colors per bit or --setProperty bitsPerSample 8 for 256, shouldn't I? – SeanJ Dec 4 '16 at 15:26

As far as I know, bitsPerSample is a read-only property and you cannot modify it through sips. You can use ImageMagick instead. Consult https://stackoverflow.com/questions/11613105/uncommon-png-file-ios-display for more info. Hope this helps. Recently encounter a similar thing.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .