IMAGESAVEALPHA(3) 1 IMAGESAVEALPHA(3)imagesavealpha - Set the flag to save full alpha channel information (as opposed to single-color transparency) when saving PNG imagesSYNOPSIS
bool imagesavealpha (resource $image, bool $saveflag)
DESCRIPTION imagesavealpha(3) sets the flag to attempt to save full alpha channel information (as opposed to single-color transparency) when saving PNG
images.
You have to unset alphablending ( imagealphablending($im, false)), to use it.
Alpha channel is not supported by all browsers, if you have problem with your browser, try to load your script with an alpha channel com-
pliant browser, e.g. latest Mozilla.
PARAMETERS
o $
image -An image resource, returned by one of the image creation functions, such as imagecreatetruecolor(3).
o $saveflag
- Whether to save the alpha channel or not. Default to FALSE.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
imagesavealpha(3) example
<?php
// Load a png image with alpha channels
$png = imagecreatefrompng('./alphachannel_example.png');
// Do required operations
// Turn off alpha blending and set alpha flag
imagealphablending($png, false);
imagesavealpha($png, true);
// Output image to browser
header('Content-Type: image/png');
imagepng($png);
imagedestroy($png);
?>
NOTES
Note
This function requires GD 2.0.1 or later (2.0.28 or later is recommended).
SEE ALSO imagealphablending(3).
PHP Documentation Group IMAGESAVEALPHA(3)
Check Out this Related Man Page
IMAGELAYEREFFECT(3) 1 IMAGELAYEREFFECT(3)imagelayereffect - Set the alpha blending flag to use the bundled libgd layering effectsSYNOPSIS
bool imagelayereffect (resource $image, int $effect)
DESCRIPTION
Set the alpha blending flag to use the bundled libgd layering effects.
PARAMETERS
o $
image -An image resource, returned by one of the image creation functions, such as imagecreatetruecolor(3).
o $effect
- One of the following constants:
o IMG_EFFECT_REPLACE - Use pixel replacement (equivalent of passing TRUE to imagealphablending(3))
o IMG_EFFECT_ALPHABLEND - Use normal pixel blending (equivalent of passing FALSE to imagealphablending(3))
o IMG_EFFECT_NORMAL - Same as IMG_EFFECT_ALPHABLEND.
o IMG_EFFECT_OVERLAY - Overlay has the effect that black background pixels will remain black, white background pixels will
remain white, but grey background pixels will take the colour of the foreground pixel.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
EXAMPLES
Example #1
imagelayereffect(3) example
<?php
// Setup an image
$im = imagecreatetruecolor(100, 100);
// Set a background
imagefilledrectangle($im, 0, 0, 100, 100, imagecolorallocate($im, 220, 220, 220));
// Apply the overlay alpha blending flag
imagelayereffect($im, IMG_EFFECT_OVERLAY);
// Draw two grey ellipses
imagefilledellipse($im, 50, 50, 40, 40, imagecolorallocate($im, 100, 255, 100));
imagefilledellipse($im, 50, 50, 50, 80, imagecolorallocate($im, 100, 100, 255));
imagefilledellipse($im, 50, 50, 80, 50, imagecolorallocate($im, 255, 100, 100));
// Output
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
?>
The above example will output something similar to:[NOT DISPLAYABLE MEDIA]Output of example : imagelayereffect()
NOTES
Note
This function requires GD 2.0.1 or later (2.0.28 or later is recommended).
PHP Documentation Group IMAGELAYEREFFECT(3)
Hi,
I have several folders full of image sequences from an animation.
The image frames are named Frame0001.png to Frame0900.png, somewhere along the way the images have been named in reverse order.
Is there a script that read the contents of a folder and renumber the files Frame0001.png -... (1 Reply)
I used flot to create a graph and I would like to be able to save/export the graph as an image. In firefox on windows you can just ctl rt-click and you have a save as image feature (which I can automate with js) but...I need this to work on a linux browser. On linux in firefox I can print preview... (11 Replies)
Hi,
I generated many figures in .png format (approximately 120). Right now I need to pair the figures on a single page so that the files with the same file name (i.e. jack) that end with .matrix.png are placed on the left and .cdt.png is on the right (so jack.matrix.png with jack.cdt.png... (6 Replies)
Hi,
I have two sets of image files. Both sets have names A to Z but set 1 ends with .cdt.png and set 2 ends with .matrix.png. I want set 1 to match with set 2 if the names match (i.e. A.cdt.png will match with A.matrix.png) and with the convert image tool (program for images), it will merge the... (1 Reply)
Hi, I have two sets of image files. Both sets have names A to Z but set 1 ends with .cdt.png and set 2 ends with .matrix.png. I want set 1 to match with set 2 if the names match (i.e. A.cdt.png will match with A.matrix.png) and with the convert image tool (program for images), it will merge the... (6 Replies)
Well I searched the net with varying success, but it seems kinda hard to find a one/max 2 lined command to:
strip all *.png files in the folder from their first two characters.
Any help is appreciated.
In DOS commandline of course... (17 Replies)
Hi,
i have two folders. Folder A has 1000+ files with just images named like :
01012015.png
01022015.png
etc. Folder B has much more files, part of them with same name as png files folder others not. Instead of folder A wich are only images, these are audio wav files.
I need to... (11 Replies)
I want to crop an image and am using convert
convert mountain.png -crop 3000x4500 +repage -format png mountain--cr.png
The problem is that convert is creating 4 files
mountain--cr-0.png
mountain--cr-1.png
mountain--cr-2.png
mountain--cr-3.png
The first is what I need, the other... (10 Replies)