Wednesday, October 13, 2010

How to save progressive JPEG with GD Library?



PHP imageinterlace() funtion turns the interlace bit on or off.
If the interlace bit is set and the image is used as a JPEG image, the image is created as a progressive JPEG.

<?php
// Create an image instance
$im = imagecreatefromjpeg('test.jpg');

// Enable interlancing
imageinterlace($im, true);

// Save the interlaced image
imagegif($im, './progressive.jpg');
imagedestroy($im);
?>

No comments:

Post a Comment