
Aspose.Imaging Cloud SDK for Ruby
Ruby API to Create, Re-size, Rotate, & Convert Images
A Powerful cloud-based Image Processing API that allows Software Developers to Resize, Crop, Manipulate and Convert various Image Formats.
What is Aspose.Imaging Cloud SDK for Ruby?
Aspose.Imaging Cloud SDK for Ruby for Ruby delivers a powerful, cloud-native image processing API that empowers developers to seamlessly manipulate and convert images directly within their Ruby applications. This comprehensive SDK supports a vast array of image file formats—including BMP, JPEG, PNG, GIF, TIFF, PSD, SVG, and WebP—enabling robust workflows like converting images from one format to another. With its extensive suite of operations, programmers can perform essential edits such as resizing images, cropping images, rotating images, and flipping images, alongside applying advanced filters. The integrated optimization techniques intelligently reduce file sizes while preserving visual fidelity, making it an indispensable tool for efficient image processing in Ruby.
As a fully cloud-based API, this solution eliminates the need for local software installation, offering global accessibility and scalable performance. Beyond basic edits, the SDK excels in sophisticated image processing operations such as deskewing an image, appending TIFF images, performing reverse image search, and extracting specific frames from multipage images. It also provides essential functions for getting image properties and saving to other formats. Whether the task is applying a filter to an image or handling complex conversions between formats like JPEG2000 or CMX, Aspose.Imaging Cloud SDK provides a streamlined, feature-rich imaging API for Ruby applications. For developers seeking a reliable, scalable, and comprehensive toolkit to integrate advanced imaging capabilities, this SDK is a premier choice worth serious consideration.
Getting Started with Aspose.Imaging Cloud SDK for Ruby
The recommend way to install Aspose.Imaging Cloud SDK for Ruby is using RubyGems. Please use the following command for a smooth installation.
Install Aspose.Imaging Cloud SDK for Ruby via RubyGems
gem build aspose-imaging-cloud.gemspec You can also download it directly from Aspose product page.Image Resizing & Cropping via Ruby API
Aspose.Imaging Cloud SDK for Ruby has provided complete support for handling image resizing and other related operations inside Ruby applications. The API has included support for cropping images, specifying the position as well as the dimensions of the cropping rectangle, change format of the crop image, update width of the image, modify the height of the image, resize an existing image and save it in another format, and many more. The following example demonstrates how to resize an image using the SDK inside Ruby applications.
How to Resize an Image using the Ruby SDK?
require 'aspose_imaging_cloud'
# Initialize the API client
imaging_api = AsposeImagingCloud::ImagingApi.new
# Set the image file name
name = 'image.png'
# Set the new size
new_width = 200
new_height = 200
# Call the resize_image API method
response = imaging_api.resize_image(name, new_width, new_height)
# Save the resized image
File.write('resized_image.png', response.content)
Images Conversion to Other Formats via Ruby
Aspose.Imaging Cloud SDK for Ruby has included support for a wide range of image formats, such as BMP, JPEG, PNG, GIF, TIFF, PSD, and more. The SDK has included support for loading, viewing and converting some popular image file formats such as BMP, GIF, DJVU, WMF, EMF, JPEG, JPEG2000, PSD, TIFF, WEBP, PNG, DICOM, CDR, CMX, ODG, DNG and SVG. Software developers can also specify the input and output image names, formats, and other parameters such as the input and output folders. Programmers can easily upload an image to the cloud storage and convert it to desired image format in the cloud. Here's a sample code that shows how software developers can convert an image to another format using Ruby Cloud SDK.
How to Convert an Image to Another Format via Ruby API?
require 'aspose_imaging_cloud'
# Configure Aspose.Imaging Cloud API credentials
config = AsposeImagingCloud::Configuration.new
config.client_id = 'Your App SID'
config.client_secret = 'Your App Key'
# Create an instance of the API client
imaging_api = AsposeImagingCloud::ImagingApi.new(config)
# Set the input image name and format
name = 'input.jpg'
format = 'png'
# Set the output image name and format
output_name = 'output.png'
# Convert the input image to the output format
imaging_api.convert_image(AsposeImagingCloud::ConvertImageRequest.new(name, format, output_format: output_format, folder: 'input_folder', out_path: 'output_folder/' + output_name))
puts 'Image converted successfully.'
Apply Filter to an Image via Ruby API
Aspose.Imaging Cloud SDK for Ruby enables software developers to apply filter to an existing image inside Ruby applications. The library has included several important Filter types, such as BigRectangular, SmallRectangular, Median, GaussWiener, MotionWiener, GaussianBlur, Sharpen, BilateralSmoothing and more. In the following example the GaussWiener filter is applied to the image with a radius of 2.0 and smooth of 2.0. The output image format is PNG and the output image will be saved to the "output" folder in the cloud storage.
How to Apply Filter to An Image using Ruby SDK?
filter_type = 'GaussWiener'
filter_properties = {
radius: 2.0,
smooth: 2.0
}
output_format = 'png'
response = imaging_api.apply_filter(
AsposeImagingCloud::ApplyFilterRequest.new(
name: source_image,
filter_type: filter_type,
filter_properties: filter_properties,
format: output_format,
folder: 'output'
)
)
// Download the output image:
output_image = 'output_image.png'
response = imaging_api.download_file(
AsposeImagingCloud::DownloadFileRequest.new(
path: "output/#{output_image}"
)
)
File.open(output_image, 'wb') do |file|
file.write(response)
end
