I have tried with no luck in creating an interlaced / progressive JPEG image using the Imagick extension. Per the manual I should be able to user bool Imagick::setImageInterlaceScheme ( int $interlace_scheme ) however I haven't had any luck with it.
Here is what I have so far:
$image = new Imagick();
$image->readImage('flower.jpg');
$image->scaleImage(0,1024);
$image->setCompressionQuality(87);
//I do not know what $interlace_scheme settings are,
//and have tried every integer from 0-10 as the interlace_scheme.
$image->setImageInterlaceScheme(0);
header('Content-type: image/jpeg');
echo $image;
If anyone knows how to use, please let me know. Thanks
how to create a Interlace / Progressive image
Re: how to create a Interlace / Progressive image
http://php.net/manual/en/imagick.constants.php search for Interlace constants
you need to pass something like $im->setImageInterlaceScheme( imagick::INTERLACE_PARTITION );
--
Mikko Koppanen
you need to pass something like $im->setImageInterlaceScheme( imagick::INTERLACE_PARTITION );
--
Mikko Koppanen
Mikko Koppanen
My blog: http://valokuva.org
My blog: http://valokuva.org
Re: how to create a Interlace / Progressive image
Thanks for the response.
I just got around to trying this, but with my luck it's not working.
I have tried it in the same order as function calls are above.
Also tried every constant available:
$image->setImageInterlaceScheme( imagick::INTERLACE_UNDEFINED );
$image->setImageInterlaceScheme( imagick::INTERLACE_NO);
$image->setImageInterlaceScheme( imagick::INTERLACE_LINE );
$image->setImageInterlaceScheme( imagick::INTERLACE_PLANE );
$image->setImageInterlaceScheme( imagick::INTERLACE_PARTITION );
At least I don't get any errors (except I'm not catching exceptions).
But unfortunately images are still being displaying top down, rather then progressively loading into the browser.
Any further help would be appreciated.
-mfg
I just got around to trying this, but with my luck it's not working.
I have tried it in the same order as function calls are above.
Also tried every constant available:
$image->setImageInterlaceScheme( imagick::INTERLACE_UNDEFINED );
$image->setImageInterlaceScheme( imagick::INTERLACE_NO);
$image->setImageInterlaceScheme( imagick::INTERLACE_LINE );
$image->setImageInterlaceScheme( imagick::INTERLACE_PLANE );
$image->setImageInterlaceScheme( imagick::INTERLACE_PARTITION );
At least I don't get any errors (except I'm not catching exceptions).
But unfortunately images are still being displaying top down, rather then progressively loading into the browser.
Any further help would be appreciated.
-mfg
Re: how to create a Interlace / Progressive image
Assume your the image you are writing is "image.jpg". Instead save it as "pjpeg:image.jpg."
Re: how to create a Interlace / Progressive image
That worked here!
<?php
/* Create a new object and read the image in */
$im = new imagick( "/var/www/testimages/new/im/strawberry.jpg" );
/* Set format and interlace scheme */
$im->setImageFormat( "pjpeg" );
$im->setImageInterlaceScheme( imagick::INTERLACE_LINE );
/* Output */
header( "Content-Type: image/pjpeg" );
echo $im;
?>
<?php
/* Create a new object and read the image in */
$im = new imagick( "/var/www/testimages/new/im/strawberry.jpg" );
/* Set format and interlace scheme */
$im->setImageFormat( "pjpeg" );
$im->setImageInterlaceScheme( imagick::INTERLACE_LINE );
/* Output */
header( "Content-Type: image/pjpeg" );
echo $im;
?>
Mikko Koppanen
My blog: http://valokuva.org
My blog: http://valokuva.org
Re: how to create a Interlace / Progressive image
Thanks for the posts all.
It seems to be working, but for some reason I'm only getting the image displaying all at once (not loading in stages). I know my browser is capable of progressive images, but I guess I'm just have to keep playing with it.
Cheers, -mfg
It seems to be working, but for some reason I'm only getting the image displaying all at once (not loading in stages). I know my browser is capable of progressive images, but I guess I'm just have to keep playing with it.
Cheers, -mfg
Re: how to create a Interlace / Progressive image
Read your image into an image editor, Photoshop, Paintshop Pro, etc. and use its image info feature.
Re: how to create a Interlace / Progressive image
Hello,
I seem to be having trouble with setImageInterlaceScheme on newer versions of imagick. I have tried everything as suggested in this thread but the function seems to do nothing still. Here is my imagick version information:
About pecl.php.net/imagick-2.3.0
================================
Release Type PECL-style PHP extension (source code)
Name imagick
Channel pecl.php.net
Summary Provides a wrapper to the ImageMagick library.
Description Imagick is a native php extension to create and
modify images using the ImageMagick API.
This extension requires ImageMagick version
6.2.4+ and PHP 5.1.3+.
IMPORTANT: Version 2.x API is not compatible
with earlier versions.
Maintainers Mikko Koppanen <mkoppanen@php.net> (lead)
Scott MacVicar <scottmac@php.net> (lead)
Release Date 2009-07-28 11:06:14
Release Version 2.3.0 (stable)
API Version 2.3.0 (stable)
License PHP License (http://www.php.net/license)
Release Notes - imagick::setImageVirtualPixelMethod not
deprecated anymore
- fixed windows build
Required Dependencies PHP version 5.1.3
PEAR installer version 1.4.0 or newer
package.xml version 2.0
Last Modified 2010-06-24 14:21
Previous Installed - None -
I cannot find any documentation that says whether this function is or is not working with this version. Can anyone help?
I seem to be having trouble with setImageInterlaceScheme on newer versions of imagick. I have tried everything as suggested in this thread but the function seems to do nothing still. Here is my imagick version information:
About pecl.php.net/imagick-2.3.0
================================
Release Type PECL-style PHP extension (source code)
Name imagick
Channel pecl.php.net
Summary Provides a wrapper to the ImageMagick library.
Description Imagick is a native php extension to create and
modify images using the ImageMagick API.
This extension requires ImageMagick version
6.2.4+ and PHP 5.1.3+.
IMPORTANT: Version 2.x API is not compatible
with earlier versions.
Maintainers Mikko Koppanen <mkoppanen@php.net> (lead)
Scott MacVicar <scottmac@php.net> (lead)
Release Date 2009-07-28 11:06:14
Release Version 2.3.0 (stable)
API Version 2.3.0 (stable)
License PHP License (http://www.php.net/license)
Release Notes - imagick::setImageVirtualPixelMethod not
deprecated anymore
- fixed windows build
Required Dependencies PHP version 5.1.3
PEAR installer version 1.4.0 or newer
package.xml version 2.0
Last Modified 2010-06-24 14:21
Previous Installed - None -
I cannot find any documentation that says whether this function is or is not working with this version. Can anyone help?