Re: GD transparency problem
| From: | Steve M | Date: | Mon, 12 May 2003 12:06:11 +0000 |
| Subject: | Re: GD transparency problem | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-147297@lists.php.net to get a copy of this message | ||
Well, messing with the colour table in each image seems to have done the
trick. If you're interested, the results can be seen at:
http://www.webvivant.com/features/deptfndr.php
Thanks for everyone's help...
"James" <james@globalvision.com> wrote in message
news:20030512100737.43540.qmail@pb1.pair.com...
> I've always found transparency to be crap with 24-32 bit pngs, try
> converting the pings down to 8bit and the transparency should stay.
>
> One other thing you should consider doing is putting the GD stuff as an
> image, this way you can load the page , text etc and call the complicated
> map process as an image which will "look" better atleast :)
>
> <img src="myDynamicImage.php?this=that" width=100 height=100>
>
> You can this kind of thing from the geo mapping system i built here:
>
http://www.londontown.com/londonmaps/index.php?ID=7643&IV_Type=TotalLondon&I
>
V_RunByMethod=VBGC&IV_GeoHorizontal=529451&IV_GeoVertical=180462&type=transp
> ort&PlotGeoH=529451&PlotGeoV=180462
>
> This was a nightmare to build, hundreds of tiles, dynamically trying to
find
> out which tiles should be obtained to create a single image and then
trying
> to join them and all the rest of it, yuk!
>
>
>
>
> "Steve M" <steve.m@wanadoo.fr> wrote in message
> news:20030511200950.6492.qmail@pb1.pair.com...
> > Just when I thought I was getting a grip on PHP I decide to take on the
GD
> > library. -sigh- I have two problems which I'll put in two postings, so
> > here's the first and here's what I'm trying to do:
> >
> > I want to display a map and overlay it with highlight sections according
> to
> > the results of a database search. I tried doing this with floating boxes
> and
> > GIFs, but had some issues with positioning the whole shebang on the
page,
> so
> > I thought I'd try some GD routines. And it's working to a degree. Having
> > converted the files to PNG format, I now use the following code:
> >
> > $backimg = imagecreatefrompng('deptmaps/bckgrnd.png');
> > for ($i = 1; $i <= $dbrows ; $i++) {
> > $overlay[$i] =
> imageCreateFromPNG("deptmaps/".$deptcode[$i].".png");
> > imageCopyMerge($backimg,$overlay[$i],0,0,0,0,350,394,10);
> > }
> > imagepng($backimg,"deptmaps/result.png");
> > echo "<IMG SRC='deptmaps/result.png'>";
> >
> > (the $deptcode array holds values from '01' to '95' and there are
> > files
in
> > the deptmaps folder named 01.png etc...)
> >
> > The problem is that I don't get a clear image overlaid by other clear
> > images. The whole thing is rather murky (you can see what I mean at
> > http://www.webvivant.com/features/deptfndr.php . Type
> > 'or' into the
> 'Search
> > by name' box and hit 'Find').
> >
> > I think the problem lies with the PNG files not retaining their
> > transparency. They look fine when I view them in Photoshop, but if I use
a
> > 'pct' value of 100 I see the last overlay as the desired image on a
grey,
> > rather than transparent, background. (BTW, I don't really understand
that
> > 'pct' value - I just tried experimenting with different values).
> >
> > So here's where I need help from wiser heads. I need a pointer to help
me
> > investigate this further. Is this a problem with the PNG files? Do I
need
> to
> > edit the colour map, maybe choosing a different transparency value?
> >
> > Or do I need to play with imagecolortransparent to try to set a new
> > transparency value for the image created with imagecreatefrompng?
> >
> > Any pointers would be appreciated.
> >
> >
>
>