Skip to content

Instantly share code, notes, and snippets.

@aspose-imaging-cloud-examples
Last active June 22, 2022 14:08

Aspose.Imaging.Cloud Ruby API to easy update (resize, crop, rotate&flip) your images or photos in your Ruby application or Web service.

You can:

  • update raster images;
  • update multi-page images;
  • update vector images.

Interested ?

You may go further at : https://products.aspose.cloud/imaging/ruby/

require 'fileutils'
require 'aspose-imaging-cloud'
IMAGE_FILE_NAME= 'example_image.apng';
IMAGES_FOLDER = 'ExampleImages';
CLOUD_FOLDER = 'CloudImages';
OUTPUT_FOLDER = 'Output';
# Get ClientId and ClientSecret from https://dashboard.aspose.cloud/
# or use on-premise version (https://docs.aspose.cloud/imaging/getting-started/how-to-run-docker-container/)
imaging_api = AsposeImagingCloud::ImagingApi.new(client_secret, client_id, 'https://api.aspose.cloud')
# Update an image from cloud storage
def update_image_from_storage
input_image = File.join(IMAGES_FOLDER, IMAGE_FILE_NAME)
upload_file_request = AsposeImagingCloud::UploadFileRequest.new(File.join(CLOUD_FOLDER, IMAGE_FILE_NAME), input_image)
result = self.imaging_api.upload_file(upload_file_request)
if result.errors.any?
puts('Uploading errors count: ' + result.errors.size.to_s)
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'apng' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
folder = CLOUD_FOLDER # Input file is saved at the desired folder in the storage
storage = nil # We are using default Cloud Storage
request = AsposeImagingCloud::UpdateImageRequest.new(
IMAGE_FILE_NAME, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, folder, storage)
updated_image = imaging_api.update_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'apng'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
# Update an image. Image data is passed in a request stream
def create_updated_image_from_request
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'apng' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
storage = nil # We are using default Cloud Storage
out_path = nil # Path to updated file (if this is empty, response contains streamed image)
input_stream = File.open(File.join(IMAGES_FOLDER, IMAGE_FILE_NAME), 'r')
request = AsposeImagingCloud::CreateUpdatedImageRequest.new(
input_stream, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, out_path, storage)
updated_image = imaging_api.create_updated_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'apng'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
require 'fileutils'
require 'aspose-imaging-cloud'
IMAGE_FILE_NAME= 'example_image.bmp';
IMAGES_FOLDER = 'ExampleImages';
CLOUD_FOLDER = 'CloudImages';
OUTPUT_FOLDER = 'Output';
# Get ClientId and ClientSecret from https://dashboard.aspose.cloud/
# or use on-premise version (https://docs.aspose.cloud/imaging/getting-started/how-to-run-docker-container/)
imaging_api = AsposeImagingCloud::ImagingApi.new(client_secret, client_id, 'https://api.aspose.cloud')
# Update an image from cloud storage
def update_image_from_storage
input_image = File.join(IMAGES_FOLDER, IMAGE_FILE_NAME)
upload_file_request = AsposeImagingCloud::UploadFileRequest.new(File.join(CLOUD_FOLDER, IMAGE_FILE_NAME), input_image)
result = self.imaging_api.upload_file(upload_file_request)
if result.errors.any?
puts('Uploading errors count: ' + result.errors.size.to_s)
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'bmp' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
folder = CLOUD_FOLDER # Input file is saved at the desired folder in the storage
storage = nil # We are using default Cloud Storage
request = AsposeImagingCloud::UpdateImageRequest.new(
IMAGE_FILE_NAME, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, folder, storage)
updated_image = imaging_api.update_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'bmp'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
# Update an image. Image data is passed in a request stream
def create_updated_image_from_request
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'bmp' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
storage = nil # We are using default Cloud Storage
out_path = nil # Path to updated file (if this is empty, response contains streamed image)
input_stream = File.open(File.join(IMAGES_FOLDER, IMAGE_FILE_NAME), 'r')
request = AsposeImagingCloud::CreateUpdatedImageRequest.new(
input_stream, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, out_path, storage)
updated_image = imaging_api.create_updated_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'bmp'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
require 'fileutils'
require 'aspose-imaging-cloud'
IMAGE_FILE_NAME= 'example_image.cdr';
IMAGES_FOLDER = 'ExampleImages';
CLOUD_FOLDER = 'CloudImages';
OUTPUT_FOLDER = 'Output';
# Get ClientId and ClientSecret from https://dashboard.aspose.cloud/
# or use on-premise version (https://docs.aspose.cloud/imaging/getting-started/how-to-run-docker-container/)
imaging_api = AsposeImagingCloud::ImagingApi.new(client_secret, client_id, 'https://api.aspose.cloud')
# Update an image from cloud storage
def update_image_from_storage
input_image = File.join(IMAGES_FOLDER, IMAGE_FILE_NAME)
upload_file_request = AsposeImagingCloud::UploadFileRequest.new(File.join(CLOUD_FOLDER, IMAGE_FILE_NAME), input_image)
result = self.imaging_api.upload_file(upload_file_request)
if result.errors.any?
puts('Uploading errors count: ' + result.errors.size.to_s)
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'jpg' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
folder = CLOUD_FOLDER # Input file is saved at the desired folder in the storage
storage = nil # We are using default Cloud Storage
request = AsposeImagingCloud::UpdateImageRequest.new(
IMAGE_FILE_NAME, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, folder, storage)
updated_image = imaging_api.update_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'jpg'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
# Update an image. Image data is passed in a request stream
def create_updated_image_from_request
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'jpg' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
storage = nil # We are using default Cloud Storage
out_path = nil # Path to updated file (if this is empty, response contains streamed image)
input_stream = File.open(File.join(IMAGES_FOLDER, IMAGE_FILE_NAME), 'r')
request = AsposeImagingCloud::CreateUpdatedImageRequest.new(
input_stream, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, out_path, storage)
updated_image = imaging_api.create_updated_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'jpg'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
require 'fileutils'
require 'aspose-imaging-cloud'
IMAGE_FILE_NAME= 'example_image.cmx';
IMAGES_FOLDER = 'ExampleImages';
CLOUD_FOLDER = 'CloudImages';
OUTPUT_FOLDER = 'Output';
# Get ClientId and ClientSecret from https://dashboard.aspose.cloud/
# or use on-premise version (https://docs.aspose.cloud/imaging/getting-started/how-to-run-docker-container/)
imaging_api = AsposeImagingCloud::ImagingApi.new(client_secret, client_id, 'https://api.aspose.cloud')
# Update an image from cloud storage
def update_image_from_storage
input_image = File.join(IMAGES_FOLDER, IMAGE_FILE_NAME)
upload_file_request = AsposeImagingCloud::UploadFileRequest.new(File.join(CLOUD_FOLDER, IMAGE_FILE_NAME), input_image)
result = self.imaging_api.upload_file(upload_file_request)
if result.errors.any?
puts('Uploading errors count: ' + result.errors.size.to_s)
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'webp' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
folder = CLOUD_FOLDER # Input file is saved at the desired folder in the storage
storage = nil # We are using default Cloud Storage
request = AsposeImagingCloud::UpdateImageRequest.new(
IMAGE_FILE_NAME, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, folder, storage)
updated_image = imaging_api.update_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'webp'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
# Update an image. Image data is passed in a request stream
def create_updated_image_from_request
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'webp' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
storage = nil # We are using default Cloud Storage
out_path = nil # Path to updated file (if this is empty, response contains streamed image)
input_stream = File.open(File.join(IMAGES_FOLDER, IMAGE_FILE_NAME), 'r')
request = AsposeImagingCloud::CreateUpdatedImageRequest.new(
input_stream, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, out_path, storage)
updated_image = imaging_api.create_updated_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'webp'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
require 'fileutils'
require 'aspose-imaging-cloud'
IMAGE_FILE_NAME= 'example_image.dicom';
IMAGES_FOLDER = 'ExampleImages';
CLOUD_FOLDER = 'CloudImages';
OUTPUT_FOLDER = 'Output';
# Get ClientId and ClientSecret from https://dashboard.aspose.cloud/
# or use on-premise version (https://docs.aspose.cloud/imaging/getting-started/how-to-run-docker-container/)
imaging_api = AsposeImagingCloud::ImagingApi.new(client_secret, client_id, 'https://api.aspose.cloud')
# Update an image from cloud storage
def update_image_from_storage
input_image = File.join(IMAGES_FOLDER, IMAGE_FILE_NAME)
upload_file_request = AsposeImagingCloud::UploadFileRequest.new(File.join(CLOUD_FOLDER, IMAGE_FILE_NAME), input_image)
result = self.imaging_api.upload_file(upload_file_request)
if result.errors.any?
puts('Uploading errors count: ' + result.errors.size.to_s)
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'pdf' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
folder = CLOUD_FOLDER # Input file is saved at the desired folder in the storage
storage = nil # We are using default Cloud Storage
request = AsposeImagingCloud::UpdateImageRequest.new(
IMAGE_FILE_NAME, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, folder, storage)
updated_image = imaging_api.update_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'pdf'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
# Update an image. Image data is passed in a request stream
def create_updated_image_from_request
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'pdf' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
storage = nil # We are using default Cloud Storage
out_path = nil # Path to updated file (if this is empty, response contains streamed image)
input_stream = File.open(File.join(IMAGES_FOLDER, IMAGE_FILE_NAME), 'r')
request = AsposeImagingCloud::CreateUpdatedImageRequest.new(
input_stream, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, out_path, storage)
updated_image = imaging_api.create_updated_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'pdf'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
require 'fileutils'
require 'aspose-imaging-cloud'
IMAGE_FILE_NAME= 'example_image.djvu';
IMAGES_FOLDER = 'ExampleImages';
CLOUD_FOLDER = 'CloudImages';
OUTPUT_FOLDER = 'Output';
# Get ClientId and ClientSecret from https://dashboard.aspose.cloud/
# or use on-premise version (https://docs.aspose.cloud/imaging/getting-started/how-to-run-docker-container/)
imaging_api = AsposeImagingCloud::ImagingApi.new(client_secret, client_id, 'https://api.aspose.cloud')
# Update an image from cloud storage
def update_image_from_storage
input_image = File.join(IMAGES_FOLDER, IMAGE_FILE_NAME)
upload_file_request = AsposeImagingCloud::UploadFileRequest.new(File.join(CLOUD_FOLDER, IMAGE_FILE_NAME), input_image)
result = self.imaging_api.upload_file(upload_file_request)
if result.errors.any?
puts('Uploading errors count: ' + result.errors.size.to_s)
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'tiff' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
folder = CLOUD_FOLDER # Input file is saved at the desired folder in the storage
storage = nil # We are using default Cloud Storage
request = AsposeImagingCloud::UpdateImageRequest.new(
IMAGE_FILE_NAME, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, folder, storage)
updated_image = imaging_api.update_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'tiff'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
# Update an image. Image data is passed in a request stream
def create_updated_image_from_request
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'tiff' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
storage = nil # We are using default Cloud Storage
out_path = nil # Path to updated file (if this is empty, response contains streamed image)
input_stream = File.open(File.join(IMAGES_FOLDER, IMAGE_FILE_NAME), 'r')
request = AsposeImagingCloud::CreateUpdatedImageRequest.new(
input_stream, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, out_path, storage)
updated_image = imaging_api.create_updated_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'tiff'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
require 'fileutils'
require 'aspose-imaging-cloud'
IMAGE_FILE_NAME= 'example_image.dng';
IMAGES_FOLDER = 'ExampleImages';
CLOUD_FOLDER = 'CloudImages';
OUTPUT_FOLDER = 'Output';
# Get ClientId and ClientSecret from https://dashboard.aspose.cloud/
# or use on-premise version (https://docs.aspose.cloud/imaging/getting-started/how-to-run-docker-container/)
imaging_api = AsposeImagingCloud::ImagingApi.new(client_secret, client_id, 'https://api.aspose.cloud')
# Update an image from cloud storage
def update_image_from_storage
input_image = File.join(IMAGES_FOLDER, IMAGE_FILE_NAME)
upload_file_request = AsposeImagingCloud::UploadFileRequest.new(File.join(CLOUD_FOLDER, IMAGE_FILE_NAME), input_image)
result = self.imaging_api.upload_file(upload_file_request)
if result.errors.any?
puts('Uploading errors count: ' + result.errors.size.to_s)
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'png' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
folder = CLOUD_FOLDER # Input file is saved at the desired folder in the storage
storage = nil # We are using default Cloud Storage
request = AsposeImagingCloud::UpdateImageRequest.new(
IMAGE_FILE_NAME, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, folder, storage)
updated_image = imaging_api.update_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'png'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
# Update an image. Image data is passed in a request stream
def create_updated_image_from_request
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'png' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
storage = nil # We are using default Cloud Storage
out_path = nil # Path to updated file (if this is empty, response contains streamed image)
input_stream = File.open(File.join(IMAGES_FOLDER, IMAGE_FILE_NAME), 'r')
request = AsposeImagingCloud::CreateUpdatedImageRequest.new(
input_stream, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, out_path, storage)
updated_image = imaging_api.create_updated_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'png'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
require 'fileutils'
require 'aspose-imaging-cloud'
IMAGE_FILE_NAME= 'example_image.emf';
IMAGES_FOLDER = 'ExampleImages';
CLOUD_FOLDER = 'CloudImages';
OUTPUT_FOLDER = 'Output';
# Get ClientId and ClientSecret from https://dashboard.aspose.cloud/
# or use on-premise version (https://docs.aspose.cloud/imaging/getting-started/how-to-run-docker-container/)
imaging_api = AsposeImagingCloud::ImagingApi.new(client_secret, client_id, 'https://api.aspose.cloud')
# Update an image from cloud storage
def update_image_from_storage
input_image = File.join(IMAGES_FOLDER, IMAGE_FILE_NAME)
upload_file_request = AsposeImagingCloud::UploadFileRequest.new(File.join(CLOUD_FOLDER, IMAGE_FILE_NAME), input_image)
result = self.imaging_api.upload_file(upload_file_request)
if result.errors.any?
puts('Uploading errors count: ' + result.errors.size.to_s)
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'png' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
folder = CLOUD_FOLDER # Input file is saved at the desired folder in the storage
storage = nil # We are using default Cloud Storage
request = AsposeImagingCloud::UpdateImageRequest.new(
IMAGE_FILE_NAME, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, folder, storage)
updated_image = imaging_api.update_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'png'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
# Update an image. Image data is passed in a request stream
def create_updated_image_from_request
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'png' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
storage = nil # We are using default Cloud Storage
out_path = nil # Path to updated file (if this is empty, response contains streamed image)
input_stream = File.open(File.join(IMAGES_FOLDER, IMAGE_FILE_NAME), 'r')
request = AsposeImagingCloud::CreateUpdatedImageRequest.new(
input_stream, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, out_path, storage)
updated_image = imaging_api.create_updated_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'png'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
require 'fileutils'
require 'aspose-imaging-cloud'
IMAGE_FILE_NAME= 'example_image.eps';
IMAGES_FOLDER = 'ExampleImages';
CLOUD_FOLDER = 'CloudImages';
OUTPUT_FOLDER = 'Output';
# Get ClientId and ClientSecret from https://dashboard.aspose.cloud/
# or use on-premise version (https://docs.aspose.cloud/imaging/getting-started/how-to-run-docker-container/)
imaging_api = AsposeImagingCloud::ImagingApi.new(client_secret, client_id, 'https://api.aspose.cloud')
# Update an image from cloud storage
def update_image_from_storage
input_image = File.join(IMAGES_FOLDER, IMAGE_FILE_NAME)
upload_file_request = AsposeImagingCloud::UploadFileRequest.new(File.join(CLOUD_FOLDER, IMAGE_FILE_NAME), input_image)
result = self.imaging_api.upload_file(upload_file_request)
if result.errors.any?
puts('Uploading errors count: ' + result.errors.size.to_s)
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'bmp' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
folder = CLOUD_FOLDER # Input file is saved at the desired folder in the storage
storage = nil # We are using default Cloud Storage
request = AsposeImagingCloud::UpdateImageRequest.new(
IMAGE_FILE_NAME, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, folder, storage)
updated_image = imaging_api.update_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'bmp'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
# Update an image. Image data is passed in a request stream
def create_updated_image_from_request
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'bmp' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
storage = nil # We are using default Cloud Storage
out_path = nil # Path to updated file (if this is empty, response contains streamed image)
input_stream = File.open(File.join(IMAGES_FOLDER, IMAGE_FILE_NAME), 'r')
request = AsposeImagingCloud::CreateUpdatedImageRequest.new(
input_stream, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, out_path, storage)
updated_image = imaging_api.create_updated_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'bmp'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
require 'fileutils'
require 'aspose-imaging-cloud'
IMAGE_FILE_NAME= 'example_image.gif';
IMAGES_FOLDER = 'ExampleImages';
CLOUD_FOLDER = 'CloudImages';
OUTPUT_FOLDER = 'Output';
# Get ClientId and ClientSecret from https://dashboard.aspose.cloud/
# or use on-premise version (https://docs.aspose.cloud/imaging/getting-started/how-to-run-docker-container/)
imaging_api = AsposeImagingCloud::ImagingApi.new(client_secret, client_id, 'https://api.aspose.cloud')
# Update an image from cloud storage
def update_image_from_storage
input_image = File.join(IMAGES_FOLDER, IMAGE_FILE_NAME)
upload_file_request = AsposeImagingCloud::UploadFileRequest.new(File.join(CLOUD_FOLDER, IMAGE_FILE_NAME), input_image)
result = self.imaging_api.upload_file(upload_file_request)
if result.errors.any?
puts('Uploading errors count: ' + result.errors.size.to_s)
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'gif' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
folder = CLOUD_FOLDER # Input file is saved at the desired folder in the storage
storage = nil # We are using default Cloud Storage
request = AsposeImagingCloud::UpdateImageRequest.new(
IMAGE_FILE_NAME, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, folder, storage)
updated_image = imaging_api.update_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'gif'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
# Update an image. Image data is passed in a request stream
def create_updated_image_from_request
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'gif' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
storage = nil # We are using default Cloud Storage
out_path = nil # Path to updated file (if this is empty, response contains streamed image)
input_stream = File.open(File.join(IMAGES_FOLDER, IMAGE_FILE_NAME), 'r')
request = AsposeImagingCloud::CreateUpdatedImageRequest.new(
input_stream, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, out_path, storage)
updated_image = imaging_api.create_updated_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'gif'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
require 'fileutils'
require 'aspose-imaging-cloud'
IMAGE_FILE_NAME= 'example_image.jpeg';
IMAGES_FOLDER = 'ExampleImages';
CLOUD_FOLDER = 'CloudImages';
OUTPUT_FOLDER = 'Output';
# Get ClientId and ClientSecret from https://dashboard.aspose.cloud/
# or use on-premise version (https://docs.aspose.cloud/imaging/getting-started/how-to-run-docker-container/)
imaging_api = AsposeImagingCloud::ImagingApi.new(client_secret, client_id, 'https://api.aspose.cloud')
# Update an image from cloud storage
def update_image_from_storage
input_image = File.join(IMAGES_FOLDER, IMAGE_FILE_NAME)
upload_file_request = AsposeImagingCloud::UploadFileRequest.new(File.join(CLOUD_FOLDER, IMAGE_FILE_NAME), input_image)
result = self.imaging_api.upload_file(upload_file_request)
if result.errors.any?
puts('Uploading errors count: ' + result.errors.size.to_s)
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'jpeg' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
folder = CLOUD_FOLDER # Input file is saved at the desired folder in the storage
storage = nil # We are using default Cloud Storage
request = AsposeImagingCloud::UpdateImageRequest.new(
IMAGE_FILE_NAME, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, folder, storage)
updated_image = imaging_api.update_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'jpeg'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
# Update an image. Image data is passed in a request stream
def create_updated_image_from_request
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'jpeg' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
storage = nil # We are using default Cloud Storage
out_path = nil # Path to updated file (if this is empty, response contains streamed image)
input_stream = File.open(File.join(IMAGES_FOLDER, IMAGE_FILE_NAME), 'r')
request = AsposeImagingCloud::CreateUpdatedImageRequest.new(
input_stream, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, out_path, storage)
updated_image = imaging_api.create_updated_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'jpeg'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
require 'fileutils'
require 'aspose-imaging-cloud'
IMAGE_FILE_NAME= 'example_image.jpeg2000';
IMAGES_FOLDER = 'ExampleImages';
CLOUD_FOLDER = 'CloudImages';
OUTPUT_FOLDER = 'Output';
# Get ClientId and ClientSecret from https://dashboard.aspose.cloud/
# or use on-premise version (https://docs.aspose.cloud/imaging/getting-started/how-to-run-docker-container/)
imaging_api = AsposeImagingCloud::ImagingApi.new(client_secret, client_id, 'https://api.aspose.cloud')
# Update an image from cloud storage
def update_image_from_storage
input_image = File.join(IMAGES_FOLDER, IMAGE_FILE_NAME)
upload_file_request = AsposeImagingCloud::UploadFileRequest.new(File.join(CLOUD_FOLDER, IMAGE_FILE_NAME), input_image)
result = self.imaging_api.upload_file(upload_file_request)
if result.errors.any?
puts('Uploading errors count: ' + result.errors.size.to_s)
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'jpeg2000' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
folder = CLOUD_FOLDER # Input file is saved at the desired folder in the storage
storage = nil # We are using default Cloud Storage
request = AsposeImagingCloud::UpdateImageRequest.new(
IMAGE_FILE_NAME, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, folder, storage)
updated_image = imaging_api.update_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'jpeg2000'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
# Update an image. Image data is passed in a request stream
def create_updated_image_from_request
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'jpeg2000' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
storage = nil # We are using default Cloud Storage
out_path = nil # Path to updated file (if this is empty, response contains streamed image)
input_stream = File.open(File.join(IMAGES_FOLDER, IMAGE_FILE_NAME), 'r')
request = AsposeImagingCloud::CreateUpdatedImageRequest.new(
input_stream, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, out_path, storage)
updated_image = imaging_api.create_updated_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'jpeg2000'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
require 'fileutils'
require 'aspose-imaging-cloud'
IMAGE_FILE_NAME= 'example_image.odg';
IMAGES_FOLDER = 'ExampleImages';
CLOUD_FOLDER = 'CloudImages';
OUTPUT_FOLDER = 'Output';
# Get ClientId and ClientSecret from https://dashboard.aspose.cloud/
# or use on-premise version (https://docs.aspose.cloud/imaging/getting-started/how-to-run-docker-container/)
imaging_api = AsposeImagingCloud::ImagingApi.new(client_secret, client_id, 'https://api.aspose.cloud')
# Update an image from cloud storage
def update_image_from_storage
input_image = File.join(IMAGES_FOLDER, IMAGE_FILE_NAME)
upload_file_request = AsposeImagingCloud::UploadFileRequest.new(File.join(CLOUD_FOLDER, IMAGE_FILE_NAME), input_image)
result = self.imaging_api.upload_file(upload_file_request)
if result.errors.any?
puts('Uploading errors count: ' + result.errors.size.to_s)
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'gif' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
folder = CLOUD_FOLDER # Input file is saved at the desired folder in the storage
storage = nil # We are using default Cloud Storage
request = AsposeImagingCloud::UpdateImageRequest.new(
IMAGE_FILE_NAME, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, folder, storage)
updated_image = imaging_api.update_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'gif'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
# Update an image. Image data is passed in a request stream
def create_updated_image_from_request
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'gif' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
storage = nil # We are using default Cloud Storage
out_path = nil # Path to updated file (if this is empty, response contains streamed image)
input_stream = File.open(File.join(IMAGES_FOLDER, IMAGE_FILE_NAME), 'r')
request = AsposeImagingCloud::CreateUpdatedImageRequest.new(
input_stream, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, out_path, storage)
updated_image = imaging_api.create_updated_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'gif'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
require 'fileutils'
require 'aspose-imaging-cloud'
IMAGE_FILE_NAME= 'example_image.otg';
IMAGES_FOLDER = 'ExampleImages';
CLOUD_FOLDER = 'CloudImages';
OUTPUT_FOLDER = 'Output';
# Get ClientId and ClientSecret from https://dashboard.aspose.cloud/
# or use on-premise version (https://docs.aspose.cloud/imaging/getting-started/how-to-run-docker-container/)
imaging_api = AsposeImagingCloud::ImagingApi.new(client_secret, client_id, 'https://api.aspose.cloud')
# Update an image from cloud storage
def update_image_from_storage
input_image = File.join(IMAGES_FOLDER, IMAGE_FILE_NAME)
upload_file_request = AsposeImagingCloud::UploadFileRequest.new(File.join(CLOUD_FOLDER, IMAGE_FILE_NAME), input_image)
result = self.imaging_api.upload_file(upload_file_request)
if result.errors.any?
puts('Uploading errors count: ' + result.errors.size.to_s)
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'tiff' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
folder = CLOUD_FOLDER # Input file is saved at the desired folder in the storage
storage = nil # We are using default Cloud Storage
request = AsposeImagingCloud::UpdateImageRequest.new(
IMAGE_FILE_NAME, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, folder, storage)
updated_image = imaging_api.update_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'tiff'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
# Update an image. Image data is passed in a request stream
def create_updated_image_from_request
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'tiff' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
storage = nil # We are using default Cloud Storage
out_path = nil # Path to updated file (if this is empty, response contains streamed image)
input_stream = File.open(File.join(IMAGES_FOLDER, IMAGE_FILE_NAME), 'r')
request = AsposeImagingCloud::CreateUpdatedImageRequest.new(
input_stream, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, out_path, storage)
updated_image = imaging_api.create_updated_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'tiff'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
require 'fileutils'
require 'aspose-imaging-cloud'
IMAGE_FILE_NAME= 'example_image.png';
IMAGES_FOLDER = 'ExampleImages';
CLOUD_FOLDER = 'CloudImages';
OUTPUT_FOLDER = 'Output';
# Get ClientId and ClientSecret from https://dashboard.aspose.cloud/
# or use on-premise version (https://docs.aspose.cloud/imaging/getting-started/how-to-run-docker-container/)
imaging_api = AsposeImagingCloud::ImagingApi.new(client_secret, client_id, 'https://api.aspose.cloud')
# Update an image from cloud storage
def update_image_from_storage
input_image = File.join(IMAGES_FOLDER, IMAGE_FILE_NAME)
upload_file_request = AsposeImagingCloud::UploadFileRequest.new(File.join(CLOUD_FOLDER, IMAGE_FILE_NAME), input_image)
result = self.imaging_api.upload_file(upload_file_request)
if result.errors.any?
puts('Uploading errors count: ' + result.errors.size.to_s)
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'png' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
folder = CLOUD_FOLDER # Input file is saved at the desired folder in the storage
storage = nil # We are using default Cloud Storage
request = AsposeImagingCloud::UpdateImageRequest.new(
IMAGE_FILE_NAME, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, folder, storage)
updated_image = imaging_api.update_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'png'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
# Update an image. Image data is passed in a request stream
def create_updated_image_from_request
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'png' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
storage = nil # We are using default Cloud Storage
out_path = nil # Path to updated file (if this is empty, response contains streamed image)
input_stream = File.open(File.join(IMAGES_FOLDER, IMAGE_FILE_NAME), 'r')
request = AsposeImagingCloud::CreateUpdatedImageRequest.new(
input_stream, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, out_path, storage)
updated_image = imaging_api.create_updated_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'png'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
require 'fileutils'
require 'aspose-imaging-cloud'
IMAGE_FILE_NAME= 'example_image.psd';
IMAGES_FOLDER = 'ExampleImages';
CLOUD_FOLDER = 'CloudImages';
OUTPUT_FOLDER = 'Output';
# Get ClientId and ClientSecret from https://dashboard.aspose.cloud/
# or use on-premise version (https://docs.aspose.cloud/imaging/getting-started/how-to-run-docker-container/)
imaging_api = AsposeImagingCloud::ImagingApi.new(client_secret, client_id, 'https://api.aspose.cloud')
# Update an image from cloud storage
def update_image_from_storage
input_image = File.join(IMAGES_FOLDER, IMAGE_FILE_NAME)
upload_file_request = AsposeImagingCloud::UploadFileRequest.new(File.join(CLOUD_FOLDER, IMAGE_FILE_NAME), input_image)
result = self.imaging_api.upload_file(upload_file_request)
if result.errors.any?
puts('Uploading errors count: ' + result.errors.size.to_s)
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'psd' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
folder = CLOUD_FOLDER # Input file is saved at the desired folder in the storage
storage = nil # We are using default Cloud Storage
request = AsposeImagingCloud::UpdateImageRequest.new(
IMAGE_FILE_NAME, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, folder, storage)
updated_image = imaging_api.update_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'psd'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
# Update an image. Image data is passed in a request stream
def create_updated_image_from_request
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'psd' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
storage = nil # We are using default Cloud Storage
out_path = nil # Path to updated file (if this is empty, response contains streamed image)
input_stream = File.open(File.join(IMAGES_FOLDER, IMAGE_FILE_NAME), 'r')
request = AsposeImagingCloud::CreateUpdatedImageRequest.new(
input_stream, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, out_path, storage)
updated_image = imaging_api.create_updated_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'psd'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
require 'fileutils'
require 'aspose-imaging-cloud'
IMAGE_FILE_NAME= 'example_image.svg';
IMAGES_FOLDER = 'ExampleImages';
CLOUD_FOLDER = 'CloudImages';
OUTPUT_FOLDER = 'Output';
# Get ClientId and ClientSecret from https://dashboard.aspose.cloud/
# or use on-premise version (https://docs.aspose.cloud/imaging/getting-started/how-to-run-docker-container/)
imaging_api = AsposeImagingCloud::ImagingApi.new(client_secret, client_id, 'https://api.aspose.cloud')
# Update an image from cloud storage
def update_image_from_storage
input_image = File.join(IMAGES_FOLDER, IMAGE_FILE_NAME)
upload_file_request = AsposeImagingCloud::UploadFileRequest.new(File.join(CLOUD_FOLDER, IMAGE_FILE_NAME), input_image)
result = self.imaging_api.upload_file(upload_file_request)
if result.errors.any?
puts('Uploading errors count: ' + result.errors.size.to_s)
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'apng' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
folder = CLOUD_FOLDER # Input file is saved at the desired folder in the storage
storage = nil # We are using default Cloud Storage
request = AsposeImagingCloud::UpdateImageRequest.new(
IMAGE_FILE_NAME, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, folder, storage)
updated_image = imaging_api.update_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'apng'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
# Update an image. Image data is passed in a request stream
def create_updated_image_from_request
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'apng' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
storage = nil # We are using default Cloud Storage
out_path = nil # Path to updated file (if this is empty, response contains streamed image)
input_stream = File.open(File.join(IMAGES_FOLDER, IMAGE_FILE_NAME), 'r')
request = AsposeImagingCloud::CreateUpdatedImageRequest.new(
input_stream, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, out_path, storage)
updated_image = imaging_api.create_updated_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'apng'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
require 'fileutils'
require 'aspose-imaging-cloud'
IMAGE_FILE_NAME= 'example_image.tga';
IMAGES_FOLDER = 'ExampleImages';
CLOUD_FOLDER = 'CloudImages';
OUTPUT_FOLDER = 'Output';
# Get ClientId and ClientSecret from https://dashboard.aspose.cloud/
# or use on-premise version (https://docs.aspose.cloud/imaging/getting-started/how-to-run-docker-container/)
imaging_api = AsposeImagingCloud::ImagingApi.new(client_secret, client_id, 'https://api.aspose.cloud')
# Update an image from cloud storage
def update_image_from_storage
input_image = File.join(IMAGES_FOLDER, IMAGE_FILE_NAME)
upload_file_request = AsposeImagingCloud::UploadFileRequest.new(File.join(CLOUD_FOLDER, IMAGE_FILE_NAME), input_image)
result = self.imaging_api.upload_file(upload_file_request)
if result.errors.any?
puts('Uploading errors count: ' + result.errors.size.to_s)
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'tga' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
folder = CLOUD_FOLDER # Input file is saved at the desired folder in the storage
storage = nil # We are using default Cloud Storage
request = AsposeImagingCloud::UpdateImageRequest.new(
IMAGE_FILE_NAME, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, folder, storage)
updated_image = imaging_api.update_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'tga'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
# Update an image. Image data is passed in a request stream
def create_updated_image_from_request
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'tga' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
storage = nil # We are using default Cloud Storage
out_path = nil # Path to updated file (if this is empty, response contains streamed image)
input_stream = File.open(File.join(IMAGES_FOLDER, IMAGE_FILE_NAME), 'r')
request = AsposeImagingCloud::CreateUpdatedImageRequest.new(
input_stream, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, out_path, storage)
updated_image = imaging_api.create_updated_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'tga'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
require 'fileutils'
require 'aspose-imaging-cloud'
IMAGE_FILE_NAME= 'example_image.tiff';
IMAGES_FOLDER = 'ExampleImages';
CLOUD_FOLDER = 'CloudImages';
OUTPUT_FOLDER = 'Output';
# Get ClientId and ClientSecret from https://dashboard.aspose.cloud/
# or use on-premise version (https://docs.aspose.cloud/imaging/getting-started/how-to-run-docker-container/)
imaging_api = AsposeImagingCloud::ImagingApi.new(client_secret, client_id, 'https://api.aspose.cloud')
# Update an image from cloud storage
def update_image_from_storage
input_image = File.join(IMAGES_FOLDER, IMAGE_FILE_NAME)
upload_file_request = AsposeImagingCloud::UploadFileRequest.new(File.join(CLOUD_FOLDER, IMAGE_FILE_NAME), input_image)
result = self.imaging_api.upload_file(upload_file_request)
if result.errors.any?
puts('Uploading errors count: ' + result.errors.size.to_s)
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'tiff' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
folder = CLOUD_FOLDER # Input file is saved at the desired folder in the storage
storage = nil # We are using default Cloud Storage
request = AsposeImagingCloud::UpdateImageRequest.new(
IMAGE_FILE_NAME, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, folder, storage)
updated_image = imaging_api.update_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'tiff'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
# Update an image. Image data is passed in a request stream
def create_updated_image_from_request
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'tiff' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
storage = nil # We are using default Cloud Storage
out_path = nil # Path to updated file (if this is empty, response contains streamed image)
input_stream = File.open(File.join(IMAGES_FOLDER, IMAGE_FILE_NAME), 'r')
request = AsposeImagingCloud::CreateUpdatedImageRequest.new(
input_stream, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, out_path, storage)
updated_image = imaging_api.create_updated_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'tiff'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
require 'fileutils'
require 'aspose-imaging-cloud'
IMAGE_FILE_NAME= 'example_image.webp';
IMAGES_FOLDER = 'ExampleImages';
CLOUD_FOLDER = 'CloudImages';
OUTPUT_FOLDER = 'Output';
# Get ClientId and ClientSecret from https://dashboard.aspose.cloud/
# or use on-premise version (https://docs.aspose.cloud/imaging/getting-started/how-to-run-docker-container/)
imaging_api = AsposeImagingCloud::ImagingApi.new(client_secret, client_id, 'https://api.aspose.cloud')
# Update an image from cloud storage
def update_image_from_storage
input_image = File.join(IMAGES_FOLDER, IMAGE_FILE_NAME)
upload_file_request = AsposeImagingCloud::UploadFileRequest.new(File.join(CLOUD_FOLDER, IMAGE_FILE_NAME), input_image)
result = self.imaging_api.upload_file(upload_file_request)
if result.errors.any?
puts('Uploading errors count: ' + result.errors.size.to_s)
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'webp' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
folder = CLOUD_FOLDER # Input file is saved at the desired folder in the storage
storage = nil # We are using default Cloud Storage
request = AsposeImagingCloud::UpdateImageRequest.new(
IMAGE_FILE_NAME, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, folder, storage)
updated_image = imaging_api.update_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'webp'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
# Update an image. Image data is passed in a request stream
def create_updated_image_from_request
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'webp' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
storage = nil # We are using default Cloud Storage
out_path = nil # Path to updated file (if this is empty, response contains streamed image)
input_stream = File.open(File.join(IMAGES_FOLDER, IMAGE_FILE_NAME), 'r')
request = AsposeImagingCloud::CreateUpdatedImageRequest.new(
input_stream, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, out_path, storage)
updated_image = imaging_api.create_updated_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'webp'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
require 'fileutils'
require 'aspose-imaging-cloud'
IMAGE_FILE_NAME= 'example_image.wmf';
IMAGES_FOLDER = 'ExampleImages';
CLOUD_FOLDER = 'CloudImages';
OUTPUT_FOLDER = 'Output';
# Get ClientId and ClientSecret from https://dashboard.aspose.cloud/
# or use on-premise version (https://docs.aspose.cloud/imaging/getting-started/how-to-run-docker-container/)
imaging_api = AsposeImagingCloud::ImagingApi.new(client_secret, client_id, 'https://api.aspose.cloud')
# Update an image from cloud storage
def update_image_from_storage
input_image = File.join(IMAGES_FOLDER, IMAGE_FILE_NAME)
upload_file_request = AsposeImagingCloud::UploadFileRequest.new(File.join(CLOUD_FOLDER, IMAGE_FILE_NAME), input_image)
result = self.imaging_api.upload_file(upload_file_request)
if result.errors.any?
puts('Uploading errors count: ' + result.errors.size.to_s)
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'png' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
folder = CLOUD_FOLDER # Input file is saved at the desired folder in the storage
storage = nil # We are using default Cloud Storage
request = AsposeImagingCloud::UpdateImageRequest.new(
IMAGE_FILE_NAME, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, folder, storage)
updated_image = imaging_api.update_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'png'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
# Update an image. Image data is passed in a request stream
def create_updated_image_from_request
# Please refer to https://docs.aspose.cloud/imaging/supported-file-formats/#update for possible formats
format = 'png' # Resulting image format
new_width = 300
new_height = 450
x = 10
y = 10
rect_width = 200
rect_height = 300
rotate_flip_method = 'Rotate90FlipX' # RotateFlip method
storage = nil # We are using default Cloud Storage
out_path = nil # Path to updated file (if this is empty, response contains streamed image)
input_stream = File.open(File.join(IMAGES_FOLDER, IMAGE_FILE_NAME), 'r')
request = AsposeImagingCloud::CreateUpdatedImageRequest.new(
input_stream, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, format, out_path, storage)
updated_image = imaging_api.create_updated_image(request)
# Save the image file to output folder
filename_part = File.basename(IMAGE_FILE_NAME, ".*")
image_name = filename_part + '.' + 'png'
path = File.absolute_path(File.join(OUTPUT_FOLDER, image_name))
File.write(path, updated_image)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment