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.
Related
I am trying to create a workflow in automator to change DPI from 72 to 300, so that I can use it on any image in Finder (when i right click on the image, then I can run the action).
When I run the command in terminal, it works fine:
mogrify -units PixelsPerInch *.jpg -density 300 *.jpg
However, when I use it in shell script, it does not work, and I can't figure out why. This is what I have so far:
for f in "$#"
do
/opt/ImageMagick/bin/mogrify mogrify -units PixelsPerInch *.jpg -density 300 *.jpg
done
Screenshot from Automator
Any help will be highly appreciated.
mogrify is for batch conversion (thus your *.jpgin the working version) but in your example, you have created a loop to step through files. You don't seem to be using your f variable at all.
You should get the command to work on individual files using the convert command instead of mogrify and then plug in$fwherever the filename would occur.
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.
My goal is to split a PNG image file in two equals parts. (vertical split)
I found this command on some website:
convert -crop 50%x100% +repage 1.png out_%d.png
The problem is that the %d doesn't seems to work. The output is only one file named "out_%d.png" instead of "out_0.png" and "out_1.png".
I am running this command from a terminal in Ubuntu 14.04.
Any idea why the %d is not working ?
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).
I'm trying to convert multiple .tif files into .png files using Imagemagick on the Windows command line. I tried the following, which didn't work:
convert -format tif *.png
I then tried a loop
for %a in (*.tif) do convert %a %a.png
which did work but now all my images are named as [something].tif.png, which is annoying.
So why didn't the first command work, and if there's no way to get the first command to work, is there a way to improve the second command so I won't have to deal with the .tif in the .png image name?
Edit It seems that I got the first command wrong. First of all, convert doesn't work but mogrify does. I had read that mogrify replaced the files of the old format, but apparently it isn't true because it created new images for me without deleting the old ones. Secondly, it seems that the destination file type comes first, so the command is
mogrify png *.tif
which works perfectly.
I'd still like to know how the second command could be improved.
Why don't you use mogrify?
mogrify -format tif *.png
will create 1.tif from 1.png ... N.tif from N.png.