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
IMAGECOLORSET(3) 1 IMAGECOLORSET(3)imagecolorset - Set the color for the specified palette indexSYNOPSIS
void imagecolorset (resource $image, int $index, int $red, int $green, int $blue, [int $alpha])
DESCRIPTION
This sets the specified index in the palette to the specified color. This is useful for creating flood-fill-like effects in palleted
images without the overhead of performing the actual flood-fill.
PARAMETERS
o $
image -An image resource, returned by one of the image creation functions, such as imagecreatetruecolor(3).
o $index
- An index in the palette.
o $red
-Value of red component.
o $green
-Value of green component.
o $blue
-Value of blue component.
o $alpha
- Value of alpha component.
RETURN VALUES
No value is returned.
CHANGELOG
+--------+----------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+----------------------------------+
| 5.4.0 | |
| | |
| | The $alpha parameter was added. |
| | |
+--------+----------------------------------+
EXAMPLES
Example #1
imagecolorset(3) example
<?php
// Create a 300x100 image
$im = imagecreate(300, 100);
// Set the background to be red
imagecolorallocate($im, 255, 0, 0);
// Get the color index for the background
$bg = imagecolorat($im, 0, 0);
// Set the backgrund to be blue
imagecolorset($im, $bg, 0, 0, 255);
// Output the image to the browser
header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
?>
SEE ALSO imagecolorat(3).
PHP Documentation Group IMAGECOLORSET(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)