Skip to content
Browse files

When generating thumbnails for animated images, pass the -coalesce

option to convert.
  • Loading branch information...
1 parent ebb1306 commit 67b3790160ef409db59fbf9e108463e8d1947c2f @mcfiredrill mcfiredrill committed with sikachu Jul 8, 2011
Showing with 9 additions and 0 deletions.
  1. +1 −0 lib/paperclip/thumbnail.rb
  2. +8 −0 test/thumbnail_test.rb
View
1 lib/paperclip/thumbnail.rb
@@ -76,6 +76,7 @@ def make
def transformation_command
scale, crop = @current_geometry.transformation_to(@target_geometry, crop?)
trans = []
+ trans << "-coalesce" if animated?
trans << "-resize" << %["#{scale}"] unless scale.nil? || scale.empty?
trans << "-crop" << %["#{crop}"] << "+repage" if crop
trans
View
8 test/thumbnail_test.rb
@@ -289,6 +289,10 @@ class ThumbnailTest < Test::Unit::TestCase
cmd = %Q[identify -format "%wx%h" "#{dst.path}"]
assert_equal "50x50"*12, `#{cmd}`.chomp
end
+
+ should "use the -coalesce option" do
+ assert_equal @thumb.transformation_command.first, "-coalesce"
+ end
end
context "with omitted output format" do
@@ -301,6 +305,10 @@ class ThumbnailTest < Test::Unit::TestCase
cmd = %Q[identify -format "%wx%h" "#{dst.path}"]
assert_equal "50x50"*12, `#{cmd}`.chomp
end
+
+ should "use the -coalesce option" do
+ assert_equal @thumb.transformation_command.first, "-coalesce"
+ end
end
end
end

0 comments on commit 67b3790

Please sign in to comment.
Something went wrong with that request. Please try again.