Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
#!/usr/bin/perl -w use strict; use Image::Magick; my $image = Image::Magick->new; $image->Set(size=>'170x100'); my $rc = $image->Read("xc:black"); $image->Set(alpha => 'transparent'); $image->Set('transparent-color' => 'black'); $image->Draw(primitive=> 'circle',fill=>'red', points=>'50,50 13,50') +; $image->Draw(primitive=> 'circle',fill=>'red', points=>'120,50 157,50' +); $image->Draw(primitive=> 'rectangle',fill=>'red', points=>'50,13 120,8 +7'); $image->Draw(primitive=> 'circle',fill=>'black', points=>'50,50 25,50 +'); $image->Draw(primitive=> 'circle',fill=>'black', points=>'120,50 145,5 +0'); $image->Draw(primitive=> 'rectangle',fill=>'black', points=>'50,25 120 +,75'); $image->Draw(primitive=> 'circle',fill=>'red', points=>'60,50 40,50') +; $image->Draw(primitive=> 'circle',fill=>'red', points=>'110,50 130,50' +); $image->Draw(primitive=> 'rectangle',fill=>'red', points=>'60,30 110,7 +0'); $image->Set(matte=>1); $image->Set(gaussian=>'1x1'); #$image->Write("pant_mask.png"); # mogrify will get the inner black circle and set it transparent $image->Mogrify('transparent-color' => 'black'); #$image->Write("pant.png"); # make a clone to blur my $imb = $image->Clone(); $imb->Blur(radius=>0,sigma=>6); $imb->Shade(geometry=>'110x30',gray=>1); $imb->Normalize(channel=>'All'); $imb->Set(matte=>0); #$imb->Write("pantblur.png"); # do 2 composites to simulate the 3d effect $rc = $imb->Composite(gravity => "Center", compose=>'Overlay', image => $image, ); warn $rc if $rc; #$imb->Write("pant_z3d.png"); $rc = $imb->Composite(gravity => "Center", compose=>'DstIn' , image => $image); # add your text $imb->Annotate( pointsize=>36, text=>'Ant', stroke => 'black', fill => 'white', gravity => 'center', x=> 0, # offsets y=> 0, # offsets ); # need to reset the transparency $imb->Mogrify('transparent-color' => 'black'); $imb->Write("$0.png"); __END__

In reply to Transparent 3d logo/button with ImageMagick by zentara

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-04-25 02:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found