Problems with transparency/antialias/png.. need urgent help

Need help with Photoshop, the GIMP, Illustrator, or others? Want to show off your work? Looking for advice on your newest Flash stuff?

Moderator: General Moderators

Problems with transparency/antialias/png.. need urgent help

Postby Zacay » Tue Aug 16, 2005 1:30 pm

Hello,

I am tryign to create a transparent image and draw a white line that has to me smooth.
This should be a problem right?
Well I got serious problems with it.
Let me show you:

This url has my example images and the code below (I couldn't use the [img] tag to show the php generated images.
http://www.zacay.se/image/

Method 1:
Syntax: [ Download ] [ Hide ]
<?

header("content-type: image/png");



// Create empty image

$image = imagecreatetruecolor(500, 500);



// The image background transparent

imagealphablending($image, false);

imagesavealpha($image, true);

$bgcolor = imagecolorallocatealpha($image, 255, 255, 255, 127);

imagefill($image, 0, 0, $bgcolor);



// Drawing the lines

imageantialias($image, true);

$white = imagecolorallocate($image, 255, 255, 255);

imageline($image, 0, 0, 250, 500, $white);

imageline($image, 0, 100, 500, 500, $white);

imageline($image, 0, 300, 500, 400, $white);

imageline($image, 0, 400, 500, 450, $white);



// Output the image

imagepng($image);

?>


Method 2:
Syntax: [ Download ] [ Hide ]
<?

header("content-type: image/png");



// Create empty image

$image = imagecreatetruecolor(500, 500);



// The image background transparent

imagealphablending($image, true);

imagecolortransparent($image, 0); // 0 = black, the default color then create an image



// Drawing the lines

imageantialias($image, true);

$white = imagecolorallocate($image, 255, 255, 255);

imageline($image, 0, 0, 250, 500, $white);

imageline($image, 0, 100, 500, 500, $white);

imageline($image, 0, 300, 500, 400, $white);

imageline($image, 0, 400, 500, 450, $white);



// Output the image

imagepng($image);

?>


So any ideas?
Am I doing this the wrong way?
Zacay
Forum Newbie
 
Posts: 2
Joined: Tue Aug 16, 2005 1:22 pm

Postby feyd » Tue Aug 16, 2005 1:39 pm

  1. using
    Syntax: [ Download ] [ Hide ]
    tags helps us, help you.</li><li>Moved to <span style="font-weight: bold">Graphics</span>.</li></ol>
User avatar
feyd
Neighborhood Spidermoddy
 
Posts: 31559
Joined: Mon Mar 29, 2004 4:24 pm
Location: Bothell, Washington, USA

Postby Zacay » Sat Aug 20, 2005 4:29 pm

Anyone please?
Zacay
Forum Newbie
 
Posts: 2
Joined: Tue Aug 16, 2005 1:22 pm


Return to Graphics

Who is online

Users browsing this forum: No registered users and 0 guests