Rmagic を使用して複数の画像を gif アニメーションに変換する方法があることは知っていますが、その逆を行いたいと考えています。アニメーション gif をアップロードするときにアニメーションなしにしたいのですが、どうすればいいですか? (画像ストリームからの単一/任意の画像で十分です)
これを、サムネイルの Rmagic リプロセッサを使用して、carrierwaveの一部として使用します。
Rmagic を使用して複数の画像を gif アニメーションに変換する方法があることは知っていますが、その逆を行いたいと考えています。アニメーション gif をアップロードするときにアニメーションなしにしたいのですが、どうすればいいですか? (画像ストリームからの単一/任意の画像で十分です)
これを、サムネイルの Rmagic リプロセッサを使用して、carrierwaveの一部として使用します。
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 パデとティアゴ・フランコ