Request help in generating circular image with transparency...

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
timindaburgh
Posts: 2
Joined: 2019-09-20T09:04:43-07:00
Authentication code: 1152

Request help in generating circular image with transparency...

Post by timindaburgh » 2019-09-20T09:37:55-07:00

I've made attempts to generate an image, but can't seem to make it happen. I want a word with white lettering in a dark colored circle. Outside the circle should be transparent and the text in the circle should not be transparent. Each time I try to make the image transparent, the word becomes transparent too. I want the word to remain opaque, otherwise it works against me when trying to place the image over another image or picture.

The nuance is that edges of the words in white would go beyond the edge of the circle. Therefore, a mask would be needed to chop off the edges of the words that extend beyond the perimeter of the circle.

The image I'm trying to generate would be the YSI logo shown in the header of the following site: pacamp.ysi.org

I have tried the following command to generate the logo (image):

Code: Select all

convert -size 400x400 xc:transparent \
          -draw "fill blue  circle 200,200 200,0 \
                 font Times-Bold  font-size 310 \
                 fill white \
                 translate 45,300 text 0,0 'ysi'" \
          -flatten ysi_logo.png
When I upload the ysi_logo.png file to the header, you can see the white area that surrounds the logo - and I want those areas to be transparent.

Thanks in advance.

snibgo
Posts: 12152
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Request help in generating circular image with transparency...

Post by snibgo » 2019-09-20T10:09:42-07:00

Why do you "-flatten" the image? I think you don't want that.
snibgo's IM pages: im.snibgo.com

User avatar
fmw42
Posts: 25556
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Request help in generating circular image with transparency...

Post by fmw42 » 2019-09-20T10:10:15-07:00

Either remove the -flatten or add -background transparent before -flatten

timindaburgh
Posts: 2
Joined: 2019-09-20T09:04:43-07:00
Authentication code: 1152

Re: Request help in generating circular image with transparency...

Post by timindaburgh » 2019-09-20T10:42:35-07:00

fmw42, I've added -background transparent just before -flatten. However, there is still a portion of the letters "y" and "i" that are not being cropped. Thus, I think some kind of mask will need to crop them off. The desired logo should look like the one at ysi.org.

Thanks for your quick responses fmw42 & snibgo.

Post Reply