var sidebar_align = 'right';
var content_container_margin = parseInt('350px');
var sidebar_width = parseInt('330px');
GD Library Help
I am having a bit of trouble that I cant seem to work out...
Basically I has some pngs with transparent backgrounds - the client resized them and saved them as jpg's so they lost the transparent and it was replace with solid black...
The images dont have any other black in them except the bit that needs to be transparent...
So using the following function... http://php.net/manual/en/function.im...ransparent.php
I need to open the jpg.... turn the colour black transparent and resave as a png...
Can this be done? If so how would I go about doing it?
I got this but still doesnt work...
$imgstr = imagecreatefromstring ( file_get_contents ( 'grr.jpg' ));
imagealphablending ( $imgstr , false );
imagesavealpha ( $imgstr , true );
$black = imagecolorexact ( $imgstr , 0 , 0 , 0 );
imagecolortransparent ( $imgstr , $black );
imagepng ( $imgstr , "output.png" );
imagedestroy ( $imgstr );
I'm sure this isn't the best option for you, but if I were in your situation I would make a java web applet to resolve this issue. You can set up a BufferedImage and have the fourth parameter be BufferedImage.TYPE_INT_ARGB and run a nested for loop to go through all the pixels and change all the black ones to transparent using Graphics2D.
I don't understand the problem,
Originally Posted by
You already have a complete example of what you want on the manual page.
Thanks for your replied. It turned out the colour I wanted to change wasnt true black as in 0, 0, 0 it was more a 13, 9, 8... as soon as I changed it the above code worked.
By mtrc in forum Programming Tutorials
Last Post: 03-16-2005, 06:29 PM
By mtrc in forum Hosting Security and Technology
Last Post: 03-09-2005, 02:51 AM
By bfarrey in forum Hosting Security and Technology
Last Post: 12-29-2004, 05:41 PM
By Serverplan in forum Hosting Security and Technology
Last Post: 11-10-2003, 06:07 PM
By kami in forum Hosting Software and Control Panels
Last Post: 12-25-2002, 04:27 AM