Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)



Functions

Note: The functions described here allow the development server to perform image manipulations similar to those supported in production. In some cases, the SDK may not support some aspect of these functions. These differences are noted where they occur.

The google.appengine.api.images package provides the following functions:

composite ( inputs , width , height , color = 0 , output_encoding = PNG , quality = None )

Produces a composite image from multiple images, returning the composite image data as a bytestring in the requested format.

Arguments

inputs

The images to use in the composite, as a list of tuples. Each tuple must contain five elements:

  • the image data, as a bytestring ( str )
  • the x offset from the anchor position to place the image in the canvas in pixels (possibly negative)
  • the y offset from the anchor position to place the image in the canvas in pixels (possibly negative)
  • the opacity of the image, as a floating point number between 0.0 and 1.0 inclusive
  • the position of the anchor in the canvas, one of the following: TOP_LEFT TOP_CENTER TOP_RIGHT CENTER_LEFT CENTER_CENTER CENTER_RIGHT BOTTOM_LEFT BOTTOM_CENTER BOTTOM_RIGHT

The images are composited in the order they appear in the list, with the first image applied first ("below" the other images in the Z stack).

width
The width of the composite image's canvas in pixels.
height
The height of the composite image's canvas in pixels.
color
The background color of the composite image's canvas, as a 32-bit unsigned integer where each color channel is represented by one byte, in the order of alpha channel, red, green, and then blue. The default is 0 (black).
quality
A value between 1 and 100 to specify the quality of the encoding as a percentage of the original image quality. This value is only used for JPEG quality control. The default value is 85 .

Note: The quality argument is not supported in the SDK.

output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
crop ( image_data , left_x , top_y , right_x , bottom_y , output_encoding = images.PNG , quality = None , correct_orientation = UNCHANGED_ORIENTATION , transparent_substitution_rgb = None )

Crops an image to a given bounding box. The function takes the image data to crop, and returns the transformed image in the same format.

The left, top, right and bottom of the bounding box are specified as proportional distances. The coordinates of the bounding box are determined as left_x * width , top_y * height , right_x * width and bottom_y * height . This allows you to specify the bounding box independently of the final width and height of the image, which may change simultaneously with a resize action.

Arguments

image_data
The image as a bytestring ( str ) in JPEG, PNG, GIF (including animated), BMP, TIFF, or ICO format.
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
quality
A value between 1 and 100 to specify the quality of the encoding as a percentage of the original image quality. This value is only used for JPEG quality control. The default value is 85 .

Note: The quality argument is not supported in the SDK.

correct_orientation
Specifies whether to correct the orientation of the image (using the image's Exif data) prior to performing the operation on it. The default is UNCHANGED_ORIENTATION , which ignores any such orientation data. If you instead supply the value CORRECT_ORIENTATION , the Images service reads the Exif orientation tag and orients the image based on that data before performing the operation.
transparent_substitution_rgb
If transparent pixels are not supported in the destination image format, the default is to substitute black. You can replace this default color with another substitution by specifying it in 32-bit RGB format.
left_x
The left border of the bounding box, as a proportion of the image width specified as a float value from 0.0 to 1.0 (inclusive).
top_y
The top border of the bounding box, as a proportion of the image height specified as a float value from 0.0 to 1.0 (inclusive).
right_x
The right border of the bounding box, as a proportion of the image width specified as a float value from 0.0 to 1.0 (inclusive).
bottom_y
The bottom border of the bounding box, as a proportion of the image height specified as a float value from 0.0 to 1.0 (inclusive).
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
delete_serving_url ( blob_key )

Deletes the URL that serves the image without deleting the blob key. You can delete the serving URL for an image stored in either Blobstore or in Google Cloud Storage.

Arguments

blob_key

A BlobInfo object , a BlobKey object , or a str or unicode representation of the blob key for the Blobstore or Google Cloud Storage object. If not provided, raises BlobKeyRequiredError .

get_serving_url ( blob_key , size = None , crop = False , secure_url = None )

Returns a URL that serves the image.

This URL format allows dynamic resizing and cropping, so you don't need to store different image sizes on the server. Images are served with low latency from a highly optimized, cookieless infrastructure.

You can serve images stored in Google Cloud Storage . To do this, you need to generate a Blob Key using the Blobstore API create_gs_key() function. You also need to set a default object ACL on the bucket being used that gives your app FULL_CONTROL permissions, so that the image service can add its own ACL to the objects. For information on ACLs and permissions, see the documentation for Google Cloud Storage .

Important: If you serve images from Google Cloud Storage, you cannot serve an image from two separate apps. Only the first app that calls get_serving_url on the image can get the URL to serve it because that app has obtained ownership of the image. Any other app that subsequently calls get_serving_url on the image will therefore be unsuccessful. If a second app needs to serve the image, the app needs to first copy the image and then invoke get_serving_url on the copy. (The copy is deduped in storage.)

The URL returned by this method is always public, but not guessable; private URLs are not currently supported. If you wish to stop serving the URL, call delete_serving_url() .

If the image will be displayed in an https page, pass secure_url=True to avoid mixed-content warnings.

If you supply the arguments below, this method returns a URL encoded with the arguments specified. If you do not supply any arguments, this method returns the default URL for the image, which you can then modify to get the desired size and crop parameters.

Arguments

blob_key

A BlobInfo object , a BlobKey object , or a str or unicode representation of the blob key for the Blobstore value. If not provided, raises BlobKeyRequiredError .

size

An integer supplying the size of resulting images.

When resizing or cropping an image, you must specify the new size using an integer 0 to 1600 . The maximum size is defined in IMG_SERVING_SIZES_LIMIT . The API resizes the image to the supplied value, applying the specified size to the image's longest dimension and preserving the original aspect ratio. A size of 0 returns the original image.

crop

Specify true for a cropped image, and false for a resized image. If you specify true, but do not provide a pixel value from 0 1600 , the API raises a BadRequestError .

secure_url
bool specifying whether to request an https URL instead of an http URL.
rpc
An RPC object that controls some settings of this request. If this argument is None (the default), this request uses normal settings and does not do asynchronous processing.

URL Modifications:

    =s XX

    To resize an image, append =s XX to the end of the image URL, where XX is an integer from 0 1600 representing the new image size in pixels. The maximum size is defined in IMG_SERVING_SIZES_LIMIT . The API resizes the image to the supplied value, applying the specified size to the image's longest dimension and preserving the original aspect ratio. For example, if you use =s32 to resize a 1200x1600 image, the resulting image is a 24x32. If that image were 1600x1200, the resized image would be 32x24 pixels.

    =s XX -c

    To crop and resize an image, append =s XX -c to the end of the image URL, where XX is an integer from 0 1600 representing the new image size in pixels. The maximum size is defined in IMG_SERVING_SIZES_LIMIT . The API resizes the image to the supplied value, applying the specified size to the image's longest dimension and preserving the original aspect ratio. If the image is portrait, the API slices evenly from the top and bottom to make a square. If the image is landscape, the API slices evenly from the left and right to make a square. After cropping, the API resizes the image to the specified size.

histogram ( image_data )

Calculates a histogram of the image's color values.

The return value is a list of 3 lists of value totals for red, green and blue, respectively. Each color list contains an occurrence count for each of 256 color values.

horizontal_flip ( image_data , output_encoding = images.PNG , quality = None , correct_orientation = UNCHANGED_ORIENTATION , transparent_substitution_rgb = None )

Flips an image horizontally. The edge that was the left becomes the right edge, and vice versa. The function takes the image data to flip, and returns the transformed image in the same format.

Arguments

image_data
The image as a bytestring ( str ) in JPEG, PNG, GIF (including animated), BMP, TIFF, or ICO format.
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
quality
A value between 1 and 100 to specify the quality of the encoding as a percentage of the original image quality. This value is only used for JPEG quality control. The default value is 85 .

Note: The quality argument is not supported in the SDK.

correct_orientation
Specifies whether to correct the orientation of the image (using the image's Exif data) prior to performing the operation on it. The default is UNCHANGED_ORIENTATION , which ignores any such orientation data. If you instead supply the value CORRECT_ORIENTATION , the Images service reads the Exif orientation tag and orients the image based on that data before performing the operation.
transparent_substitution_rgb
If transparent pixels are not supported in the destination image format, the default is to substitute black. You can replace this default color with another substitution by specifying it in 32-bit RGB format.
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
im_feeling_lucky ( image_data , output_encoding = images.PNG , quality = None , correct_orientation = UNCHANGED_ORIENTATION , transparent_substitution_rgb = None )

Adjusts the contrast and color levels of an image according to an algorithm for improving photographs. This is similar to the "I'm Feeling Lucky" feature of Google Picasa. The function takes the image data to adjust, and returns the transformed image in the same format.

Arguments

image_data
The image as a bytestring ( str ) in JPEG, PNG, GIF (including animated), BMP, TIFF, or ICO format.
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
quality
A value between 1 and 100 to specify the quality of the encoding as a percentage of the original image quality. This value is only used for JPEG quality control. The default value is 85 .

Note: The quality argument is not supported in the SDK.

correct_orientation
Specifies whether to correct the orientation of the image (using the image's Exif data) prior to performing the operation on it. The default is UNCHANGED_ORIENTATION , which ignores any such orientation data. If you instead supply the value CORRECT_ORIENTATION , the Images service reads the Exif orientation tag and orients the image based on that data before performing the operation.
transparent_substitution_rgb
If transparent pixels are not supported in the destination image format, the default is to substitute black. You can replace this default color with another substitution by specifying it in 32-bit RGB format.
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
resize ( image_data , width = 0 , height = 0 , output_encoding = images.PNG , quality = None , correct_orientation = UNCHANGED_ORIENTATION , transparent_substitution_rgb = None )

Resizes an image, scaling down or up to the given width and height. The function takes the image data to resize, and returns the transformed image in the same format.

Arguments

image_data
The image as a bytestring ( str ) in JPEG, PNG, GIF (including animated), BMP, TIFF, or ICO format.
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
quality
A value between 1 and 100 to specify the quality of the encoding as a percentage of the original image quality. This value is only used for JPEG quality control. The default value is 85 .

Note: The quality argument is not supported in the SDK.

correct_orientation
Specifies whether to correct the orientation of the image (using the image's Exif data) prior to performing the operation on it. The default is UNCHANGED_ORIENTATION , which ignores any such orientation data. If you instead supply the value CORRECT_ORIENTATION , the Images service reads the Exif orientation tag and orients the image based on that data before performing the operation.
transparent_substitution_rgb
If transparent pixels are not supported in the destination image format, the default is to substitute black. You can replace this default color with another substitution by specifying it in 32-bit RGB format.
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
width
The width of the composite image's canvas in pixels.
height
The height of the composite image's canvas in pixels.
height
The desired height in pixels. Must be an int or long .
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
rotate ( image_data , degrees , output_encoding = images.PNG , quality = None , correct_orientation = UNCHANGED_ORIENTATION , transparent_substitution_rgb = None )

Rotates an image. The amount of rotation must be a multiple of 90 degrees. The function takes the image data to rotate, and returns the transformed image in the same format.

Rotation is performed clockwise. A 90 degree turn rotates the image so that the edge that was the top becomes the right edge.

Arguments

image_data
The image as a bytestring ( str ) in JPEG, PNG, GIF (including animated), BMP, TIFF, or ICO format.
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
quality
A value between 1 and 100 to specify the quality of the encoding as a percentage of the original image quality. This value is only used for JPEG quality control. The default value is 85 .

Note: The quality argument is not supported in the SDK.

correct_orientation
Specifies whether to correct the orientation of the image (using the image's Exif data) prior to performing the operation on it. The default is UNCHANGED_ORIENTATION , which ignores any such orientation data. If you instead supply the value CORRECT_ORIENTATION , the Images service reads the Exif orientation tag and orients the image based on that data before performing the operation.
transparent_substitution_rgb
If transparent pixels are not supported in the destination image format, the default is to substitute black. You can replace this default color with another substitution by specifying it in 32-bit RGB format.
degrees
The amount to rotate the image, as a number of degrees, in multiples of 90 degrees.
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
vertical_flip ( image_data , output_encoding = images.PNG , quality = None , correct_orientation = UNCHANGED_ORIENTATION , transparent_substitution_rgb = None )

Flips an image vertically. The edge that was the top becomes the bottom edge, and vice versa. The function takes the image data to flip, and returns the transformed image in the same format.

Arguments

image_data
The image as a bytestring ( str ) in JPEG, PNG, GIF (including animated), BMP, TIFF, or ICO format.
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
quality
A value between 1 and 100 to specify the quality of the encoding as a percentage of the original image quality. This value is only used for JPEG quality control. The default value is 85 .

Note: The quality argument is not supported in the SDK.

correct_orientation
Specifies whether to correct the orientation of the image (using the image's Exif data) prior to performing the operation on it. The default is UNCHANGED_ORIENTATION , which ignores any such orientation data. If you instead supply the value CORRECT_ORIENTATION , the Images service reads the Exif orientation tag and orients the image based on that data before performing the operation.
transparent_substitution_rgb
If transparent pixels are not supported in the destination image format, the default is to substitute black. You can replace this default color with another substitution by specifying it in 32-bit RGB format.
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
create_rpc ( deadline = None , callback = None )

Creates an Images RPC object tht can be used for async calls in the image library.

Note: You don't have to explicitly create an RPC object for the async functions. You can instead set the async function's RPC parameter to None, and an RPC object will be created and used "behind the scenes" for you.

Arguments

deadline
Optional deadline in seconds for the operation. Normally, you do not need to specify a deadline because the returns from async calls are made in milliseconds, faster than the deadline for the entire async call.
callback
An optional function to be called when the image service returns results successfully. The function is called without arguments. The callback function is called when get_result() , or check_success() , or wait() is invoked on the RPC object.

The callback function does not get called in a background process or thread; it only gets called when one of the above RPC methods is called by the application.

The callback function is called even if the request fails or the RPC deadline elapses.

Returns an RPC object for use in the async calls.

composite_async ( inputs , width , height , color = 0 , output_encoding = PNG , quality = None rpc = None )

Asynchronously produces a composite image from multiple images, returning the composite image data as a bytestring in the requested format.

Arguments

inputs

The images to use in the composite, as a list of tuples. Each tuple must contain five elements:

  • the image data, as a bytestring ( str )
  • the x offset from the anchor position to place the image in the canvas in pixels (possibly negative)
  • the y offset from the anchor position to place the image in the canvas in pixels (possibly negative)
  • the opacity of the image, as a floating point number between 0.0 and 1.0 inclusive
  • the position of the anchor in the canvas, one of the following: TOP_LEFT TOP_CENTER TOP_RIGHT CENTER_LEFT CENTER_CENTER CENTER_RIGHT BOTTOM_LEFT BOTTOM_CENTER BOTTOM_RIGHT

The images are composited in the order they appear in the list, with the first image applied first ("below" the other images in the Z stack).

width
The width of the composite image's canvas in pixels.
height
The height of the composite image's canvas in pixels.
height
The desired height in pixels. Must be an int or long .
color
The background color of the composite image's canvas, as a 32-bit unsigned integer where each color channel is represented by one byte, in the order of alpha channel, red, green, and then blue. The default is 0 (black).
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
quality
A value between 1 and 100 to specify the quality of the encoding as a percentage of the original image quality. This value is only used for JPEG quality control. The default value is 85 .

Note: The quality argument is not supported in the SDK.

rpc
An RPC object that controls some settings of this request from the application to the Images service (deadline and optional callback function). The default setting is "None", which is the easiest way to use the async function. If "None" is specified, an RPC object is automatically created and used.
crop_async ( image_data , left_x , top_y , right_x , bottom_y , output_encoding = images.PNG , quality = None , correct_orientation = UNCHANGED_ORIENTATION , rpc = None , transparent_substitution_rgb = None )

Asynchronously crops an image to a given bounding box. The function takes the image data to crop, and returns the transformed image in the same format.

The left, top, right and bottom of the bounding box are specified as proportional distances. The coordinates of the bounding box are determined as left_x * width , top_y * height , right_x * width and bottom_y * height . This allows you to specify the bounding box independently of the final width and height of the image, which may change simultaneously with a resize action.

Arguments

image_data
The image as a bytestring ( str ) in JPEG, PNG, GIF (including animated), BMP, TIFF, or ICO format.
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
quality
A value between 1 and 100 to specify the quality of the encoding as a percentage of the original image quality. This value is only used for JPEG quality control. The default value is 85 .

Note: The quality argument is not supported in the SDK.

correct_orientation
Specifies whether to correct the orientation of the image (using the image's Exif data) prior to performing the operation on it. The default is UNCHANGED_ORIENTATION , which ignores any such orientation data. If you instead supply the value CORRECT_ORIENTATION , the Images service reads the Exif orientation tag and orients the image based on that data before performing the operation.
transparent_substitution_rgb
If transparent pixels are not supported in the destination image format, the default is to substitute black. You can replace this default color with another substitution by specifying it in 32-bit RGB format.
left_x
The left border of the bounding box, as a proportion of the image width specified as a float value from 0.0 to 1.0 (inclusive).
top_y
The top border of the bounding box, as a proportion of the image height specified as a float value from 0.0 to 1.0 (inclusive).
right_x
The right border of the bounding box, as a proportion of the image width specified as a float value from 0.0 to 1.0 (inclusive).
bottom_y
The bottom border of the bounding box, as a proportion of the image height specified as a float value from 0.0 to 1.0 (inclusive).
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
rpc
An RPC object that controls some settings of this request from the application to the Images service (deadline and optional callback function). The default setting is "None", which is the easiest way to use the async function. If "None" is specified, an RPC object is automatically created and used.
delete_serving_url_async ( blob_key , rpc = None )

Asynchronously deletes the URL that serves the image without deleting the blob key. You can delete the serving URL for an image stored in either Blobstore or in Google Cloud Storage.

Arguments

blob_key

A BlobInfo object , a BlobKey object , or a str or unicode representation of the blob key for the Blobstore or Google Cloud Storage object. If not provided, raises BlobKeyRequiredError .

rpc
rpc
An RPC object that controls some settings of this request from the application to the Images service (deadline and optional callback function). The default setting is "None", which is the easiest way to use the async function. If "None" is specified, an RPC object is automatically created and used.
get_serving_url_async ( blob_key , size = None , crop = False , secure_url = None , rpc = None )

Asynchronously returns a URL that serves the image.

This URL format allows dynamic resizing and cropping, so you don't need to store different image sizes on the server. Images are served with low latency from a highly optimized, cookieless infrastructure.

You can serve images stored in Google Cloud Storage . To do this, you need to generate a Blob Key using the Blobstore API create_gs_key() function. You also need to set a default object ACL on the bucket being used that gives your app FULL_CONTROL permissions, so that the image service can add its own ACL to the objects. For information on ACLs and permissions, see the documentation for Google Cloud Storage .

Important: If you serve images from Google Cloud Storage, you cannot serve an image from two separate apps. Only the first app that calls get_serving_url on the image can get the URL to serve it because that app has obtained ownership of the image. Any other app that subsequently calls get_serving_url on the image will therefore be unsuccessful. If a second app needs to serve the image, the app needs to first copy the image and then invoke get_serving_url on the copy. (The copy is deduped in storage.)

The URL returned by this method is always public, but not guessable; private URLs are not currently supported. If you wish to stop serving the URL, call delete_serving_url() .

If the image will be displayed in an https page, pass secure_url=True to avoid mixed-content warnings.

If you supply the arguments below, this method returns a URL encoded with the arguments specified. If you do not supply any arguments, this method returns the default URL for the image, which you can then modify to get the desired size and crop parameters.

Arguments

blob_key

A BlobInfo object , a BlobKey object , or a str or unicode representation of the blob key for the Blobstore value. If not provided, raises BlobKeyRequiredError .

size

An integer supplying the size of resulting images.

When resizing or cropping an image, you must specify the new size using an integer 0 to 1600 . The maximum size is defined in IMG_SERVING_SIZES_LIMIT . The API resizes the image to the supplied value, applying the specified size to the image's longest dimension and preserving the original aspect ratio. A size of 0 returns the original image.

crop

Specify true for a cropped image, and false for a resized image. If you specify true, but do not provide a pixel value from 0 1600 , the API raises a BadRequestError .

secure_url
bool specifying whether to request an https URL instead of an http URL.
rpc
An RPC object that controls some settings of this request. If this argument is None (the default), this request uses normal settings and does not do asynchronous processing.

URL Modifications:

    =s XX

    To resize an image, append =s XX to the end of the image URL, where XX is an integer from 0 1600 representing the new image size in pixels. The maximum size is defined in IMG_SERVING_SIZES_LIMIT . The API resizes the image to the supplied value, applying the specified size to the image's longest dimension and preserving the original aspect ratio. For example, if you use =s32 to resize a 1200x1600 image, the resulting image is a 24x32. If that image were 1600x1200, the resized image would be 32x24 pixels.

    =s XX -c

    To crop and resize an image, append =s XX -c to the end of the image URL, where XX is an integer from 0 1600 representing the new image size in pixels. The maximum size is defined in IMG_SERVING_SIZES_LIMIT . The API resizes the image to the supplied value, applying the specified size to the image's longest dimension and preserving the original aspect ratio. If the image is portrait, the API slices evenly from the top and bottom to make a square. If the image is landscape, the API slices evenly from the left and right to make a square. After cropping, the API resizes the image to the specified size.

histogram_async ( image_data , rpc = None )

Asynchronously calculates a histogram of the image's color values.

The return value is a list of 3 lists of value totals for red, green and blue, respectively. Each color list contains an occurrence count for each of 256 color values.

Arguments

image_data
The image as a bytestring ( str ) in JPEG, PNG, GIF (including animated), BMP, TIFF, or ICO format.
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
rpc
An RPC object that controls some settings of this request from the application to the Images service (deadline and optional callback function). The default setting is "None", which is the easiest way to use the async function. If "None" is specified, an RPC object is automatically created and used.
horizontal_flip_async ( image_data , output_encoding = images.PNG , quality = None , correct_orientation = UNCHANGED_ORIENTATION , rpc = None , transparent_substitution_rgb = None )

Asynchronously flips an image horizontally. The edge that was the left becomes the right edge, and vice versa. The function takes the image data to flip, and returns the transformed image in the same format.

Arguments

image_data
The image as a bytestring ( str ) in JPEG, PNG, GIF (including animated), BMP, TIFF, or ICO format.
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
quality
A value between 1 and 100 to specify the quality of the encoding as a percentage of the original image quality. This value is only used for JPEG quality control. The default value is 85 .

Note: The quality argument is not supported in the SDK.

correct_orientation
Specifies whether to correct the orientation of the image (using the image's Exif data) prior to performing the operation on it. The default is UNCHANGED_ORIENTATION , which ignores any such orientation data. If you instead supply the value CORRECT_ORIENTATION , the Images service reads the Exif orientation tag and orients the image based on that data before performing the operation.
transparent_substitution_rgb
If transparent pixels are not supported in the destination image format, the default is to substitute black. You can replace this default color with another substitution by specifying it in 32-bit RGB format.
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
rpc
An RPC object that controls some settings of this request from the application to the Images service (deadline and optional callback function). The default setting is "None", which is the easiest way to use the async function. If "None" is specified, an RPC object is automatically created and used.
im_feeling_lucky_async ( image_data , output_encoding = images.PNG , quality = None , correct_orientation = UNCHANGED_ORIENTATION , rpc = None , transparent_substitution_rgb = None )

Asynchronously adjusts the contrast and color levels of an image according to an algorithm for improving photographs. This is similar to the "I'm Feeling Lucky" feature of Google Picasa. The function takes the image data to adjust, and returns the transformed image in the same format.

Arguments

image_data
The image as a bytestring ( str ) in JPEG, PNG, GIF (including animated), BMP, TIFF, or ICO format.
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
quality
A value between 1 and 100 to specify the quality of the encoding as a percentage of the original image quality. This value is only used for JPEG quality control. The default value is 85 .

Note: The quality argument is not supported in the SDK.

correct_orientation
Specifies whether to correct the orientation of the image (using the image's Exif data) prior to performing the operation on it. The default is UNCHANGED_ORIENTATION , which ignores any such orientation data. If you instead supply the value CORRECT_ORIENTATION , the Images service reads the Exif orientation tag and orients the image based on that data before performing the operation.
transparent_substitution_rgb
If transparent pixels are not supported in the destination image format, the default is to substitute black. You can replace this default color with another substitution by specifying it in 32-bit RGB format.
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
rpc
An RPC object that controls some settings of this request from the application to the Images service (deadline and optional callback function). The default setting is "None", which is the easiest way to use the async function. If "None" is specified, an RPC object is automatically created and used.
resize_async ( image_data , width = 0 , height = 0 , output_encoding = images.PNG , quality = None ,
correct_orientation = UNCHANGED_ORIENTATION , rpc = None , transparent_substitution_rgb = None )

Asynchronously resizes an image, scaling down or up to the given width and height. The function takes the image data to resize, and returns the transformed image in the same format.

Arguments

image_data
The image as a bytestring ( str ) in JPEG, PNG, GIF (including animated), BMP, TIFF, or ICO format.
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
quality
A value between 1 and 100 to specify the quality of the encoding as a percentage of the original image quality. This value is only used for JPEG quality control. The default value is 85 .

Note: The quality argument is not supported in the SDK.

correct_orientation
Specifies whether to correct the orientation of the image (using the image's Exif data) prior to performing the operation on it. The default is UNCHANGED_ORIENTATION , which ignores any such orientation data. If you instead supply the value CORRECT_ORIENTATION , the Images service reads the Exif orientation tag and orients the image based on that data before performing the operation.
transparent_substitution_rgb
If transparent pixels are not supported in the destination image format, the default is to substitute black. You can replace this default color with another substitution by specifying it in 32-bit RGB format.
width
The width of the composite image's canvas in pixels.
height
The height of the composite image's canvas in pixels.
height
The desired height in pixels. Must be an int or long .
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
rpc
An RPC object that controls some settings of this request from the application to the Images service (deadline and optional callback function). The default setting is "None", which is the easiest way to use the async function. If "None" is specified, an RPC object is automatically created and used.
rotate_async ( image_data , degrees , output_encoding = images.PNG , quality = None , correct_orientation = UNCHANGED_ORIENTATION , rpc = None , transparent_substitution_rgb = None )

Asynchronously rotates an image. The amount of rotation must be a multiple of 90 degrees. The function takes the image data to rotate, and returns the transformed image in the same format.

Rotation is performed clockwise. A 90 degree turn rotates the image so that the edge that was the top becomes the right edge.

Arguments

image_data
The image as a bytestring ( str ) in JPEG, PNG, GIF (including animated), BMP, TIFF, or ICO format.
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
quality
A value between 1 and 100 to specify the quality of the encoding as a percentage of the original image quality. This value is only used for JPEG quality control. The default value is 85 .

Note: The quality argument is not supported in the SDK.

correct_orientation
Specifies whether to correct the orientation of the image (using the image's Exif data) prior to performing the operation on it. The default is UNCHANGED_ORIENTATION , which ignores any such orientation data. If you instead supply the value CORRECT_ORIENTATION , the Images service reads the Exif orientation tag and orients the image based on that data before performing the operation.
transparent_substitution_rgb
If transparent pixels are not supported in the destination image format, the default is to substitute black. You can replace this default color with another substitution by specifying it in 32-bit RGB format.
degrees
The amount to rotate the image, as a number of degrees, in multiples of 90 degrees.
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
rpc
An RPC object that controls some settings of this request from the application to the Images service (deadline and optional callback function). The default setting is "None", which is the easiest way to use the async function. If "None" is specified, an RPC object is automatically created and used.
vertical_flip_async ( image_data , output_encoding = images.PNG , quality = None , correct_orientation = UNCHANGED_ORIENTATION , rpc = None , transparent_substitution_rgb = None )

Flips an image vertically. The edge that was the top becomes the bottom edge, and vice versa. The function takes the image data to flip, and returns the transformed image in the same format.

Arguments

image_data
The image as a bytestring ( str ) in JPEG, PNG, GIF (including animated), BMP, TIFF, or ICO format.
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
quality
A value between 1 and 100 to specify the quality of the encoding as a percentage of the original image quality. This value is only used for JPEG quality control. The default value is 85 .

Note: The quality argument is not supported in the SDK.

correct_orientation
Specifies whether to correct the orientation of the image (using the image's Exif data) prior to performing the operation on it. The default is UNCHANGED_ORIENTATION , which ignores any such orientation data. If you instead supply the value CORRECT_ORIENTATION , the Images service reads the Exif orientation tag and orients the image based on that data before performing the operation.
transparent_substitution_rgb
If transparent pixels are not supported in the destination image format, the default is to substitute black. You can replace this default color with another substitution by specifying it in 32-bit RGB format.
output_encoding
The desired format of the transformed image. This is either images.PNG or images.JPEG . The default is images.PNG .
rpc
An RPC object that controls some settings of this request from the application to the Images service (deadline and optional callback function). The default setting is "None", which is the easiest way to use the async function. If "None" is specified, an RPC object is automatically created and used.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.