iconutil error: "Unsupported image format" - macos

I've been trying to use iconutil to generate .icns icons from the .png images inside the folder "folderthumb.iconset", with the following command:
iconutil -c icns folderthumb.iconset
Everything goes well when the source png have alpha transparency. However, when the PNGs are opaque (from sips, hasAlpha=no) iconutil returns the error:
Unsuported image format
My libpng is v1.6, installed with brew.
Has anyone tips on how to sort this problem out?

Older versions of iconutil did not require the png files to have an alpha channel, the version of iconutil distributed with OS X 10.11 (or did it come with a recent Xcode? I'm not sure...) does.
If you have icons with transparent parts, this should be no problem because I'd expect all graphics tools to include the alpha channel when exporting to png. However if you have a fully opaque icon, most tools and applications remove the alpha channel when exporting to png.
Here is how I resolved this: I installed ImageMagick (e.g. via Mac OS Ports), then used ImageMagick's command line tool convert to add the alpha channel and set the color space to sRGB (which is recommended by iconutil):
convert input.png -alpha Set -colorspace sRGB -define png:format=png32 output.png
If you do this for all icons in your iconset folder, iconutil should then no longer return an error.

Related

Issue with Basic Image Magick Convert and Mogrify Functions

I am attempting to convert all .jpg images in a folder to .png format using Image Magick. This functionality is described as a feature of Image Magick here using the mogrify tool. Here's what I type into the command line, followed by the error:
C:\Users\holde\Desktop\Photos and Videos>magick mogrify -format jpg *.png
mogrify: unable to open image '*.png': Invalid argument # error/blob.c/OpenBlob/3527.
Any help is appreciated! If it's useful, I installed the Windows Binary release from this page, and installed via the ImageMagick-6.9.12-32-Q16-HDRI-x64-dll.exe executable on Windows 10.
Edit: Fixed, I had the syntax backwards. I should have used mogrify -format png *.jpg rather than mogrify -format jpg *.png
With this change, the operation now completes. Thanks for the assistance!
Convert all from png to jpg
mogrify -format jpg *.png

Remove grey background and turn it transparent

ImageMagick does not replace '#c0c0c0' with a transparent background
I have tried magick convert img.png -fuzz 50% -transparent '#c0c0c0' 0.png and a convert option without "magick"
running version windows 10 x64 v7.0.8-14Q16 .
A problem for later: using a bash script to convert 200 of these and it seems imagemagick also doesn't overwrite if output name is the same
here is the image: https://i.imgur.com/JnNBtpX.png
No change...
Strangely it is just a problem with windows? Tried it on linux and it works fine.

How to resize an .eps file using ghostscript

How do you resize .eps file using ghostscript or some other command line utility available for macOS or ruby? I would like to specify the resolution such as 1000x1000 and not the scale.
Similar to this post but resizing with a specified resolution How to resize an EPS file with free software or command line utility
Thanks #KenS for the help. For reference this is the command I ended up using.
gs -o input.eps -dEPSFitPage -sDEVICE=eps2write -c "<</Install {10 10 scale}>> setpagedevice" -f output.eps

ImageMagick 'convert -sepia-tone' different on Windows vs. Linux

I have an issue with the 2 images below: the first one is created on Linux, the second one on Windows using the same command, same versions of ImageMagick (6.6.5-0). Tried newer versions of ImageMagick and they all seem to provide different results Windows vs. Linux.
convert c.jpg -sepia-tone 80% 1.jpg (on Linux)
convert c.jpg -sepia-tone 80% 2.jpg (on Windows)
The results are very different and I cannot figure out why.
What am I doing wrong?
(source: selfip.com)
(source: selfip.com)
I actually had to do
convert c.jpg -set colorspace RGB -sepia-tone 80% 1.jpg
basically forcing the use of the RGB colorspace and that solved my problem.
Most likely, the release versions of your ImageMagick installations on Linux and Windows are different in more ways than the mere version numbers...
To verify, run this command and compare the outputs in detail for the two platforms:
convert -version
Additionally, you may want to see how the outputs for convert -list configure differ. (Note, the format of the outputs this command gives is different anyway on the two platforms -- they are not directly comparable).

convert image to .icns file AppleScript Obj-C

how can I convert a .png image to a .icns using applescript? Any help would be greatly appreciated.
Could you just use sips?
sips -s format icns test.png -o test.icns
It doesn't seem to support 1024 x 1024 images or create smaller versions though.

Resources