I have a simple image to work on and am stalled at the basics. I read the image in and dump it out, and it turns virtually all black. The image is a simple chart in black and white, like a seating chart. I say virtually because there is a small gray section in the image and that comes out OK, that's how I'm able to conclude that the image is actually there.
I've tried the following code, it works exactly the same with or without the imagecolorallocate statement (also regardless of the values I put in for the colors). I should mention that if I just display the URL of the input png file, it displays correctly in both Firefox and IE, and this problem occurs in both Firefox and IE.
<?php
header('Content-type: image/png');
$imgname = "filename.png";
$im = imagecreatefrompng($imgname);
$background = imagecolorallocate($im,255,255,255);
imagepng($im);
imagedestroy($im);
?>
So I guess there is something wrong with the original image that GD is particularly picky about? I should mention that the original image is in SVG and converted to png with an ubuntu program called "rasterize".
Thanks for any help you can offer!
Trying to get an image to work with GD
Moderator: General Moderators
Re: Trying to get an image to work with GD
Well darn if I didn't figure out how to fix it myself. I just played around with the background option to rasterizer (which I erroneously called "rasterize" in my earlier post) and that fixed it. Appears that not setting the background to that program is a problem.