class CryMagick::Image

Defined in:

crymagick/image.cr
crymagick/image/info.cr

Constructors

Class Method Summary

Instance Method Summary

Macro Summary

Constructor Detail

def self.new(path : String, tempfile : File? = nil) #

[View source]

Class Method Detail

def self.build(path : String, tempfile = nil, &) #

[View source]
def self.create(ext : String = "", validate : Bool = Configuration.validate_on_create, &) #

Creates tempfile and yields it for writing.


[View source]
def self.import_pixels(blob : Array(Int), columns : Int, rows : Int, depth : Int, map : String | Symbol, format : String = "png") #

[View source]
def self.import_pixels(blob : Slice(Int), columns : Int, rows : Int, depth : Int, map : String | Symbol, format : String = "png") #

[View source]
def self.open(path : String, ext : String? = nil) #

Creates new Image from given path

TODO allow to pass url


[View source]
def self.read(file : String, ext : String = "") #

Reads given string-based file with optional extension.


[View source]
def self.read(file : IO, ext : String = "") #

[View source]

Instance Method Detail

def ==(other : Image) #

[View source]
def [](value) #

[View source]
def collapse!(frame : Int32 = 0) #

[View source]
def colorspace #

[View source]
def combine_options(&) #

[View source]
def composite(other_image, output_ext = type.downcase, mask : String? = nil, &) #

[View source]
def composite(other_image, output_ext = type.downcase, mask : String? = nil) #

[View source]
def data #

[View source]
def destroy! #

[View source]
def details #

[View source]
def dimensions #

[View source]
def exif #

[View source]
def format(_format, page : String | Int = "0", read_options : Hash(String, String) = {} of String => String, &) #

This is used to change the format of the image. That is, from "tiff to jpg" or something like that.

Once you run it, the instance is pointing to a new file with a new extension!

DANGER: This renames the file that the instance is pointing to. So, if you manually opened the file with Image.new(file_path)... Then that file is DELETED! If you used Image.open(file) then you are OK. The original file will still be there. But, any changes to it might not be...

page = -1 for all frames

TODO fix converting several frames - point current image to first one (now it points to empty img)


[View source]
def format(_format, page : String = "0", read_options : Hash(String, String) = {} of String => String) #

[View source]
def frames #

[View source]
def get_pixels #

[View source]
def hash #
Description copied from class Object

Generates an UInt64 hash value for this object.

This method must have the property that a == b implies a.hash == b.hash.

The hash value is used along with #== by the Hash class to determine if two objects reference the same hash key.

Subclasses must not override this method. Instead, they must define hash(hasher), though usually the macro def_hash can be used to generate this method.


[View source]
def height #

[View source]
def human_size #

[View source]
def identify #

[View source]
def identify(&) #

[View source]
def layer? #

[View source]
def layers #

[View source]
def mime_type #

[View source]
def mogrify(page : Int32? = nil) #

[View source]
def mogrify(page : Int32? = nil, &) #

[View source]
def pages #

[View source]
def path : String #

[View source]
def resolution(unit : String = "") #

[View source]
def run_command(tool_name : String, *args) #

[View source]
def signature #

[View source]
def size #

[View source]
def tempfile : File? #

[View source]
def tempfile! #

[View source]
def type #

[View source]
def valid? #

[View source]
def validate! #

[View source]
def width #

[View source]
def write(output_to : String) #

[View source]
def write(output : IO) #

[View source]

Macro Detail

macro attribute(name, key = nil) #

[View source]
macro method_missing(call) #

[View source]