I had used sips to resize PNG image as below command.
sips -z 768 1024 image.png --out image-resize.png
It works well. But today I got an error message as shown in below
<CGColor 0x7ffb72e05c40> [<CGColorSpace 0x7ffb72e04e70> (kCGColorSpaceDeviceRGB)] ( 0 0 0 1 )
Error: Unable to render destination image
If anyone could help it would be very much appreciated.
Changing color profile value from RGB 16bit to 8bit sRGB fixing this problem.
This can be done by one command in Terminal:
find . -type f -name '*.png' -print0 | while IFS= read -r -d '' file; do sips --matchTo '/System/Library/ColorSync/Profiles/sRGB Profile.icc' "$file" --out "$file"; done
Then images can be resized by sips. For batch resize I use this command:
mdfind -0 -onlyin . "kMDItemPixelHeight > 600 || kMDItemPixelWidth > 600" | xargs -0 sips -Z 600
And at finish, this command for reduce size of image files:
find . -name '*.png' -exec pngquant --skip-if-larger --ext .png --force {} \; -exec xattr -c {} \;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With