Class: CloudmersiveImageRecognitionApiClient::ResizeApi
- Inherits:
-
Object
- Object
- CloudmersiveImageRecognitionApiClient::ResizeApi
- Defined in:
- lib/cloudmersive-image-recognition-api-client/api/resize_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#initialize(api_client = ApiClient.default) ⇒ ResizeApi
constructor
A new instance of ResizeApi.
-
#resize_post(max_width, max_height, image_file, opts = {}) ⇒ String
Resize an image while preserving aspect ratio Resize an image to a maximum width and maximum height, while preserving the image’s original aspect ratio.
-
#resize_post_with_http_info(max_width, max_height, image_file, opts = {}) ⇒ Array<(String, Fixnum, Hash)>
Resize an image while preserving aspect ratio Resize an image to a maximum width and maximum height, while preserving the image's original aspect ratio.
-
#resize_resize_ai_super_sampling(image_file, opts = {}) ⇒ String
Resize an image with AI super sampling Use AI super sampling to resize a small or low resolution image to twice the size.
-
#resize_resize_ai_super_sampling_with_http_info(image_file, opts = {}) ⇒ Array<(String, Fixnum, Hash)>
Resize an image with AI super sampling Use AI super sampling to resize a small or low resolution image to twice the size.
-
#resize_resize_simple(width, height, image_file, opts = {}) ⇒ String
Resize an image Resize an image to a specific width and specific height.
-
#resize_resize_simple_with_http_info(width, height, image_file, opts = {}) ⇒ Array<(String, Fixnum, Hash)>
Resize an image Resize an image to a specific width and specific height.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ ResizeApi
Returns a new instance of ResizeApi.
19 20 21 |
# File 'lib/cloudmersive-image-recognition-api-client/api/resize_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/cloudmersive-image-recognition-api-client/api/resize_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#resize_post(max_width, max_height, image_file, opts = {}) ⇒ String
Resize an image while preserving aspect ratio Resize an image to a maximum width and maximum height, while preserving the image’s original aspect ratio. Resize is EXIF-aware.
29 30 31 32 |
# File 'lib/cloudmersive-image-recognition-api-client/api/resize_api.rb', line 29 def resize_post(max_width, max_height, image_file, opts = {}) data, _status_code, _headers = resize_post_with_http_info(max_width, max_height, image_file, opts) data end |
#resize_post_with_http_info(max_width, max_height, image_file, opts = {}) ⇒ Array<(String, Fixnum, Hash)>
Resize an image while preserving aspect ratio Resize an image to a maximum width and maximum height, while preserving the image's original aspect ratio. Resize is EXIF-aware.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/cloudmersive-image-recognition-api-client/api/resize_api.rb', line 41 def resize_post_with_http_info(max_width, max_height, image_file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ResizeApi.resize_post ...' end # verify the required parameter 'max_width' is set if @api_client.config.client_side_validation && max_width.nil? fail ArgumentError, "Missing the required parameter 'max_width' when calling ResizeApi.resize_post" end # verify the required parameter 'max_height' is set if @api_client.config.client_side_validation && max_height.nil? fail ArgumentError, "Missing the required parameter 'max_height' when calling ResizeApi.resize_post" end # verify the required parameter 'image_file' is set if @api_client.config.client_side_validation && image_file.nil? fail ArgumentError, "Missing the required parameter 'image_file' when calling ResizeApi.resize_post" end # resource path local_var_path = '/image/resize/preserveAspectRatio/{maxWidth}/{maxHeight}'.sub('{' + 'maxWidth' + '}', max_width.to_s).sub('{' + 'maxHeight' + '}', max_height.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) # form parameters form_params = {} form_params['imageFile'] = image_file # http body (model) post_body = nil auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'String') if @api_client.config.debugging @api_client.config.logger.debug "API called: ResizeApi#resize_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#resize_resize_ai_super_sampling(image_file, opts = {}) ⇒ String
Resize an image with AI super sampling Use AI super sampling to resize a small or low resolution image to twice the size. Input image should be PNG or JPG, and smaller than 200 x 200 pixels (larger images will be resized down). Consumes 20 API calls.
94 95 96 97 |
# File 'lib/cloudmersive-image-recognition-api-client/api/resize_api.rb', line 94 def resize_resize_ai_super_sampling(image_file, opts = {}) data, _status_code, _headers = resize_resize_ai_super_sampling_with_http_info(image_file, opts) data end |
#resize_resize_ai_super_sampling_with_http_info(image_file, opts = {}) ⇒ Array<(String, Fixnum, Hash)>
Resize an image with AI super sampling Use AI super sampling to resize a small or low resolution image to twice the size. Input image should be PNG or JPG, and smaller than 200 x 200 pixels (larger images will be resized down). Consumes 20 API calls.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/cloudmersive-image-recognition-api-client/api/resize_api.rb', line 104 def resize_resize_ai_super_sampling_with_http_info(image_file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ResizeApi.resize_resize_ai_super_sampling ...' end # verify the required parameter 'image_file' is set if @api_client.config.client_side_validation && image_file.nil? fail ArgumentError, "Missing the required parameter 'image_file' when calling ResizeApi.resize_resize_ai_super_sampling" end # resource path local_var_path = '/image/resize/ai/target' # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) # form parameters form_params = {} form_params['imageFile'] = image_file # http body (model) post_body = nil auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'String') if @api_client.config.debugging @api_client.config.logger.debug "API called: ResizeApi#resize_resize_ai_super_sampling\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#resize_resize_simple(width, height, image_file, opts = {}) ⇒ String
Resize an image Resize an image to a specific width and specific height. Resize is EXIF-aware.
151 152 153 154 |
# File 'lib/cloudmersive-image-recognition-api-client/api/resize_api.rb', line 151 def resize_resize_simple(width, height, image_file, opts = {}) data, _status_code, _headers = resize_resize_simple_with_http_info(width, height, image_file, opts) data end |
#resize_resize_simple_with_http_info(width, height, image_file, opts = {}) ⇒ Array<(String, Fixnum, Hash)>
Resize an image Resize an image to a specific width and specific height. Resize is EXIF-aware.
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/cloudmersive-image-recognition-api-client/api/resize_api.rb', line 163 def resize_resize_simple_with_http_info(width, height, image_file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ResizeApi.resize_resize_simple ...' end # verify the required parameter 'width' is set if @api_client.config.client_side_validation && width.nil? fail ArgumentError, "Missing the required parameter 'width' when calling ResizeApi.resize_resize_simple" end # verify the required parameter 'height' is set if @api_client.config.client_side_validation && height.nil? fail ArgumentError, "Missing the required parameter 'height' when calling ResizeApi.resize_resize_simple" end # verify the required parameter 'image_file' is set if @api_client.config.client_side_validation && image_file.nil? fail ArgumentError, "Missing the required parameter 'image_file' when calling ResizeApi.resize_resize_simple" end # resource path local_var_path = '/image/resize/target/{width}/{height}'.sub('{' + 'width' + '}', width.to_s).sub('{' + 'height' + '}', height.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) # form parameters form_params = {} form_params['imageFile'] = image_file # http body (model) post_body = nil auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'String') if @api_client.config.debugging @api_client.config.logger.debug "API called: ResizeApi#resize_resize_simple\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |