0

Rmagic を使用して複数の画像を gif アニメーションに変換する方法があることは知っていますが、その逆を行いたいと考えています。アニメーション gif をアップロードするときにアニメーションなしにしたいのですが、どうすればいいですか? (画像ストリームからの単一/任意の画像で十分です)

これを、サムネイルの Rmagic リプロセッサを使用して、carrierwaveの一部として使用します。

4

1 に答える 1

0

https://stackoverflow.com/a/13441569/473040から

class DocumentUploader < CarrierWave::Uploader::Base
include CarrierWave::RMagick
#...

    version :thumb do
      process :remove_animation
      process :resize_to_fill => [300,200]

      #....
    end    

    def remove_animation
      # this will keep only first image of animated gif
      manipulate! do |img, index|
      index == 0 ? img : nil
    end

end

thx パデとティアゴ・フランコ

于 2013-04-03T12:56:57.277 に答える