Skip to content


Image interlacing option in GD is supported #185

wants to merge 1 commit into from

5 participants


Fixed previous pull request: #184 .


Please also implement it for Gmagick and Imagick


Hello @vchrm ,

thanks for having updated your PR. As @stof said, you have to implement it with other drivers.

Do not open a new pull request for this, just update this one, by pushing your commit on your feature/interlacing branch.


Kk, I'll have a look into that (right after school exams period ends).


With regards to interlace options, Imagick and GMagick share the following constants/options.





However, GD only has the ability so set interlacing on or off. It would be nice to know which interlacing strategy GD uses so the same behaviour can be applied with Imagick and Gmagick.


The libgd source points to a libjpeg function called jpeg_simple_progression which lives here.

Sadly, I still cannot determine what interlacing strategy is being used.


I wonder if $options is the right place for this? I'd think not if we can make use of the interlace variants listed above. What about a filter?

Thoughts @avalanche123 ?


IMO we could add ImageInterface::INTERLACE_* constants, map theses constants for Imagick and Gmagick, and ignore the constant use for GD (or throw an exception for unsupported interlacing methods).


Sounds good to me @romainneutron, and add an interlace method too?


yes , sure :)


Sorry to railroad your PR @vchrm :(

I was looking to implement this for an upcoming client project, and stumbled across this PR. Feel free to merge my branch and do as you wish.

It still needs a code review, supporting tests and documentation - all of which I'm happy to help with.



FWIW, this still feels like it should be somewhere else; it adds a lot of noise to the ImageInterface.


Hi, my apologies for the delay. I really had exams until this week. No harm done, I am happy that Imagine is going to support this.
I'm looking forward to when your pull request is merged :-).
So, shouldn't we close this one?


Merged @AnthonySterling's PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 31, 2012
  1. @vchrm
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/Imagine/Gd/Image.php
4 lib/Imagine/Gd/Image.php
@@ -506,6 +506,10 @@ private function saveOrOutput($format, array $options, $filename = null)
$save = 'image'.$format;
$args = array(&$this->resource, $filename);
+ if (isset($options['interlace'])) {
+ imageinterlace($this->resource, $options['interlace'] ? 1 : 0);
+ }
if (($format === 'jpeg' || $format === 'png') &&
isset($options['quality'])) {
// Png compression quality is 0-9, so here we get the value from percent.
Something went wrong with that request. Please try again.