Animated gifs resize

141 views
Skip to first unread message

Cyril Lavedrine

unread,
Jul 7, 2009, 5:13:00 AM7/7/09
to Paperclip Plugin
Hello,

First, let me thank you for this wonderful plugin, file upload has
become a breeze since I discovered it ! Second, I'm French, so I'm
sorry if you have trouble understanding what I mean...

I've used paperclip for a few months for my website so that users may
upload pictures in a gallery, and also their avatar. My controller
automatically resizes avatars when they are uploaded (it keeps the
original, a medium size version for user profile and a small one to
show beside their comments). I've had no trouble with it until one of
my friends uploaded an animated gif as his avatar : i noticed the
resized versions were not animated.
Is this issue due to a bad setting of my controller, or is it normal ?
I think Paperclip is able to resize animated gifs, since this topic
<http://groups.google.com/group/paperclip-plugin/browse_thread/thread/
042527c0e5580ac0> is about another problem with animated gifs.

Thank you very much for your help,
Cyril

Jonathan Yurek

unread,
Jul 7, 2009, 10:19:10 AM7/7/09
to papercli...@googlegroups.com
Paperclip is able to resize animated gifs, technically. Because of an
issue with resizing multi-page PDFs, the resizing has been changed to
only work on the first frame/page/etc. If you want to change this you
can remove the "[1]" in the thumbnailer (specifically the calls to
convert and identify). I'm trying to find a good way to reconcile both
of those.
--
Jonathan Yurek, Founder and CTO
thoughtbot, inc.
organic brains. digital solutions.

617.482.1300 x114
http://www.thoughtbot.com/

Cyril Lavedrine

unread,
Jul 7, 2009, 11:11:54 AM7/7/09
to papercli...@googlegroups.com
Thank you very much, I removed the [0] and it worked perfectly.
By the way, I only found one call in the thumbnailer, in the method make.
Since I only use image attachments at the moment, this correction is enough for me, but I'm looking forward to a patch.

Thanks again
Cyril

2009/7/7 Jonathan Yurek <jyu...@thoughtbot.com>

alegscogs

unread,
Jul 7, 2009, 8:58:26 PM7/7/09
to Paperclip Plugin
I have apps using paperclip in different versions on different
machines, in one case running off of a recent gem install and in the
other from an older plugin install in /vendor in the app filesystem.

The solution you offered here seems unnecessary for gem version 2.1.2,
which doesn't have the [0] in 'make', and which animates gifs when
they are being resized. Unfortunately, though, while this works
perfectly for some animated gifs, in some other cases the first frame
is being resized differently than the others, causing a kind of jerk
when the images complete their cycle. This behavior seems to be the
same in gem version 2.1.2 as in the slightly earlier plugin with [0]
removed from the 'make' method: "#{ File.expand_path(src.path) }[0]".

I'm urgently trying to solve this issue. If anyone else has it, or
something similar, would you be so kind as to post it here?

and Jonathan, thanks for the awesomeness.

alegscogs




On Jul 7, 10:19 am, Jonathan Yurek <jyu...@thoughtbot.com> wrote:
> Paperclipis able to resizeanimatedgifs, technically. Because of an  
> issue with resizing multi-page PDFs, the resizing has been changed to  
> only work on the first frame/page/etc. If you want to change this you  
> can remove the "[1]" in the thumbnailer (specifically the calls to  
> convert and identify). I'm trying to find a good way to reconcile both  
> of those.
>
> On Jul 7, 2009, at 5:13 AM, Cyril Lavedrine wrote:
>
>
>
>
>
>
>
> > Hello,
>
> > First, let me thank you for this wonderfulplugin, file upload has
> > become a breeze since I discovered it ! Second, I'm French, so I'm
> > sorry if you have trouble understanding what I mean...
>
> > I've usedpaperclipfor a few months for my website so that users may
> > upload pictures in a gallery, and also their avatar. My controller
> > automatically resizes avatars when they are uploaded (it keeps the
> > original, a medium size version for user profile and a small one to
> > show beside their comments). I've had no trouble with it until one of
> > my friends uploaded ananimatedgifas his avatar : i noticed the
> > resized versions were notanimated.
> > Is this issue due to a bad setting of my controller, or is it normal ?
> > I thinkPaperclipis able to resizeanimatedgifs, since this topic

Jonathan Yurek

unread,
Jul 8, 2009, 9:26:42 AM7/8/09
to papercli...@googlegroups.com
I don't know why the gif would be jerky, as imagemagick should know
how to handle the occasionally odd framing that animated gifs
generate. And, as you said, version 2.1.2 doesn't check first pages,
so it shouldn't be getting just the geometry of the first page. Can
you happen to send me one of the GIFs that do this, along with the
size you're trying to make it?

Also, I would ask the ImageMagick mailing list about this, since it
sounds like an IM-specific problem (http://www.imagemagick.org/script/mailing-list.php
).

nugatowy

unread,
Aug 5, 2009, 1:46:27 PM8/5/09
to Paperclip Plugin
I have used the method described here to force Paperclip to resize
animated gifs. However it works only at my development server, where I
have ImageMagick 6.3.7 version. On my production box it doesn't work
- there is ImageMagick 6.2.4 and I have no root privileges.

Can the older version of IM be the reason of that problem? Or I've
missed something else?

nugatowy

unread,
Aug 6, 2009, 8:06:54 AM8/6/09
to Paperclip Plugin
Little correction to my later post. The gif image I uploaded wasn't
resized, so it was not so weird the image has been displayed properly.
But when I tried to upload the gif with resizing - I got one frame
without animation. Used: Paperclip 2.3 as plugin (with [0] removed)
and ImageMagick 6.5.8.
Reply all
Reply to author
Forward
0 new messages