neugi Posted June 27, 2006 Share Posted June 27, 2006 Hi, i use the following code:[code]<? header("Content-type: image/png"); $img_foto = "foto.png"; $img_bild = "projekte/testhaus.jpg"; $winkel = 7; $font = '../font/rabiohead.ttf'; $text1 = "Hi"; $text2 = "Text2"; $text3 = "Text3"; $img = imagecreatefrompng($img_foto); $foto = imagecreatefromjpeg($img_bild); $trans = imagecolorallocate($foto, 255, 255, 255); $white = imagecolorallocate($img, 255, 255, 255); $foto = imagerotate($foto, $winkel, $trans); $bild_x = imagesx($foto); $bild_y = imagesy($foto); $img_x_y = getimagesize($img_foto); imagecolortransparent($foto, $trans); imagecopymerge($img, $foto, -3, 28, 0, 0, $bild_x, $bild_y, 100); imagettftext($img, 20, $winkel, 20, 330, $grey, $font, $text1); imagecolortransparent($img, $white); imagepng($img); imagedestroy($img); imagedestroy($foto);?> [/code]and the result ist das i got a whit background. how can i remove this?best Link to comment https://forums.phpfreaks.com/topic/13014-transparent-background/ Share on other sites More sharing options...
DaveLinger Posted June 27, 2006 Share Posted June 27, 2006 Right click -> "Select All" -> Backspace. Link to comment https://forums.phpfreaks.com/topic/13014-transparent-background/#findComment-50060 Share on other sites More sharing options...
neugi Posted June 27, 2006 Author Share Posted June 27, 2006 [!--quoteo(post=388474:date=Jun 27 2006, 07:33 AM:name=DaveLinger)--][div class=\'quotetop\']QUOTE(DaveLinger @ Jun 27 2006, 07:33 AM) [snapback]388474[/snapback][/div][div class=\'quotemain\'][!--quotec--]Right click -> "Select All" -> Backspace.[/quote]realy funny *lol*i mean to remove the white background.best Link to comment https://forums.phpfreaks.com/topic/13014-transparent-background/#findComment-50061 Share on other sites More sharing options...
DaveLinger Posted June 27, 2006 Share Posted June 27, 2006 what do you expect to get instead of the white background?White IS the default, you know. Link to comment https://forums.phpfreaks.com/topic/13014-transparent-background/#findComment-50069 Share on other sites More sharing options...
maxim Posted June 27, 2006 Share Posted June 27, 2006 i know you can do this[code]//enable the .png image to retain its transperant propertiesimageAlphaBlending($image, false);imageSaveAlpha($image, true);[/code]basicly if you using existing image which already has transperancey by default it will look black. so by adding that code it makes it transparent.if you use imagecolortransparent() it only makes that 1 color transparent and is only good for low res 'blocky' images, hope that helps.heres a image i made with the code i posted. as you can see the shadow is semi transparent something that is not possible with imagecolortransparent()[a href=\"http://maximhome.no-ip.org/blog/?p=5\" target=\"_blank\"]http://maximhome.no-ip.org/blog/?p=5[/a] Link to comment https://forums.phpfreaks.com/topic/13014-transparent-background/#findComment-50083 Share on other sites More sharing options...
neugi Posted June 28, 2006 Author Share Posted June 28, 2006 Hi, the new problem is that i want to change the stuff to gif format, because auf the display problems with png in IE.i've changed imagepng to imagegifbut as there is still the whit background :(best Link to comment https://forums.phpfreaks.com/topic/13014-transparent-background/#findComment-50314 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.