I had a need to remove animation from Gif files in a specific image style, something that is possible with imagemagick but imagecache_actions was not supporting.

I wrote the following patch which makes this possible.

Comments

bserem created an issue. See original summary.

bserem’s picture

fietserwin’s picture

In fact, GD does not support animations at all and thus will always remove animations upon saving. So this would kind of make the behavior for both toolkits the same.

I will have a look at it, but that will take some weeks, so rest assured that your contribution is taken seriously.

bserem’s picture

FYI this patch is currently running on solebich.de (all listing pages), which is a photo oriented site.
With PHP7 on a BOA server we haven't faced any problems yet.

Thanks for checking it.

fietserwin’s picture

Status: Needs review » Needs work

Thanks for posting this effect. I tested it and it works as expected. I do have a few comments though:

  1. +++ b/coloractions/imagecache_coloractions.module
    @@ -124,6 +124,14 @@ function imagecache_coloractions_image_effect_info() {
    +    'help' => t('Inanimate an image.'),
    

    I am not sure about inanimate as verb, so I would like to propose "remove animation" as user facing name of the effect.
    @dman: as native English speaker: can you confirm that "inanimate" does or doesn't exist as verb?

  2. +++ b/coloractions/imagecache_coloractions.module
    @@ -1232,3 +1240,48 @@ function image_gd_desaturatealpha(stdClass $image/*, array $data*/) {
    +  return t(': Inanimates an animated image, by extracting the first frame.');
    

    I would rephrase this to something like: "... by keeping only the first frame ..."

  3. +++ b/coloractions/imagecache_coloractions.module
    @@ -1232,3 +1240,48 @@ function image_gd_desaturatealpha(stdClass $image/*, array $data*/) {
    +  return image_toolkit_invoke('inanimate', $image, array($data));
    

    image_toolkit_invoke() logs an error when using GD, so I propose to add an empty image_gd_inanimate() function (returning TRUE as GD will remove animation anyway).

Furthermore; our effects that do not have any parameters (like autorotate and invert colors) still have a(n empty) form. i would like to see that for this effect as well, in which we can explain that this effect only works for imagemagick and that gd cannot handle animation at all and thus will always only keep the 1st frame.

dman’s picture

> can you confirm that "inanimate" does or doesn't exist as verb?

Heh, no, I'd never hear or use "inanimate". "Remove animation" is indeed clear.
Could also "halt" or "freeze" it, but in this context (file manipulation) "remove" is indeed probably best.

For the second string, "return t(': Freezes an animated image, keeping only the first frame.');"

bserem’s picture

Inanimate is not a verb (but it is a valid word). So I will update the texts.

I am wokring on the other issues too, an updated patch will come as soon as I have it ready.
Many thanks for the feedback!

bserem’s picture

Status: Needs work » Needs review
StatusFileSize
new2.7 KB
new1.54 KB

I believe I'm on the right track!

Please review and tell me what you think.

bserem’s picture

  • fietserwin committed bd9e2d5 on 7.x-1.x authored by bserem
    Issue #2905130 by bserem, fietserwin: Inanimate moving images
    
fietserwin’s picture

Title: Inanimate moving images » Remove animation from moving images
Status: Needs review » Fixed
StatusFileSize
new5.09 KB

Thanks for updating the patch. I changed a few more things and committed it, see attached interdiff,txt. Note: as I renamed the internal name of the effect as well, your existing site will not recognise this new version: remove and re-add the effect.

bserem’s picture

Thanks!

fietserwin’s picture

if and what name(s) and links would you like to be mentioned on the project page under the "Credits/sponsors" section?

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

bserem’s picture

That would be: Bill Seremetis (bserem) for solebich.de

Thanks, I wasn't expecting that :)