Re: [PHP] imagecreate() question



Did you try making it transparent first, before adding the circle?


Only a question because I'm not sure if it will make a difference. I know I had problems trying to get the alpha blending to actually look decent in png's (ended up looking like a very poor gif with a non- antialiased mask) and I think I eventually gave up and put the image on a white background.

But that was six months to a year ago and anything more than two weeks out is all but forgotten, old-timers disease I think.

Ed

On Apr 2, 2007, at 12:26 PM, tedd wrote:

At 4:27 PM +0100 4/2/07, Richard Davey wrote:
tedd wrote:

In the php manual it says:

imagecreate() returns an image identifier representing a blank image of specified size.
We recommend the use of imagecreatetruecolor().

Q: Why the recommendation?

Because the need to create 256 colour (or less) images grows less year by year. If you need to work with a jpeg/png then imagecreatetruecolor() is required. As this is what most people need, hence the manual comment exists.

imagecreate() returns a "blank" page whereas imagecreatetruecolor () returns a "black" page.

Sure, but both are easily changed.

Cheers,

Rich

I found, which generated my questions, that the difference between a "blank" page and a "black" page can be significant when dealing with alpha channels.

For example, if I create a "blank" page and then place a 50 percent transparent circle on it, it works. However if I do the same thing using a "black" page and change the color black to transparent, I lose the 50 percent transparency of the circle. In other words, it generates a transparent page with a nontransparent circle.

If anyone knows how to use imagecreatetruecolor() to create a png image that has a 100% transparent background with a 50% transparent circle on it, I sure would like to see how you did it.

Cheers,

tedd

--
-------
http://sperling.com http://ancientstones.com http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

.



Relevant Pages

  • Re: [PHP] imagecreate() question
    ... We recommend the use of imagecreatetruecolor. ... However if I do the same thing using a "black" page and change the color black to transparent, I lose the 50 percent transparency of the circle. ... If anyone knows how to use imagecreatetruecolor() to create a png image that has a 100% transparent background with a 50% transparent circle on it, I sure would like to see how you did it. ...
    (php.general)
  • Re: Making white sections of a picture (used in a report) transparent.
    ... values, I want to circle either YES or NO. I've got the code working so it'll show or hide the circle, but I can't seem to get the circle to be transparent. ... I've tried right clicking and setting background to transparent but still no luck. ... The thing that is really confusing me is a picture I inserted ealier IS ... What probably happened in the earlier example was that the control with the yes/no check box or text box or whatever was probably ON TOP of the picture. ...
    (comp.databases.ms-access)
  • transparent object does not print out transparent
    ... I have created a circle that has varient shading. ... orange in the center and fades out to transparent. ... solid and the transparent part becomes white, hiding the second object ...
    (microsoft.public.publisher)
  • Re: LED light simulation (circle)
    ... you no longer actually need the bitmap, just a reference as to where it was. ... a red filled circle, that approaches what I'm looking for, but the ... to transparent, but it does not become transparent. ... give me an approach to accomplish my LED light ...
    (comp.databases.ms-access)
  • Making white sections of a picture (used in a report) transparent.
    ... I want to circle either YES or NO. I've got the code working so ... to be transparent. ... The thing that is really confusing me is a picture I inserted ealier IS ...
    (comp.databases.ms-access)