Aren't png's truecolor? And transparency a feature of indexed color (gifs)?

Interested in the topic, but very confused.... 😕

    For the png I can take my psp8 and assign a color for transparency, and it'll do similar to what the gif does. Although not quite. LOL

    It reqlly is confusing and my computer froze up on me before I could get those screen captures. I'll have to try that now. 🙂

      Originally posted by ashley526
      Okay let me take pics of the screen I see. It might just be an issue with the IE, eh? Although I know other things that are similar to this work on my IE with the transparency so there must be a way.

      That's most likely it; IE has the worst PNG support of any browser that claims to support PNG.

      But you're right; I'm pretty sure even IE can handle palette-based PNGs with a single transparent colour.

      Ah, but you're using a truecolour image, I see now; and if you want to use as many as 795 colours, it will have to stay a truecolour image.

      Here's a trick: before output: call [man]imagetruecolortopalette[/man] on it and get it down to a 256-colour palette-based image. (Do it with dithering turned on).

      And nag Microsoft about them getting their browser fixed 🙂

        Originally posted by neerav
        Aren't png's truecolor? And transparency a feature of indexed color (gifs)?

        PNG was developed ten or so years ago as a replacement for GIF. It can do everything GIF can do except animation (that's MNG).

        http://www.libpng.org/pub/png/

          I know I am your basic php loser. LOL

          Do you start a whole new function with this or do you just add it on the end. I only see one example on that page and it isn't making sense to me yet.

          Although I screwed up my code somehow now and I don't get any image now! hahaha So I gotta work on what I did before I can even move forward with this step. lol

            Okay I uploaded a fresh code it worked, then I added the functions that I did before and it makes it not work. ugh!

            Do you see anything outright wrong with this?

            function colorallocate($im,$color){ 
            $color = str_replace('#','',$color); 
            $white = imagecolorallocate($im,255,255,255); 
            $transColor = imagecolorallocate($im,255,255,0); 
            imagecolortransparent($im, $transColor); 
            $red   = hexdec(substr($color,0,2)); 
            $green = hexdec(substr($color,2,4)); 
            $blue  = hexdec(substr($color,4,6));
            $color_index = ImageColorAllocate($im,$red,$green,$blue);
            return array($transColor, $color_index); 
            }
             

              IE does not support transparent PNG's, nor MNG's ...

                Originally posted by SpanKie
                IE does not support transparent PNG's, nor MNG's ...

                I've seen it done. 😉

                  Originally posted by ashley526
                  I've seen it done. 😉

                  For proper alpha-channel transparency it involves loading extra modules as filters via proprietary CSS code (translation: Microsoft have done it, but can't be bothered fixing IE). But even IE can handle GIF-style transparency without that.

                  I didn't include imagetruecolortopalette in the function, because I'm still sure your function is flawed in basic concept and wherever I put it would probably be wrong. What exactly is it supposed to do? As I said before, you're allocating three new colours every time you use it - this one you're passing, white, and yellow, which gets used for transparency.

                    Well the white I probably can take off there. I think I added that whenever it went white. I was desperate to try anything. lol

                    I'll try to work on it tonight and see if I can straigten out why it's getting the error. Basically it's a countdown put into an image form. It goes further down the bar as you get closer to the end time. 🙂

                    Since it's registered as a png image you can put it as just that and it will go on most forums. It's pretty neat!

                      24 days later

                      Alright just found the time to fix it. 😉

                      I am starting a fresh before I made any changes... Here's what I have:

                      function colorallocate($im,$color){
                      	$color = str_replace('#','',$color);
                      	$red   = hexdec(substr($color,0,2));
                                      $green = hexdec(substr($color,2,4));
                      	$blue  = hexdec(substr($color,4,6));
                      	return ImageColorAllocate($im,$red,$green,$blue);
                      }
                      

                      From this is what I started to use to try to set the transparency, and it's not worked. The thing is.... the little slider bars DO work, they go transparent whenever they in all actuality show up teal first. (which is the default color for a png image that has transparency) This really is above me but I am trying to learn as I go in my free time.

                      I am guessing you have to assign a color right? And I don't understand what to do with imagetruecolortopalette as I saw no samples. Sorry I am really such a newbie to php...

                      Thanks again for all your help!!!

                        So I need to add these functions back into the above code, right?

                        $transColor = imagecolorallocate($im,255,255,0);

                        $imagecolortransparent($im, $transColor);

                        $color_index = ImageColorAllocate($im,$red,$green,$blue);

                        return array($transColor, $color_index);

                          Write a Reply...