IMAGEPNG(3) 1 IMAGEPNG(3)imagepng - Output a PNG image to either the browser or a fileSYNOPSIS
bool imagepng (resource $image, [string $filename], [int $quality], [int $filters])
DESCRIPTION
Outputs or saves a PNG image from the given $image.
PARAMETERS
o $
image -An image resource, returned by one of the image creation functions, such as imagecreatetruecolor(3).
o $filename
-The path to save the file to. If not set or NULL, the raw image stream will be outputted directly.
Note
NULL is invalid if the $quality and $filters arguments are not used.
o $quality
- Compression level: from 0 (no compression) to 9.
o $filters
- Allows reducing the PNG file size. It is a bitmask field which may be set to any combination of the PNG_FILTER_XXX constants.
PNG_NO_FILTER or PNG_ALL_FILTERS may also be used to respectively disable or activate all filters.
RETURN VALUES
Returns TRUE on success or FALSE on failure.
CHANGELOG
+--------+--------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+--------------------------------+
| 5.1.3 | |
| | |
| | Added the $filters parameter. |
| | |
| 5.1.2 | |
| | |
| | Added the $quality parameter. |
| | |
+--------+--------------------------------+
EXAMPLES
<?php
$im = imagecreatefrompng("test.png");
header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
?>
SEE ALSO imagegif(3), imagewbmp(3), imagejpeg(3), imagetypes(3), imagesavealpha(3).
PHP Documentation Group IMAGEPNG(3)
Check Out this Related Man Page
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)
Hi
I am a newbie to Unix . I am just trying to understand the difference between various filters for ps. Can someoen pelase explain me whta is the difference between using /usr/bin/ps -ef | grep <PID> or <Process name> and /usr/bin/ps -auxwww| grep <PID> or <Process Name>. (1 Reply)
I'm trying to convert a file with the following command:
convert -verbose image.eps -resize 500x image.jpg
The problem is that the output image loses it's quality and gets all blurred when resized. It shouldn't happen since I'm working with a vector.
I'm pretty sure that I'm missing a... (0 Replies)
Hi Everyone,
I am a Ph.D student working on some image processing tasks and I have run into an interesting problem that I thought someone on here might have an idea about. This paper discusses a method to compare two images based upon the amount they can be compressed. Sorry, since this is my... (3 Replies)