class Teaas::Parrotify
Constants
- OFFSETS
Public Class Methods
parrotify(original_img)
click to toggle source
Best when used with {Teaas::Turboize.turbo} to generate multiple intense speeds.
@param original_img [Array] An array of [Magick::ImageList]s @return [Magick::ImageList] The parrotified image
# File lib/teaas/parrotify.rb, line 21 def self.parrotify(original_img) parrotify_image = Magick::ImageList.new img = Teaas::Helper.prepare_for_animation(original_img) width = img.columns height = img.rows final_img = Magick::Image.new(width, height) final_img.format = "gif" parrotify_image = Magick::ImageList.new OFFSETS.each do |o| x_coord = width * (1 - o[:x_offset]) y_coord = (height * (1 - o[:y_offset])) + (0.3 * height) parrotify_image << final_img.composite(img, x_coord, y_coord, Magick::OverCompositeOp) end parrotify_image end
parrotify_from_file(path)
click to toggle source
Best when used with {Teaas::Turboize.turbo} to generate multiple intense speeds. Wrapper around {Teaas::Parrotify.parrotify}
@param path [String] Path to the image to be created to an parrotified image @return [Magick::ImageList] The parrotified image
# File lib/teaas/parrotify.rb, line 43 def self.parrotify_from_file(path) img = Magick::Image.read(path) parrotify(img) end