Jump to content

Recommended Posts

I'm resizing and copying a transparent gif to a transparent gdlib image. After copying, the transparency gets speckled.

Also, it may be noteworthy that imagecopy() and imagecopyresized() don't bring transparency with them. I'm guessing the original image has one transparent color and I have specified a different transparent color in the new image?

If I use imagecolortransparent() to determine what color is transparent, it only returns the number "31" -- whatever that means.

thoughts?


[img]http://www.atchafalayablend.com/gallery/1_225.jpg[/img]

Here's the code

[code]
<?php
$im=imagecreatefromstring(file_get_contents("../images/someimage.gif"));
$newim=imagecreatetruecolor($width,((imagesy($im)/imagesx($im))*$width));
if(imagecolortransparent($im)!=="-1") {
$trans_color = imagecolorallocate($newim, 255, 255, 255);
$color = imagecolorallocate($newim, 0, 0, 0);
imagecolortransparent($newim, $trans_color);
}
imagefill($newim,0,0,imagecolorallocate($newim, 255,255,255));
imagecopyresampled($newim,$im,0,0,0,0,$width,((imagesy($im)/imagesx($im))*$width),imagesx($im),imagesy($im));
imagedestroy($im);
imagegif($newim);
?>
[/code]
[quote author=jesirose link=topic=121672.msg500747#msg500747 date=1168370100]
You might have to run it a few times on a few shades[/quote]

I'm not quite sure what you mean. GIF only allows a single color to be transparent (I believe). All testing with multiple colors just gives me a flat image (no transparency at all). In fact, if I choose a color other than white, it's been going flat.
[quote author=michaellunsford link=topic=121672.msg500835#msg500835 date=1168382052]
[quote author=jesirose link=topic=121672.msg500747#msg500747 date=1168370100]
You might have to run it a few times on a few shades[/quote]

I'm not quite sure what you mean. GIF only allows a single color to be transparent (I believe). All testing with multiple colors just gives me a flat image (no transparency at all). In fact, if I choose a color other than white, it's been going flat.
[/quote]

No, at least with Photoshop you can choose multiple colors...  If you want I can make it transparent for you...  Send it to me at [my forum nickname]@[mywebsite.com]
and my website is fractalfairy.com
Um, you do realize that even if you do get this to work right inside the first black line will be transparent too, and there will be no fading black into the transparency it'll just have a white 'halo'. Its best to do this in photoshop.
[quote author=jesirose link=topic=121672.msg501095#msg501095 date=1168407710]
Can you show the original image please?
[/quote]

sorry

[img]http://www.atchafalayablend.com/images/pack_o_peppers.gif[/img]

[quote author=DarkendSoul link=topic=121672.msg501103#msg501103 date=1168408673]Its best to do this in photoshop.
[/quote]

Yeah, I know. The problem is these are client uploaded images. There are only a few now, but someday soon they'll have dozens or hundreds.
[quote author=bubblybabs link=topic=121672.msg501338#msg501338 date=1168440036]
How's this?  Somewhat difficult to work with since it's already been altered...
[img]http://www.fractalfairy.com/pack-o-peppers.gif[/img]
[/quote]

BB, I think you're really missing the point here... What Michael's probably saying is that his clients will be uploading many images from now and in the future, and if GD could do the work for him it would be a whole lot better than having to do it manually every time.

Regards
Huggie
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.