Commit 67b37901 by Tony Miller Committed by Prem Sichanugrist

When generating thumbnails for animated images, pass the -coalesce

option to convert.
parent ebb13066
...@@ -76,6 +76,7 @@ module Paperclip ...@@ -76,6 +76,7 @@ module Paperclip
def transformation_command def transformation_command
scale, crop = @current_geometry.transformation_to(@target_geometry, crop?) scale, crop = @current_geometry.transformation_to(@target_geometry, crop?)
trans = [] trans = []
trans << "-coalesce" if animated?
trans << "-resize" << %["#{scale}"] unless scale.nil? || scale.empty? trans << "-resize" << %["#{scale}"] unless scale.nil? || scale.empty?
trans << "-crop" << %["#{crop}"] << "+repage" if crop trans << "-crop" << %["#{crop}"] << "+repage" if crop
trans trans
......
...@@ -289,6 +289,10 @@ class ThumbnailTest < Test::Unit::TestCase ...@@ -289,6 +289,10 @@ class ThumbnailTest < Test::Unit::TestCase
cmd = %Q[identify -format "%wx%h" "#{dst.path}"] cmd = %Q[identify -format "%wx%h" "#{dst.path}"]
assert_equal "50x50"*12, `#{cmd}`.chomp assert_equal "50x50"*12, `#{cmd}`.chomp
end end
should "use the -coalesce option" do
assert_equal @thumb.transformation_command.first, "-coalesce"
end
end end
context "with omitted output format" do context "with omitted output format" do
...@@ -301,6 +305,10 @@ class ThumbnailTest < Test::Unit::TestCase ...@@ -301,6 +305,10 @@ class ThumbnailTest < Test::Unit::TestCase
cmd = %Q[identify -format "%wx%h" "#{dst.path}"] cmd = %Q[identify -format "%wx%h" "#{dst.path}"]
assert_equal "50x50"*12, `#{cmd}`.chomp assert_equal "50x50"*12, `#{cmd}`.chomp
end end
should "use the -coalesce option" do
assert_equal @thumb.transformation_command.first, "-coalesce"
end
end end
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment