Answers.Body: <h1>No Current Good Solution</h1>
  
  <p>Having liaised directly with Craft Support on this issue, the outcome after a bit of research was that there is not currently any good solution.</p>
  
  <p>Apparently, Imagick is really, really bad at animated GIFs, but there's no other option.</p>
  
  <p>My workaround was to edit the templating for gif images, so a super-simplified version would look something like the following:</p>
  
  <pre><code>{% set src = image.getUrl('someTransform') %}
  
  {# No transform used for gifs #}
  {% if image.getMimeType() == 'image/gif' %}
      {% set src = image.getUrl() %}
  {% endif %}
  
  &lt;img src="{{ src }}"&gt;
  </code></pre>
  
  <p>Whilst this did result in larger than ideal file sizes for gifs (because the original file was being used rather than smaller transforms), it prevents the issues detailed above. Not great, but better than the enormous file sizes we were seeing and the tasks getting stuck!</p>
  
  <h1>Possibilities in Craft 3</h1>
  
  <p>Apparently, Craft 3 allows for further image optimisation after transforms, and there's a <a href="https://github.com/nystudio107/craft3-imageoptimize" rel="nofollow noreferrer">plugin</a> that capitalises on this already, so hopefully, we'll see some improvement in Craft 3.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-07T08:31:57.753Z
Answers.Text: I ran into pretty much the same issue. My solution was to host all gifs on giphy.com and then just paste the image urls into the cms. Thats far from perfect but this way all optimization is done on far more advanced hardware.
Answers.UserDisplayName: KSPR
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-06-06T09:43:41.820Z
Answers.LastActivityDate: 2017-06-06T09:43:41.820Z
Answers.UserDisplayName: Mike Vaux
Body: <p>Our site makes use of gifs to enable the client to upload basic animating images. Any asset field on the site can be jpg, png or gif, and the site makes significant use of transforms for responsive imagery.</p>
  
  <p>Transforms for jpgs and pngs are working fine, but the gif transforms are coming out <em>huge</em> (significantly bigger than the original file size), and at the point of transform generation, the server is grinding almost to a halt, with most of the <code>Generating pending image transforms</code> tasks eventually stalling.</p>
  
  <p><strong>Image 1</strong></p>
  
  <ul>
  <li>Natural: 2.4MB</li>
  <li>400px Constrain: 4.3MB</li>
  <li>800px Constrain: 19.2MB</li>
  <li>1200px / 1600px / 2400px Constrain: Failed </li>
  </ul>
  
  <p><strong>Image 2</strong></p>
  
  <ul>
  <li>Natural: 5.4MB</li>
  <li>None of the transforms for this seem to be being created now (I previously had to remove it because of the detrimental effect of the transform process on the server but have just tried re-uploading and visiting the page), but one of these was something like 37MB!</li>
  </ul>
  
  <p><strong>Technical Details:</strong></p>
  
  <ul>
  <li>Craft 2.6.2967</li>
  <li><code>imageDriver</code> is set to <code>imagick</code> (which is reported to be available under Utilities / Server Info)</li>
  <li><code>defaultImageQuality</code> is set to <code>70</code></li>
  <li>PHP Memory Limit is set to 256MB (had previously been 512MB, which may explain why none of the transforms for Image 2 are being created any more)</li>
  <li>PHP Max Execution Time is set to 90 seconds</li>
  </ul>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-29T15:20:31.443Z
Comments.Text: What version of Imagick are you running? Any chance you can send one of the offending GIFs to support@craftcms.com?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-29T16:08:57.407Z
Comments.Text: Hey @BradBell, Imagick is 3.4.1. And sure, I'll send you over Image 2 as that seems to be the more problematic of the 2. Cheers! :)
Comments.UserDisplayName: Mike Vaux
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-06-01T08:42:16.253Z
Comments.Text: @MikeVaux Did you figure this out?
Comments.UserDisplayName: Fred Carlsen
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-06-06T09:44:08.247Z
Comments.Text: Hi @FredCarlsen, see below for a brief write up of my discussions with Craft Support :)
Comments.UserDisplayName: Mike Vaux
Tags: <assets><image-transforms><gif>
Title: Why are gif transform file sizes very large?
ThreadText: # Why are gif transform file sizes very large?
  
  (Asked by: username_0 on 2017-03-29)
  
  Our site makes use of gifs to enable the client to upload basic animating images. Any asset field on the site can be jpg, png or gif, and the site makes significant use of transforms for responsive imagery.
  
  Transforms for jpgs and pngs are working fine, but the gif transforms are coming out *huge* (significantly bigger than the original file size), and at the point of transform generation, the server is grinding almost to a halt, with most of the `Generating pending image transforms` tasks eventually stalling.
  
  **Image 1**
  
  * Natural: 2.4MB
  * 400px Constrain: 4.3MB
  * 800px Constrain: 19.2MB
  * 1200px / 1600px / 2400px Constrain: Failed
  
  **Image 2**
  
  * Natural: 5.4MB
  * None of the transforms for this seem to be being created now (I previously had to remove it because of the detrimental effect of the transform process on the server but have just tried re-uploading and visiting the page), but one of these was something like 37MB!
  
  **Technical Details:**
  
  * Craft 2.6.2967
  * `imageDriver` is set to `imagick` (which is reported to be available under Utilities / Server Info)
  * `defaultImageQuality` is set to `70`
  * PHP Memory Limit is set to 256MB (had previously been 512MB, which may explain why none of the transforms for Image 2 are being created any more)
  * PHP Max Execution Time is set to 90 seconds
  
  **Tags:** assets, image-transforms, gif
  
  > **Comments:**
  > **username_1**: What version of Imagick are you running? Any chance you can send one of the offending GIFs to support@craftcms.com?  
  > **username_0**: Hey @username_1, Imagick is 3.4.1. And sure, I'll send you over Image 2 as that seems to be the more problematic of the 2. Cheers! :)  
  > **username_2**: @username_0 Did you figure this out?  
  > **username_0**: Hi @username_2, see below for a brief write up of my discussions with Craft Support :)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-06-06. Score: 4 | Accepted answer
  
  # No Current Good Solution
  
  Having liaised directly with Craft Support on this issue, the outcome after a bit of research was that there is not currently any good solution.
  
  Apparently, Imagick is really, really bad at animated GIFs, but there's no other option.
  
  My workaround was to edit the templating for gif images, so a super-simplified version would look something like the following:
  
  ```
  {% set src = image.getUrl('someTransform') %}
  
  {# No transform used for gifs #}
  {% if image.getMimeType() == 'image/gif' %}
      {% set src = image.getUrl() %}
  {% endif %}
  
  <img src="{{ src }}">
  
  ```
  
  Whilst this did result in larger than ideal file sizes for gifs (because the original file was being used rather than smaller transforms), it prevents the issues detailed above. Not great, but better than the enormous file sizes we were seeing and the tasks getting stuck!
  
  # Possibilities in Craft 3
  
  Apparently, Craft 3 allows for further image optimisation after transforms, and there's a [plugin](https://github.com/nystudio107/craft3-imageoptimize) that capitalises on this already, so hopefully, we'll see some improvement in Craft 3.
  
  > **Comments:**
  > **username_3**: I ran into pretty much the same issue. My solution was to host all gifs on giphy.com and then just paste the image urls into the cms. Thats far from perfect but this way all optimization is done on far more advanced hardware.  
  
  ---
  
  