Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The ImageCache Actions module provides Interlace / Progressive effect. It would be great to have this in D8. We have developed a module that adds Interlace / Progressive effect.
The module can be found here Image Effects Interlace.
Should we provide a patch for Image Effects module?
Comment | File | Size | Author |
---|---|---|---|
#20 | image_effects-add-interlace-effect-2751175-20.patch | 11.12 KB | lebster |
#16 | image_effects-add-interlace-effect-2751175-16.patch | 11.14 KB | lebster |
Comments
Comment #2
lebster CreditAttribution: lebster commentedComment #3
lebster CreditAttribution: lebster at CimpleO commentedComment #4
mondrakeAny contribution is welcome! :)
I had a quick look at the sandbox module. Please make sure a patch here follows same approach as other effects thta were introduced - toolkit specific code in image toolkit operation classes, addition of tests, etc. A good example is #2659676: Add "Contrast" image effect
Comment #5
lebster CreditAttribution: lebster at CimpleO commentedI have attached a patch.
Comment #6
lebster CreditAttribution: lebster at CimpleO commentedComment #8
mondrakeAt least ImageMagick has different interlacing options - None/Line/Plane/Partition - shouldn't we give users the possibility to choose instead of hardcoding "Plane"? One may also want to revert from Plane to None for example.
Then GD will only set on or off the interlace bit.
Also, I think that this option only applies to some image formats (GIF, JPEG). Shall we check the image format before applying the operation?
Comment #9
mondrakeAlso, please add a line to the README.md file with the description of the effect.
Not sure if this can be tested at all on the image itself, but a test could be made just for adding the effect.
Comment #10
lebster CreditAttribution: lebster at CimpleO commentedAs for interlace types. The official ImageMagick documentation, regarding the
interlace
option says:, thus both types can be used without any problem. And I think we could make this setting configurable if ImageMagick toolkit selected, Line or Plane. Is it will be enough for now?
Also, regarding the revert, from the documentation and research, type "none" does not allow us to make the the reverse transformation, i.e. de-interlace of the image from other types. For example, that means that we can't convert the interlaced/progressive JPEG back to baseline JPEG. You could check this link http://www.imagemagick.org/Usage/scripts/deinterlace to be sure.
Comment #11
mondrake@lebster thanks a lot for explanation.
yes having the configurable option on the effect would make sense. Only thing I would suggest (on the image effect) not to check the active toolkit, but just put in the description of the config option that the GD toolkit does not differentiate. Image effects are (should be :)) toolkit-agnostic - it's the toolkit operation that should decide what to do with the configuration that effects pass to them. Other toolkits implementation may take 'line' or 'plane' and do something with it.
Clear, thanks. So no "None" option in the image effect :)
BTW, just found this #1883192: Option for progressive jpeg in ImageMagick's issue queue - even if the approach there is different (setting interlace on the toolkit config level rather than on image effect level), still it suggests supporting both 'line' and 'plane'.
Comment #12
lebster CreditAttribution: lebster at CimpleO commentedidentify -verbose
command, that returns None if the image is NOT interlaced/progressive.Comment #13
lebster CreditAttribution: lebster at CimpleO commentedComment #15
mondrakeVERY good job @lebster! And very nice test concept.
Most probably test fails on DrupalCI because you are exec'ing 'identify - verbose'. This will work locally, but not on the test bots since they have not ImageMagick installed :(
Have a look at ImageEffectsTestBase::executeTestOnToolkits line 171 to see how to skip the test if identify is not reachable.
Minor nitpicks to follow.
Comment #16
lebster CreditAttribution: lebster at CimpleO commentedI fixed the tests. Used another way that checks the "interlaced" flag - http://stackoverflow.com/questions/14235600/php-test-if-image-is-interla....
Comment #17
mondrakeNitpicks:
this is shown on the effect form UI - better "Specify the type of interlacing scheme"?
"Does not matter if GD toolkit selected." not a native English speaker but I think better something like "This setting is not relevant for the GD image toolkit"
maybe you can add 'required' => FALSE and 'default' => 'Plane' here too. Up to you.
not really... rather "Create an interlaced PNG or GIF or progressive JPEG image"
same here...
$this->container->get('file_system')
Note that assert messages are no longer necessary. Up to you.
$this->container->get('file_system')
Comment #18
mondrakeplease use FQN for ImageInterface (\Drupal\Core\Image\ImageInterface), and add comments to @param and @return according to coding standards. I know, I know...
Great! Let's credit the source then, add a @see http://stackoverflo... to the method's docblock
With that we're RTBC I think
Comment #19
mondrakeHm, I think that
only works for PNG, though. So the passes on JPEG and GIF are false positives. Maybe for the purpose of the test we can only have test for the PNG file and call it a day.
Comment #20
lebster CreditAttribution: lebster at CimpleO commentedI have fixed mentioned issues and added comments according to coding standards. I agreed, lets leave test for PNG only, for now. If needed, we could add more test later.
Comment #21
mondrake@lebster thanks this looks good. Also tested manually. RTBC.
comment exceeding 80 chars, can be fixed on commit
Comment #23
mondrakeCommitted, thank you @lebster!