Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

Results 1 to 3 of 3

Thread: GD PNG Transparency help!!

  1. #1

    GD PNG Transparency help!!

    Hi guys! for that bast 8 hours ive been grinding my teeth trying to get this to work
    basically we are layering transparent 24-bit PNGS over one another, however unless i Index the PNGS (which cause ugly jaggerd lines) they show black backgrounds

    weve managed to work it so that the very bottom most layer works as transparent RBG mode PNG but the others still wont.

    PLEASE help, weve scoured the net, tried 100000 different methods but we're stumped!

    here is the code

    PHP Code:
    <?php
      header 
    ("Content-type: image/png"); 
     
    //$imgbackground=imageCreateFromPng("paperdoll/background.png");
      
    $imgTorso=imageCreateFromPng("paperdoll/human_body.png"); 
      
    $imgHair=imageCreateFromPng("paperdoll/malehair1_2.png");
      
    $imgEyes=imageCreateFromPng("paperdoll/eyes1.png");
      
    $imgEars=imageCreateFromPng("paperdoll/human_ears.png");
      
    $imgMouth=imageCreateFromPng("paperdoll/mouth1.png");
      
    $imgBody=imageCreateFromPng("paperdoll/scivvies.png");
      

         
      
    imagecolortransparent($imgTorso,imagecolorat($imgTorso,0,0));
      
    imagecolortransparent($imgHair,imagecolorat($imgHair,0,0));
      
    imagecolortransparent($imgEyes,imagecolorat($imgEyes,0,0));
      
    imagecolortransparent($imgEars,imagecolorat($imgEars,0,0));
      
    imagecolortransparent($imgMouth,imagecolorat($imgMouth,0,0));
      
    imagecolortransparent($imgBody,imagecolorat($imgBody,0,0));
      
        
    //    imageAlphaBlending($imgbackground, true);
        
    imageAlphaBlending($imgTorsotrue);
        
    imageAlphaBlending($imgHairtrue);
        
    imageAlphaBlending($imgEyestrue);
        
    imageAlphaBlending($imgEarstrue);
        
    imageAlphaBlending($imgMouthtrue);
        
    imageAlphaBlending($imgBodytrue);
        
        
    //imageSaveAlpha($imgbackground, true);
        
    imageSaveAlpha($imgTorsotrue);
        
    imageSaveAlpha($imgHairtrue);
        
    imageSaveAlpha($imgEyestrue);
        
    imageSaveAlpha($imgEarstrue);
        
    imageSaveAlpha($imgMouthtrue);
        
    imageSaveAlpha($imgBodytrue);
      
     
    //imagecolortransparent($imgbackground,imagecolorat($imgbackground,0,0));
      
    $insert6_x imagesx($imgTorso); $insert6_y imagesy($imgTorso);
      
    $insert_x imagesx($imgHair); $insert_y imagesy($imgHair); 
      
    $insert2_x imagesx($imgEyes); $insert2_y imagesy($imgEyes); 
      
    $insert3_x imagesx($imgEars); $insert3_y imagesy($imgEars); 
      
    $insert4_x imagesx($imgMouth); $insert4_y imagesy($imgEars); 
      
    $insert5_x imagesx($imgBody); $insert5_y imagesy($imgEars); 
      
    imagecopymerge($imgTorso,$imgTorso,0,0,0,0,$insert6_x,$insert6_y,100); 
      
    imagecopymerge($imgTorso,$imgHair,0,0,0,0,$insert_x,$insert_y,100); 
      
    imagecopymerge($imgTorso,$imgEyes,0,0,0,0,$insert2_x,$insert2_y,100); 
      
    imagecopymerge($imgTorso,$imgEars,0,0,0,0,$insert3_x,$insert3_y,100); 
      
    imagecopymerge($imgTorso,$imgMouth,0,0,0,0,$insert4_x,$insert4_y,100); 
      
    imagecopymerge($imgTorso,$imgBody,0,0,0,0,$insert5_x,$insert5_y,100); 
      
    //imagecopymerge($imgbackground,$imgbackground,0,0,0,0,$insert6_x,$insert6_y,100); 
      
    imagepng($imgTorso,"",100); 
    ?>
    here is the result >
    http://sammystudio.co.uk/majv1/avatar3.php

  2. #2
    check this out [may be of assisstance]
    http://blog.apoure.com/2007/06/18/pn...rnet-explorer/

    Hopefully this helps ya in some way.

    Cheers

  3. #3
    1,839
    posts
    Registered User
    ^^ lol thats a totally different problem...

    I had this same problem and ended up just giving up on my project that needed it... hope you find a way of doing it...im sure you can with tranparency index or something just anything explaining it was too far over my head in terms of color theory...GD library...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012