Image compression in PHP
Now I want to compress the picture, for example, 640x480 image is now stored 600k I want to achieve compression into 640x 480 480k size of the picture This can be achieved? If this compresses the picture will not be damaged? How exactly do you want to do it? Urgent request?????
------to solve the idea----------------------
Reduce the pixels of the picture can be, there may be a problem is the image display effect and the original effect of color difference, there are defects.
------to solve the idea----------------------
You can use the GD library to generate thumbnails
------to solve the idea----------------------
Create a compressed package
$ZP = Gzopen ("1.gz", "WB");
Get data to be compressed
$string = file_get_contents ("com.html");
Maximize compressed data
$compress _string = gzcompress ($string, 9);
Writing compressed data to a compressed package
Gzwrite ($ZP, $compress _string, strlen ($compress _string));
Gzclose ($ZP);
?>
Picture compression is the same
------to solve the idea----------------------
References: http://blog.csdn.net/fdipzone/article/details/9316385
------to solve the idea----------------------
No!
640x 480 600k compression into 640x 480 480k, then remove the 120k will inevitably take away 1/5 of the picture data, resulting in picture quality decline
Unless your original image is Bitmap mode (Bmp,tiff), but
GIF is lossless compression, but only 256 colors (that is, color information is lost)
JPEG is lossy compression, apparently lossy two words already good to explain the problem
PNG is lossless compression, but if it is 256 color, it is obviously lost color information, and true color is equal to no compression
------to solve the idea----------------------
Try to reduce quality.