Sha256: b6cebb9fa5de6bcaeab346187a852ab5d400fd207969f811283b18cb4679154f

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 KB

Contents

# encoding: utf-8

require 'RMagick'

module Magick
  module Screwdrivers

    # ==============================================================
    # ==     Image preparation     =================================
    # ==============================================================

    def self.img_from_file file
      img = Magick::Image::read(file).first

      # case img.orientation 
      # when Magick::RightTopOrientation
      #   img.rotate!(90)
      # when Magick::BottomRightOrientation
      #   img.rotate!(180)
      # when Magick::LeftBottomOrientation
      #   img.rotate!(-90)
      # end

      img
    end

    # ==============================================================
    # ==     Handy logging     =====================================
    # ==============================================================

    def self.warn logger = nil, msg = nil
      logger.warn(msg) if logger && logger.respond_to?(:warn)
    end
    def self.info logger = nil, msg = nil
      logger.info(msg) if logger && logger.respond_to?(:info)
    end
    def self.debug logger = nil, msg = nil
      logger.debug(msg) if logger && logger.respond_to?(:debug)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rmagick-screwdrivers-0.2.0 lib/rmagick/screwdrivers/helpers.rb
rmagick-screwdrivers-0.1.2 lib/rmagick/screwdrivers/helpers.rb
rmagick-screwdrivers-0.1.1 lib/rmagick/screwdrivers/helpers.rb