module StumpyResize
Defined in:
stumpy_resize.crstumpy_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
- .blur(image : Canvas, radius : Int32) : Canvas
-
.crop(canvas : Canvas, start_x : Int32, start_y : Int32, end_x : Int32, end_y : Int32) : Canvas
Crop function
-
.lanczos_a : Int32
adjust this up to improve quality
-
.lanczos_a=(lanczos_a : Int32)
adjust this up to improve quality
- .resize(image : Canvas, new_width : Int32, new_height : Int32, method : InterpolationMethod = DEFAULT_INTERPOLATION_METHOD) : Canvas
-
.resize_bicubic(image : Canvas, new_image : Canvas) : Nil
Cubic Convolution Algorithm
- .resize_bilinear(image : Canvas, new_image : Canvas) : Nil
- .resize_lanczos(image : Canvas, new_image : Canvas) : Nil
- .resize_nearest_neighbor(image : Canvas, new_image : Canvas) : Nil
-
.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.
-
.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
Class Method Detail
def self.crop(canvas : Canvas, start_x : Int32, start_y : Int32, end_x : Int32, end_y : Int32) : Canvas
#
Crop function
def self.resize(image : Canvas, new_width : Int32, new_height : Int32, method : InterpolationMethod = DEFAULT_INTERPOLATION_METHOD) : Canvas
#
Cubic Convolution Algorithm
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.
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