Skip to content
Junichi Kajiwara edited this page Jul 22, 2016 · 2 revisions

about

detail

GIFの場合、複数枚の画像を意識した処理を行う。

def write(path)
      if path.split('.')[-1] == 'gif'
        # p @frames.length
        if @frames.length > 0
          # 複数のImageからblobを取り出し、これをgifとして保存する。
          blobs = []
          blobs.push(@image.to_blob)
          @frames.each do|imglist|
            blobs.push(imglist.to_blob)
          end
          # p blobs.length
          Mrmagick::Capi.write_gif(path, blobs)
        else
          @image.write(path)
        end
      else
        @image.write(path)
      end
end

関連