Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8493793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:07:11+00:00 2026-06-10T23:07:11+00:00

I’m having issues resizing cinemagraphs. If you don’t know, they are gifs where only

  • 0

I’m having issues resizing cinemagraphs. If you don’t know, they are gifs where only a portion of the image is animated, compared to a regular gif where the entire image is animated. Here is a node.js example:

// ![https://i.stack.imgur.com/fK3xn.gif][1]

var gm = require('gm')

var file = 'Qb1m0.gif',
    frags = file.split('.')

gm(file)
  //.noProfile()
  //.quality(80)
  .resize(200, 200)
  .write(frags[0] + '_200.' + frags[1], function(err) {
    if (err) console.error(err)
  })

// Result:
// ![https://i.stack.imgur.com/tv4Kq.gif][2]

And equivalent cmd line code is:

gm convert Qb1m0.gif -resize 200x200 cinema_200.gif

Know what’s going on?

Original animated GIF:

Original

Resized animated GIF:

Resized

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T23:07:13+00:00Added an answer on June 10, 2026 at 11:07 pm

    I do know ImageMagick better than GraphicsMagick. For ImageMagick the following statements apply:

    • It is next to impossible to directly resize animated GIFs with a simple command line (such as the one you gave), if the GIF contains transparency.

    • It is even difficult to do that if the animated GIF does not contain transparency.

    I assume this is the same for GraphicsMagick, really.

    Background explanation

    If you look at your original GIF with identify, you’ll see that not each frame has the same dimensions:

    identify Qb1m0.gif
     Qb1m0.gif[1]  GIF 720x416 720x416+0+0    8-bit PseudoClass 256c 920KB 0.000u 0:00.009
     Qb1m0.gif[1]  GIF 471x122 720x416+160+75 8-bit PseudoClass 256c 920KB 0.000u 0:00.009
     Qb1m0.gif[2]  GIF 471x121 720x416+160+76 8-bit PseudoClass 256c 920KB 0.000u 0:00.009
     Qb1m0.gif[3]  GIF 471x123 720x416+160+75 8-bit PseudoClass 256c 920KB 0.000u 0:00.009
     Qb1m0.gif[4]  GIF 471x123 720x416+160+75 8-bit PseudoClass 256c 920KB 0.000u 0:00.009
     Qb1m0.gif[5]  GIF 471x123 720x416+160+75 8-bit PseudoClass 256c 920KB 0.000u 0:00.009
     Qb1m0.gif[6]  GIF 471x123 720x416+160+75 8-bit PseudoClass 256c 920KB 0.000u 0:00.009
     Qb1m0.gif[7]  GIF 471x123 720x416+160+75 8-bit PseudoClass 256c 920KB 0.000u 0:00.009
     Qb1m0.gif[8]  GIF 471x122 720x416+160+76 8-bit PseudoClass 256c 920KB 0.000u 0:00.009
     Qb1m0.gif[9]  GIF 471x123 720x416+160+75 8-bit PseudoClass 256c 920KB 0.000u 0:00.009
     Qb1m0.gif[10] GIF 471x123 720x416+160+75 8-bit PseudoClass 256c 920KB 0.000u 0:00.000
     Qb1m0.gif[11] GIF 471x123 720x416+160+75 8-bit PseudoClass 256c 920KB 0.000u 0:00.000
     Qb1m0.gif[12] GIF 471x123 720x416+160+75 8-bit PseudoClass 256c 920KB 0.000u 0:00.000
     Qb1m0.gif[13] GIF 471x122 720x416+160+76 8-bit PseudoClass 256c 920KB 0.000u 0:00.000
     Qb1m0.gif[14] GIF 471x123 720x416+160+75 8-bit PseudoClass 256c 920KB 0.000u 0:00.000
     Qb1m0.gif[15] GIF 471x123 720x416+160+75 8-bit PseudoClass 256c 920KB 0.000u 0:00.000
    

    These variations in the dimensions are the result of frame optimizing the animated GIF has been subjected to in order to reduce file size.

    There are other optimizations at play too, which do reduce the number of colors used. Both these types of optimizations don’t combine well with the -resize operation.

    -resize is designed for single images, and to make the resulting single image look as good as possible. This very often adds new color values to the image. This does contradict what GIF is designed for: using a strictly limited color table (maximum of 256 colors). In an animation sequence, the next image/frame’s -resize may result in a completely different color table than the previous one produced — but for a well working animation you’d need a common color table across all frames.

    -resize handles each and every frame image totally separately from the other images and does not take into account ‘frame optimizations’ (which have the tendency to create a different width+height for each frame that’s placed on the common canvas with its own offset).

    Thus the resized images are far from ideal for saving to the limited GIF file format for single images, let alone for multiple frames of an animated GIF. Heavy color reductions in the resized images are the result.

    Then there is the transparency problem: most animated GIFs do make heavy use of transparency. Transparency is frequently used to even achieve compression optimizations where normally the image’s appearance wouldn’t require transparency at all.

    What happens in this case is this: -resize creates semi-transparent pixels in the overlay images. When the images are saved back to the GIF file format, these pixels are then converted to either full transparency or full opacity: both produce a heavy color distortion for the resulting animation, away from the original color.

    General procedure

    Generally the best procedure to resize animated GIFs is this:

    1. Coalesce (de-optimize) the animation. This will create individual images of equal size for all frames of the animation.

    2. Undergo a complete GIF optimization sequence for the animation: not just for frame optimization, but also for color optimization.

    ‘Simple’ command

    To still try your luck with running a ‘simple’ resize command, you could try this:

    convert                        \
      http://i.imgur.com/Qb1m0.gif \
     -coalesce                     \
     -resize 200x200               \
      cinema_200.gif
    

    Result:

     Result

    This command would work around the frame optimization problems. It would correct problems resulting from this, at the cost of increased file size.

    However, it may still display ‘staircase’ artifacts when it comes to edges, because the resized frames will be horribly aliased. This is because anti-aliasing would require semi-transparent colors around the edges, but GIF cannot save the semi-transparent colors generated by the -resize operator.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I know there's a lot of other questions out there that deal with this
I don't have much knowledge about the IPv6 protocol, so sorry if the question
Does anyone know how can I replace this 2 symbol below from the string
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I am using Paperclip to handle profile photo uploads in my app. They upload

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.