(Solved) Transparent Image

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?".
Post Reply
jmituzas
Posts: 18
Joined: 2011-02-17T12:29:20-07:00
Authentication code: 8675308

(Solved) Transparent Image

Post by jmituzas »

I have been struggling with this for some time now.

convert -background white -size 165x70 label:'this is a test' label_size_fit.jpeg

composite -compose Copy label_size_fit.jpeg -background white -gravity East -geometry +200-100 -density 350 test.pdf output.pdf

This all looks great except that there is a dark grey background on my label_size_fit.jpeg only after it composes onto the pdf?


Have tried multiple files.. jpeg, .png, .svg (that one showed up completely black) for my label_size_fit.jpeg

How can I make this a transparent .png, and be sure it will stay transparent when composing with a pdf?
Last edited by jmituzas on 2011-02-22T13:43:21-07:00, edited 1 time in total.
jmituzas
Posts: 18
Joined: 2011-02-17T12:29:20-07:00
Authentication code: 8675308

(Solved) Transparent Image

Post by jmituzas »

Ok this worked :)

convert -transparent white -size 165x70 label:'this is a test' label_size_fit.png

composite label_size_fit.png -gravity East -geometry +200-100 -density 350 test.pdf output.pdf

Yay I'm getting somewhere.

This app is great!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: (Solved) Transparent Image

Post by anthony »

Using -transparent is not a good solution.

try setting -background none or -background transparent

Code: Select all

convert -background transparent -size 165x70 label:'this is a test' label_size_fit.png
In this case I did not have an example of this in the actual 'text to image' area of IM Examples (my bad)
http://www.imagemagick.org/Usage/text/
or in more complex text handling (compound fonts)
http://www.imagemagick.org/Usage/fonts/

Though I do use transparent backgrounds a lot in many other examples thought IM Examples.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply