module StumpyResize

Defined in:

stumpy_resize.cr
stumpy_resize/bicubic.cr
stumpy_resize/bilinear.cr
stumpy_resize/crop.cr
stumpy_resize/gaussian_blur.cr
stumpy_resize/lanczos.cr
stumpy_resize/nearest_neighbor.cr
stumpy_resize/scale.cr

Constant Summary

DEFAULT_INTERPOLATION_METHOD = InterpolationMethod::Lanczos
VERSION = "1.3.1"

Class Method Summary

Class Method Detail

def self.blur(image : Canvas, radius : Int32) : Canvas #

[View source]
def self.crop(canvas : Canvas, start_x : Int32, start_y : Int32, end_x : Int32, end_y : Int32) : Canvas #

Crop function


[View source]
def self.lanczos_a : Int32 #

adjust this up to improve quality


[View source]
def self.lanczos_a=(lanczos_a : Int32) #

adjust this up to improve quality


[View source]
def self.resize(image : Canvas, new_width : Int32, new_height : Int32, method : InterpolationMethod = DEFAULT_INTERPOLATION_METHOD) : Canvas #

[View source]
def self.resize_bicubic(image : Canvas, new_image : Canvas) : Nil #

Cubic Convolution Algorithm


[View source]
def self.resize_bilinear(image : Canvas, new_image : Canvas) : Nil #

[View source]
def self.resize_lanczos(image : Canvas, new_image : Canvas) : Nil #

[View source]
def self.resize_nearest_neighbor(image : Canvas, new_image : Canvas) : Nil #

[View source]
def self.scale_to_cover(canvas : Canvas, desired_width : Int32, desired_height : Int32, resize_method : InterpolationMethod = DEFAULT_INTERPOLATION_METHOD) : Canvas #

scales the original image so that it covers the desired dimensions while maintaining the original aspect ratio. Then it copies the center part of the resized image onto the new canvas, effectively cropping the image.


[View source]
def self.scale_to_fit(canvas : Canvas, desired_width : Int32, desired_height : Int32, resize_method : InterpolationMethod = DEFAULT_INTERPOLATION_METHOD) : Canvas #

scales the image to fit the desired view port, adding letterboxing or pillarboxing as required


[View source]