Changing PNG Transparency using PHP

Associate
Joined
26 Oct 2003
Posts
1,107
Hi,

For a project I need to create a dynamically generated heatmap which is overlaid on a Google Map. This works fine, however you can no longer see the map view as it is covered by the heatmap image. Theres no methods available within the Google Map API for changing transparency/etc, however as this is a PNG image I could simple change the opacity of the overlay image.

Therefore, does anyone know of any way of changing the opacity of a (PNG) image using PHP?

Thanks,
Alex
 
imagecolortransparent() sets a designated colour to transparent, so for instance if the part of the image covering the map is white it will be:

Code:
<?php

imagecolortransparent($img, imagecolorallocate($img, 255, 255, 255));

?>
 
Last edited:
imagecolortransparent() sets a designated colour to transparent, so for instance if the part of the image covering the map is white it will be:

Code:
<?php

imagecolortransparent($img, imagecolorallocate($img, 255, 255, 255));

?>

Thanks, I've already done that which solves half the problem by removing the white background colour; however I need the transparency level of the rest of the image to be semi-transparent too.

This screenshot might explain things clearer (ignore the white squares, thats just for testing); http://www.dur.ac.uk/alexander.marshall/temp/screenshot.png
 
Back
Top Bottom