Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Image interlacing option in GD is supported #185

Closed
wants to merge 1 commit into from

5 participants

@vchrm

Fixed previous pull request: #184 .

@stof

Please also implement it for Gmagick and Imagick

@romainneutron
Collaborator

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.

@vchrm

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

@anthonysterling

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

Imagick

Imagick::INTERLACE_UNDEFINED
Imagick::INTERLACE_NO
Imagick::INTERLACE_LINE
Imagick::INTERLACE_PLANE
Imagick::INTERLACE_PARTITION

Gmagick

Gmagick::INTERLACE_UNDEFINED
Gmagick::INTERLACE_NO
Gmagick::INTERLACE_LINE
Gmagick::INTERLACE_PLANE
Gmagick::INTERLACE_PARTITION

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.

@anthonysterling

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.

@anthonysterling

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 ?

@romainneutron
Collaborator

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).

@anthonysterling

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

@romainneutron
Collaborator

yes , sure :)

@anthonysterling

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.

Anthony.

@anthonysterling

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

@vchrm

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?

@avalanche123
Owner

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
View
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.