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

Post Reply
Zacay
Forum Newbie
Posts: 2
Joined: Tue Aug 16, 2005 1:22 pm

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

Post by Zacay »

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:

Code: Select all

<?
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:

Code: Select all

<?
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?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

  1. using

    Code: Select all

    tags helps us, help you.
    [*]Moved to [b]Graphics[/b].[/list]
Zacay
Forum Newbie
Posts: 2
Joined: Tue Aug 16, 2005 1:22 pm

Post by Zacay »

Anyone please?
Post Reply