Page 1 of 1

red background instead of a transparent background for butto

Posted: 2007-08-16T14:35:19-07:00
by hknight
Hello,

The following creates a 3D button. The button HAS to be a jpg (not a png).

The problem is that because the corners are transparent, when the jpg is made they turn black.

The background needs to be red. How can I make the button have a red background instead of a transparent background?

Thanks!

Code: Select all

## Thanks, Anthony!
convert -background transparent -fill transparent \
           -pointsize 12 label:'Hello Cruel World' -border 7 +repage \
           -format '%wx%w'  -write info:size1.txt \
           -format '%wx%h'  -write info:size.txt \
           info:grad.mvg

convert -background transparent -fill transparent \
           -pointsize 12 label:'Hello Cruel World' \
           -format 'viewbox 0 0 %[fx:w+7] %[fx:h+7]  \
            fill white roundRectangle 1,1 %[fx:w+5] %[fx:h+5] 5,5' \
            info:rounded_corner.mvg

convert -background black +antialias rounded_corner.mvg mask.png

convert -size `cat size1.txt` gradient:'#C27A08'-'#FE9800' -rotate -35 \
           -gravity center -crop `cat size.txt`+0+0 +repage \
           mask.png +matte  -compose CopyOpacity -composite \
          -pointsize 11 -fill black +antialias \
          -gravity Center -annotate 0 "Hello Cruel World" \
          button.png

convert button.png  -fx A  +matte -blur 0x3  -shade 110x30  -normalize \
          button.png  -compose Overlay -composite \
          button.png  -matte  -compose Dst_In  -composite -trim +repage \
          3dButton.jpg

Re: red background instead of a transparent background for butto

Posted: 2007-08-18T18:19:09-07:00
by anthony

Code: Select all

   ....   -background red -flatten  image.jpg
See IM Examples
http://www.imagemagick.org/Usage/mosaics/#flatten

Which is referenced from Common Image Formats,
JPEG transparency - NOT
http://www.imagemagick.org/Usage/formats/#jpg_trans

That should have been your first point of call!