Possible to convert the alpha channel to unmatted?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Possible to convert the alpha channel to unmatted?

Post by fmw42 »

What about this one from your cloud link?

http://www.fmwconcepts.com/misc_tests/s ... _cloud.png
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Possible to convert the alpha channel to unmatted?

Post by fmw42 »

Sorry, correct command and image are:

Code: Select all

convert 00a9.svg -transparent white -units pixelspercentimeter -density 37.8 -depth 8 00a9_im8b.png
http://www.fmwconcepts.com/misc_tests/s ... 9_im8b.png
imlost123
Posts: 15
Joined: 2017-02-02T04:46:49-07:00
Authentication code: 1151

Re: Possible to convert the alpha channel to unmatted?

Post by imlost123 »

fmw42 wrote: 2017-02-27T14:03:21-07:00 Sorry, correct command and image are:

Code: Select all

convert 00a9.svg -transparent white -units pixelspercentimeter -density 37.8 -depth 8 00a9_im8b.png
http://www.fmwconcepts.com/misc_tests/s ... 9_im8b.png
Sorry no this one doesn't work.
fmw42 wrote: 2017-02-27T13:44:01-07:00 What about this one from your cloud link?

http://www.fmwconcepts.com/misc_tests/s ... _cloud.png
Yeah this one works fine.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Possible to convert the alpha channel to unmatted?

Post by fmw42 »

How about this one:

Code: Select all

convert 00a9.svg -transparent white -background black -alpha background -units pixelspercentimeter -density 37.8 -depth 8 PNG8:00a9_im8c.png
http://www.fmwconcepts.com/misc_tests/s ... 9_im8c.png

or this one

Code: Select all

convert -background transparent 00a9.svg -units pixelspercentimeter -density 37.8 -depth 8 00a9_im8d.png
http://www.fmwconcepts.com/misc_tests/s ... 9_im8d.png
imlost123
Posts: 15
Joined: 2017-02-02T04:46:49-07:00
Authentication code: 1151

Re: Possible to convert the alpha channel to unmatted?

Post by imlost123 »

fmw42 wrote: 2017-02-27T16:19:40-07:00 How about this one:

Code: Select all

convert 00a9.svg -transparent white -background black -alpha background -units pixelspercentimeter -density 37.8 -depth 8 PNG8:00a9_im8c.png
http://www.fmwconcepts.com/misc_tests/s ... 9_im8c.png

or this one

Code: Select all

convert -background transparent 00a9.svg -units pixelspercentimeter -density 37.8 -depth 8 00a9_im8d.png
http://www.fmwconcepts.com/misc_tests/s ... 9_im8d.png
Yes! that very last command works now, thanks so much! Amazing!

So if I want to batch convert a whole folder I'd just do
mogrify -background transparent -units pixelspercentimeter -density 37.8 -depth 8 -format *.png *.svg
?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Possible to convert the alpha channel to unmatted?

Post by fmw42 »

try

Code: Select all

mogrify -background transparent -units pixelspercentimeter -density 37.8 -depth 8 -format png *.svg
But I am not sure it will work, because it may try to do -background transparent after reading the svg and not before as per my convert command. If it does not work, then you may have to write a script loop over each image in a folder using convert as in my example above.

Also, I am not sure the density of 37.8 will be correct for all your svg files. But perhaps you do not care.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Possible to convert the alpha channel to unmatted?

Post by fmw42 »

You could try just

Code: Select all

mogrify -background transparent -units pixelspercentimeter -depth 8 -format png *.svg
If the previous mogrify works.
imlost123
Posts: 15
Joined: 2017-02-02T04:46:49-07:00
Authentication code: 1151

Re: Possible to convert the alpha channel to unmatted?

Post by imlost123 »

fmw42 wrote: 2017-02-27T17:05:52-07:00 try

Code: Select all

mogrify -background transparent -units pixelspercentimeter -density 37.8 -depth 8 -format png *.svg
But I am not sure it will work, because it may try to do -background transparent after reading the svg and not before as per my convert command. If it does not work, then you may have to write a script loop over each image in a folder using convert as in my example above.

Also, I am not sure the density of 37.8 will be correct for all your svg files. But perhaps you do not care.
No that seems perfect, it's converting away now and they seem fine so far.
Thanks again, I really love this software, makes me feel like I'm some sort of super hacker 8) :lol:
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Possible to convert the alpha channel to unmatted?

Post by fmw42 »

Glad that finally worked out.
Post Reply