

It can read and write images in a variety of formats (over 200) including PNG, JPEG, GIF, WebP, HEIC, SVG, PDF, DPX, EXR and TIFF.


Runtime_id with the one in your deployment.Use ImageMagick ® to create, edit, compose, or convert digital images. Openstack container create functions +-+-+-+ | account | container | x-trans-id | +-+-+-+ | AUTH_6ae7142bff0542d8a8f3859ffa184236 | functions | 9b45bef5ab2658acb9b72ee32f39dbc8 | +-+-+-+ openstack object create functions hello_world.zip +-+-+-+ | object | container | etag | +-+-+-+ | hello_world.zip | functions | 9b45bef5ab2658acb9b72ee32f39dbc8 | +-+-+-+ openstack object show functions hello_world.zip +-+-+ | Field | Value | +-+-+ | account | AUTH_6ae7142bff0542d8a8f3859ffa184236 | | container | functions | | content-length | 246 | | content-type | application/zip | | etag | 9b45bef5ab2658acb9b72ee32f39dbc8 | | last-modified | Wed, 17:45:23 GMT | | object | hello_world.zip | +-+-+Ĭreate a function and get the function ID, replace the Invoke the function by specifying function_id and the function inputs as
#CODE COOKBOOK FOR SWIFT LICENSE INSTALL#
Install the python libraries necessary for the program execution using With open(thumb_path, 'r') as new_local: conn.put_object( new_container_name, object_name, contents=new_local, content_type='text/plain' ) os.remove(image_path) os.remove(thumb_path) print('Uploaded object %s to container %s' % (object_name, new_container_name)) EOF New_container_name = '%s_resized' % container_name try: conn.head_container(new_container_name) except ClientException: conn.put_container(new_container_name) print("New container %s created." % new_container_name) # Upload resized image Image_path = os.path.abspath('./%s' % object_name) _, obj_contents = conn.get_object(container_name, object_name) with open(image_path, 'w') as local: local.write(obj_contents) print('Downloaded object %s from container %s' % (object_name, container_name)) thumb_path = os.path.abspath('./%s_resized.png' % object_name) resize_image(image_path, thumb_path) print('Resized.') # Create new container if needed

#CODE COOKBOOK FOR SWIFT LICENSE DOWNLOAD#
Cat ~/qinling_test/resize_image.py import os from PIL import Image import swiftclient from swiftclient.exceptions import ClientException def resize_image(image_path, resized_path): with Image.open(image_path) as image: image.thumbnail(tuple(x / 4 for x in image.size)) image.save(resized_path) def main(context, container_name, object_name): conn = swiftclient.Connection( session=context, os_options=, ) # Download original image
