google.appengine.api.images package
Summary
Image manipulation API.
App Engine provides the ability to manipulate image data using a dedicated Images service. The Images service can resize, rotate, flip, and crop images; it can composite multiple images into a single image; and it can convert image data between several formats. It can also enhance photographs using a predefined algorithm. The API can also provide information about an image, such as its format, width, height, and a histogram of color values.
Contents
- exception google.appengine.api.images.AccessDeniedErrorsource
-
Bases: google.appengine.api.images.Error
The application does not have permission to access the image.
- exception google.appengine.api.images.BadImageErrorsource
-
Bases: google.appengine.api.images.Error
The image data is corrupt.
- exception google.appengine.api.images.BadRequestErrorsource
-
Bases: google.appengine.api.images.Error
The parameters specified were in some way invalid.
- exception google.appengine.api.images.BlobKeyRequiredErrorsource
-
Bases: google.appengine.api.images.Error
A blob key is required for this operation.
- exception google.appengine.api.images.Errorsource
-
Bases: exceptions.Exception
Base error class for this module.
- class google.appengine.api.images.Image(image_data=None, blob_key=None, filename=None)source
-
Bases: object
Image object to manipulate.
- static CheckValidIntParameter(parameter, min_value, max_value, name)source
-
Checks that a parameter is an integer within the specified range.
- crop(left_x, top_y, right_x, bottom_y)source
Crops the image.
The four arguments are the scaling numbers that describe the bounding box that will crop the image. The upper left point of the bounding box will be at (
Parametersleft_x*image_width
,top_y*image_height
), and the lower right point will be at (right_x*image_width
,bottom_y*image_height
).-
left_x – Float value between 0.0 and 1.0, inclusive.
-
top_y – Float value between 0.0 and 1.0, inclusive.
-
right_x – Float value between 0.0 and 1.0, inclusive.
-
bottom_y – Float value between 0.0 and 1.0, inclusive.
-
TypeError – If the arguments are not of type float.
-
BadRequestError – When the bounding box values are invalid or if
MAX_TRANSFORMS_PER_REQUEST
transforms have already been requested for this image.
-
- execute_transforms(output_encoding=0, quality=None, parse_source_metadata=False, transparent_substitution_rgb=None, rpc=None)source
Performs transformations on a given image.
You can only execute one transformation per image per
Parametersexecute_transforms()
call.-
output_encoding – A value from
OUTPUT_ENCODING_TYPES
. -
quality – A value between 1 and 100 to specify the quality of the encoding. This value is only used for JPEG and WEBP quality control.
-
parse_source_metadata – When
True
, the metadata (EXIF) of the source image is parsed before any transformations. The results can be retrieved viaImage.get_original_metadata
. -
transparent_substitution_rgb – When transparent pixels are not supported in the destination image format, transparent pixels will be substituted for the specified color, which must be 32-bit RGB format.
-
rpc – A UserRPC object.
A string of the image data after the transformations have been performed on it.
Raises-
BadRequestError – When the request specifications are invalid.
-
NotImageError – When the image data given is not an image.
-
BadImageError – When the image data given is corrupt.
-
LargeImageError – When the image data given is too large to process.
-
InvalidBlobKeyError – When the blob key provided is invalid.
-
TransformationError – When an error occurs during image manipulation.
-
AccessDeniedError – When the blob key refers to a Google Storage object, and the application does not have permission to access the object.
-
ObjectNotFoundError – When the blob key refers to an object that no longer exists.
-
Error – All other error conditions.
-
- execute_transforms_async(output_encoding=0, quality=None, parse_source_metadata=False, transparent_substitution_rgb=None, rpc=None)source
Asynchronously performs transformations on a given image.
Parameters-
output_encoding – A value from
OUTPUT_ENCODING_TYPES
. -
quality – A value between 1 and 100 to specify the quality of the encoding. This value is only used for JPEG & WEBP quality control.
-
parse_source_metadata – When
True
, the metadata (EXIF) of the source image is parsed before any transformations. The results can be retrieved viaImage.get_original_metadata
. -
transparent_substitution_rgb – When transparent pixels are not supported in the destination image format, transparent pixels will be substituted for the specified color, which must be in 32-bit RGB format.
-
rpc – A UserRPC object.
A UserRPC object.
Raises-
BadRequestError – When the request specifications are invalid.
-
NotImageError – When the image data given is not an image.
-
BadImageError – When the image data given is corrupt.
-
LargeImageError – When the image data given is too large to process.
-
InvalidBlobKeyError – When the blob key provided is invalid.
-
TransformationError – When an error occurs during image manipulation.
-
AccessDeniedError – When the blob key refers to a Google Storage object, and the application does not have permission to access the object.
-
ValueError – When
transparent_substitution_rgb
is not an integer. -
Error – All other error conditions.
-
- format
-
Retrieves the format of the image.
- get_original_metadata()source
Lists the metadata of the original image.
Returns a dictionary of metadata extracted from the original image during
execute_transform
.
ReturnsImageWidth
andImageLength
fields are corrected if they did not correspond to the actual dimensions of the original image.Dictionary of metadata with string keys. If
execute_transform
was called withparse_metadata
set toTrue
, this dictionary contains information about the various properties of the original image, such as dimensions, color profile, and properties from EXIF.Even if
parse_metadata
wasFalse
or the images did not have any metadata, the dictionary will contain a limited set of metadata, with leastImageWidth
andImageLength
dimensions of the original image being returned.This call will return
None
if it is called before a successfulexecute_transfrom
call.
- height
-
Retrieves the height of the image.
- histogram(rpc=None)source
Calculates the histogram of the image.
Parametersrpc – A UserRPC object.
Returns3 256-element lists containing the number of occurences of each value of each color in the order RGB. You can learn more about color histograms at Wikipedia.
Raises-
NotImageError – When the image data supplied is not an image.
-
BadImageError – When the image data supplied is corrupt.
-
LargeImageError – When the image data supplied is too large to process.
-
Error – All other error conditions.
-
- histogram_async(rpc=None)source
Asynchronously calculates the histogram of the image.
Parametersrpc – An optional UserRPC object.
ReturnsA UserRPC object.
Return typerpc
Raises-
NotImageError – When the image data supplied is not an image.
-
BadImageError – When the image data supplied is corrupt.
-
LargeImageError – When the image data supplied is too large to process.
-
Error – All other error conditions.
-
- horizontal_flip()source
Flips the image horizontally.
RaisesBadRequestError – If
MAX_TRANSFORMS_PER_REQUEST
transforms have already been requested on the image.
- im_feeling_lucky()source
Automatically adjusts the image’s contrast and color levels.
This is similar to the “I’m Feeling Lucky” button in Picasa.
RaisesBadRequestError – If
MAX_TRANSFORMS_PER_REQUEST
transforms have already been requested for this image.
- resize(width=0, height=0, crop_to_fit=False, crop_offset_x=0.5, crop_offset_y=0.5, allow_stretch=False)source
Resizes the image, maintaining the aspect ratio.
If both
width
andheight
are specified, the more restricting of the two values will be used when the image is resized. The maximum dimension allowed for bothwidth
andheight
is 4000 pixels.If both
Parameterswidth
andheight
are specified, andcrop_to_fit
isTrue
, the less restricting of the two values will be used when the image is resized, and the image will be cropped to fit the specified size. In this case, the center of cropping can be adjusted bycrop_offset_x
andcrop_offset_y
.-
width – Integer of the width in pixels to change the image width to.
-
height – Integer of the height in pixels to change the image height to.
-
crop_to_fit – If
True
, and bothwidth
andheight
are specified, the image is cropped after it is resized to fit the specified dimensions. -
crop_offset_x – Float value between 0.0 and 1.0. 0 is left, and 1 is right. The default value is 0.5, or the center of the image.
-
crop_offset_y – Float value between 0.0 and 1.0. 0 is top, and 1 is bottom. The default value is 0.5, or the center of the image.
-
allow_stretch – If
True
, and bothwidth
andheight
are specified, the image is stretched to fit the resize dimensions without maintaining the aspect ratio.
-
TypeError – When
width
orheight
is not an integer or long type. -
BadRequestError – When the height or width is invalid, or if
MAX_TRANSFORMS_PER_REQUEST
transforms have already been requested on this image.
-
- rotate(degrees)source
Rotates an image a given number of degrees clockwise.
Parametersdegrees – Integer value of the number of degrees that an image must be rotated. This value must be a multiple of 90.
Raises-
TypeError – When
degrees
is not an integer or long type. -
BadRequestError – When the
degrees
value is invalid or ifMAX_TRANSFORMS_PER_REQUEST
transforms have already been requested.
-
- set_correct_orientation(correct_orientation)source
Sets a flag to correct the image orientation based on image metadata.
EXIF metadata within the image may contain a parameter that indicates its proper orientation. This value can equal 1 through 8, inclusive. Setting the orientation to 1 means that the image is in its “normal” orientation, i.e., it should be viewed as it is stored. Normally, this orientation value has no effect on the behavior of the transformations. However, if you call this function with the
correct_orientation
argument, any orientation specified in the EXIF metadata will be corrected during the first transformation.Whether the correction was requested or not, the orientation value in the transformed image is always cleared to indicate that no additional corrections of the returned image’s orientation is necessary.
Parameterscorrect_orientation – A value from
RaisesORIENTATION_CORRECTION_TYPE
.BadRequestError – If the
correct_orientation
value is invalid.
- vertical_flip()source
Flips the image vertically.
RaisesBadRequestError – If
MAX_TRANSFORMS_PER_REQUEST
transforms have already been requested on the image.
- width
-
Retrieves the width of the image.
- exception google.appengine.api.images.InvalidBlobKeyError(blob_key=None)source
-
Bases: google.appengine.api.images.Error
The provided blob key was invalid.
- exception google.appengine.api.images.LargeImageErrorsource
-
Bases: google.appengine.api.images.Error
The image data is too large to process.
- exception google.appengine.api.images.NotImageErrorsource
-
Bases: google.appengine.api.images.Error
The image data given is not recognizable as an image.
- exception google.appengine.api.images.ObjectNotFoundErrorsource
-
Bases: google.appengine.api.images.Error
The blob key referred to an object that does not exist.
- exception google.appengine.api.images.TransformationErrorsource
-
Bases: google.appengine.api.images.Error
An error occurred while attempting to transform the image.
- exception google.appengine.api.images.UnsupportedSizeErrorsource
-
Bases: google.appengine.api.images.Error
The size that was specified is not supported by requested operation.
- google.appengine.api.images.composite(inputs, width, height, color=0, output_encoding=0, quality=None, rpc=None)source
Composites one or more images onto a canvas.
Parameters-
inputs –
a list of tuples (
image_data
,x_offset
,y_offset
,opacity
,anchor
) where:-
- image_data
-
String of the source image data.
-
- x_offset
-
X offset, in pixels from the anchor position.
-
- y_offset
-
Y offset, in piyels from the anchor position.
-
- opacity
-
Opacity of the image, specified as a float in range [0.0, 1.0]
-
- anchor
-
Anchoring point from
ANCHOR_POINTS
. The anchor point of the image is aligned with the same anchor point of the canvas. For example,TOP_RIGHT
would place the top right corner of the image at the top right corner of the canvas, then apply the x and y offsets.
-
-
width – Canvas width, in pixels.
-
height – Canvas height, in pixels.
-
color – Canvas background color, encoded as a 32-bit unsigned integer, where each color channel is represented by one byte in ARGB order.
-
output_encoding – A value from
OUTPUT_ENCODING_TYPES
. -
quality – A value between 1 and 100 to specify the quality of the encoding. This value is only used to control JPEG quality.
-
rpc – Optional UserRPC object.
A string that contains the image data of the composited image.
Raises-
TypeError – If
width
,height
,color
,x_offset
ory_offset
are not of type integer or long, or ifopacity
is not a float. -
BadRequestError – If more than
MAX_TRANSFORMS_PER_REQUEST
compositions have been requested, if the canvas width or height is greater than 4000 or less than or equal to 0, if the color is invalid, if the opacity is outside the range [0,1] for any composition option, or if the anchor is invalid.
-
- google.appengine.api.images.composite_async(inputs, width, height, color=0, output_encoding=0, quality=None, rpc=None)source
Asynchronously composites one or more images onto a canvas.
Parameters-
inputs –
A list of tuples (
image_data
,x_offset
,y_offset
,opacity
,anchor
), where:-
- image_data
-
String of the source image data.
-
- x_offset
-
X offset, in pixels from the anchor position.
-
- y_offset
-
Y offset, in piyels from the anchor position.
-
- opacity
-
Opacity of the image, specified as a float in range [0.0, 1.0]
-
- anchor
-
Anchoring point from
ANCHOR_POINTS
. The anchor point of the image is aligned with the same anchor point of the canvas. For example,TOP_RIGHT
would place the top right corner of the image at the top right corner of the canvas, then apply the x and y offsets.
-
-
width – Canvas width, in pixels.
-
height – Canvas height, in pixels.
-
color – Canvas background color, encoded as a 32-bit unsigned integer, where each color channel is represented by one byte in ARGB order.
-
output_encoding – A value from
OUTPUT_ENCODING_TYPES
. -
quality – A value between 1 and 100 to specify the quality of the encoding. This value is only used for JPEG quality control.
-
rpc – Optional UserRPC object.
A UserRPC object.
Raises-
TypeError – If
width
,height
,color
,x_offset
, ory_offset
are not an integer or long, or ifopacity
is not a float. -
BadRequestError – If more than
MAX_TRANSFORMS_PER_REQUEST
compositions have been requested, if the canvas width or height is greater than 4000 or less than or equal to 0, if the color is invalid, if the opacity is outside the range [0,1] for any composition option, or the anchor is invalid.
-
- google.appengine.api.images.create_rpc(deadline=None, callback=None)source
Creates an RPC object for use with the Images API.
Parameters-
deadline – Optional deadline in seconds for the operation; the default value is a system-specific deadline (typically 5 seconds).
-
callback – Optional callable to invoke on completion.
An
apiproxy_stub_map.UserRPC
object specialized for this service.-
- google.appengine.api.images.crop(image_data, left_x, top_y, right_x, bottom_y, output_encoding=0, quality=None, correct_orientation=0, rpc=None, transparent_substitution_rgb=None)source
Crops the image.
The four arguments are the scaling numbers that describe the bounding box that will crop the image. The upper left point of the bounding box will be at (
Parametersleft_x*image_width
,top_y*image_height
), and the lower right point will be at (right_x*image_width
,bottom_y*image_height
).-
image_data – String of the source image data.
-
left_x – Float value between 0.0 and 1.0, inclusive.
-
top_y – Float value between 0.0 and 1.0, inclusive.
-
right_x – Float value between 0.0 and 1.0, inclusive.
-
bottom_y – Float value between 0.0 and 1.0, inclusive.
-
output_encoding – A value from
OUTPUT_ENCODING_TYPES
. -
quality – A value between 1 and 100 to specify the quality of the encoding. This value is only used to control JPEG quality.
-
correct_orientation – A value from
ORIENTATION_CORRECTION_TYPE
to indicate if orientation correction should be performed during the transformation. -
rpc – An optional UserRPC object.
-
transparent_substitution_rgb – When transparent pixels are not supported in the destination image format, then transparent pixels will be substituted for the specified color, which must be in 32-bit RGB format.
Raw image data of the transformed image.
Raises-
TypeError – If the arguments are not of type float.
-
BadRequestError – If the bounding box values are invalid.
-
Error – All other errors. See
Image.ExecuteTransforms
for more details.
-
- google.appengine.api.images.crop_async(image_data, left_x, top_y, right_x, bottom_y, output_encoding=0, quality=None, correct_orientation=0, rpc=None, transparent_substitution_rgb=None)source
Asynchronously crops the given image.
The four arguments are the scaling numbers that describe the bounding box that will crop the image. The upper left point of the bounding box will be at (
Parametersleft_x*image_width
,top_y*image_height
), and the lower right point will be at (right_x*image_width
,bottom_y*image_height
).-
image_data – String of the source image data.
-
left_x – Float value between 0.0 and 1.0, inclusive.
-
top_y – Float value between 0.0 and 1.0, inclusive.
-
right_x – Float value between 0.0 and 1.0, inclusive.
-
bottom_y – Float value between 0.0 and 1.0, inclusive.
-
output_encoding – A value from
OUTPUT_ENCODING_TYPES
. -
quality – A value between 1 and 100 to specify the quality of the encoding. This value is only used to control JPEG quality.
-
correct_orientation – A value from
ORIENTATION_CORRECTION_TYPE
to indicate if orientation correction should be performed during the transformation. -
rpc – An optional UserRPC object.
-
transparent_substitution_rgb – When transparent pixels are not supported in the destination image format, then transparent pixels will be substituted for the specified color, which must be in 32-bit RGB format.
A UserRPC object; call
Raisesget_result()
to complete the RPC and obtain the crop result.-
TypeError – If the args are not of type float.
-
BadRequestError – When the bounding box values are invalid.
-
Error – All other errors. See
Image.ExecuteTransforms
for more details.
-
- google.appengine.api.images.delete_serving_url(blob_key, rpc=None)source
Deletes a serving URL created for
Parametersblob_key
usingget_serving_url
.-
blob_key – The
BlobKey
,BlobInfo
, string, or Unicode representation of the BlobKey of a blob with an existing URL that you want to delete. -
rpc – Optional UserRPC object.
-
BlobKeyRequiredError – If no
blob_key
was specified. -
InvalidBlobKeyError – If the
blob_key
supplied was invalid. -
Error – There was a generic error deleting the serving URL.
-
- google.appengine.api.images.delete_serving_url_async(blob_key, rpc=None)source
Deletes a serving URL created using get_serving_url - async version.
Parameters-
blob_key –
BlobKey
,BlobInfo
, string, or unicode representation of the BlobKey of a blob with an existing URL that you want to delete. -
rpc – Optional UserRPC object.
A UserRPC object.
Raises-
BlobKeyRequiredError – If no
blob_key
was specified. -
InvalidBlobKeyError – If the
blob_key
supplied was invalid. -
Error – There was a generic error deleting the serving URL.
-
- google.appengine.api.images.get_serving_url(blob_key, size=None, crop=False, secure_url=None, filename=None, rpc=None)source
Obtains a URL that will serve the underlying image.
This URL is served by a high-performance dynamic image serving infrastructure. This URL format also allows dynamic resizing and cropping with certain restrictions. To dynamically resize and crop, specify size and crop arguments, or simply append options to the end of the default URL obtained via this call.
Example:
get_serving_url -> "http://lh3.ggpht.com/SomeCharactersGoesHere"
To get a 32-pixel-sized version (aspect-ratio preserved), append
=s32
to the URL:http://lh3.ggpht.com/SomeCharactersGoesHere=s32
To get a 32-pixel cropped version, append
=s32-c
:http://lh3.ggpht.com/SomeCharactersGoesHere=s32-c
Available sizes are any integer in the range [0, 1600] and is available as
ParametersIMG_SERVING_SIZES_LIMIT
.-
blob_key – The
BlobKey
,BlobInfo
, string, or Unicode representation ofBlobKey
of the blob whose URL you require. -
size – Integer of the size of resulting images.
-
crop – Boolean value.
True
requests a cropped image, whileFalse
requests a resized image. -
secure_url – Boolean value.
True
requests ahttps
URL, whileFalse
requests ahttp
URL. -
filename – The file name of a Google Storage object whose URL you require.
-
rpc – Optional UserRPC object.
A URL string.
Raises-
BlobKeyRequiredError – If a blob key was not specified in the constructor.
-
UnsupportedSizeError – If you specified an invalid size parameter.
-
BadRequestError – If
crop
andsize
are present in the wrong combination, or ifblob_key
andfilename
are both specified. -
TypeError – If
secure_url
is not a boolean type. -
AccessDeniedError – If
blob_key
refers to a Google Storage object and the application does not have permission to access the object. -
ObjectNotFoundError – If
blob_key
refers to an object that doesn’t exist.
-
- google.appengine.api.images.get_serving_url_async(blob_key, size=None, crop=False, secure_url=None, filename=None, rpc=None)source
Asynchronously obtains a URL that will serve the underlying image.
This URL is served by a high-performance dynamic image serving infrastructure. This URL format also allows dynamic resizing and cropping with certain restrictions. To dynamically resize and crop, specify size and crop arguments, or simply append options to the end of the default URL obtained via this call.
Example:
get_serving_url -> "http://lh3.ggpht.com/SomeCharactersGoesHere"
To get a 32-pixel-sized version (aspect-ratio preserved), append
=s32
to the URL:http://lh3.ggpht.com/SomeCharactersGoesHere=s32
To get a 32-pixel cropped version, append
=s32-c
:http://lh3.ggpht.com/SomeCharactersGoesHere=s32-c
Available sizes are any integer in the range [0, 1600] and is available as
ParametersIMG_SERVING_SIZES_LIMIT
.-
blob_key – The
BlobKey
,BlobInfo
, string, or Unicode representation of theBlobKey
of blob whose URL you require. -
size – Integer of the size of resulting images.
-
crop – Boolean value.
True
requests a cropped image, whileFalse
requests a resized image. -
secure_url – Boolean value.
True
requests ahttps
URL, whileFalse
requests ahttp
URL. -
filename – The file name of a Google Storage object whose URL you require.
-
rpc – Optional UserRPC object.
A UserRPC whose result will be a string that is the serving URL.
Raises-
BlobKeyRequiredError – If a blob key was not specified in the constructor.
-
UnsupportedSizeError – If you specified an invalid size parameter.
-
BadRequestError – If
crop
andsize
are present in the wrong combination, or ifblob_key
andfilename
are both specified. -
TypeError – If
secure_url
is not a boolean type. -
AccessDeniedError – If
blob_key
refers to a Google Storage object and the application does not have permission to access the object.
-
- google.appengine.api.images.histogram(image_data, rpc=None)source
Calculates the histogram of the given image.
Parameters-
image_data – String of the source image data.
-
rpc – An optional UserRPC object.
3 256-element lists containing the number of occurences of each value of each color in the order RGB.
Raises-
NotImageError – If the supplied image data is not an image.
-
BadImageError – If the supplied image data is corrupt.
-
LargeImageError – If the supplied image data is too large to process.
-
Error – All other errors.
-
- google.appengine.api.images.histogram_async(image_data, rpc=None)source
Calculates the histogram of the given image - async version.
Parameters-
image_data – String of the source image data.
-
rpc – An optional UserRPC object.
An UserRPC object.
Raises-
NotImageError – If the supplied image data is not an image.
-
BadImageError – If the supplied image data is corrupt.
-
LargeImageError – If the supplied image data is too large to process.
-
Error – All other errors.
-
- google.appengine.api.images.horizontal_flip(image_data, output_encoding=0, quality=None, correct_orientation=0, rpc=None, transparent_substitution_rgb=None)source
Flips the image horizontally.
Parameters-
image_data – String of the source image data.
-
output_encoding – A value from
OUTPUT_ENCODING_TYPES
. -
quality – A value between 1 and 100 to specify the quality of the encoding. This value is only used to control JPEG quality.
-
correct_orientation – A value from
ORIENTATION_CORRECTION_TYPE
to indicate if orientation correction should be performed during the transformation. -
rpc – An optional UserRPC object.
-
transparent_substitution_rgb – When transparent pixels are not supported in the destination image format, then transparent pixels will be substituted for the specified color, which must be in 32-bit RGB format.
Raw image data of the transformed image.
RaisesError – All errors. See
Image.ExecuteTransforms
for more details.-
- google.appengine.api.images.horizontal_flip_async(image_data, output_encoding=0, quality=None, correct_orientation=0, rpc=None, transparent_substitution_rgb=None)source
Asynchronously flips the image horizontally.
Parameters-
image_data – String of the source image data.
-
output_encoding – A value from
OUTPUT_ENCODING_TYPES
. -
quality – A value between 1 and 100 to specify the quality of the encoding. This value is only used to control JPEG quality.
-
correct_orientation – A value from
ORIENTATION_CORRECTION_TYPE
to indicate if orientation correction should be performed during the transformation. -
rpc – An optional UserRPC object.
-
transparent_substitution_rgb – When transparent pixels are not supported in the destination image format, then transparent pixels will be substituted for the specified color, which must be in 32-bit RGB format.
A UserRPC object; call
Raisesget_result()
to complete the RPC and obtain the crop result.Error – All errors. See
Image.ExecuteTransforms
for more details.-
- google.appengine.api.images.im_feeling_lucky(image_data, output_encoding=0, quality=None, correct_orientation=0, rpc=None, transparent_substitution_rgb=None)source
Automatically adjusts image levels.
This is similar to the “I’m Feeling Lucky” button in Picasa.
Parameters-
image_data – String of the source image data.
-
output_encoding – A value from
OUTPUT_ENCODING_TYPES
. -
quality – A value between 1 and 100 to specify the quality of the encoding. This value is only used to control JPEG quality.
-
correct_orientation – A value from
ORIENTATION_CORRECTION_TYPE
to indicate if orientation correction should be performed during the transformation. -
rpc – An optional UserRPC object.
-
transparent_substitution_rgb – When transparent pixels are not supported in the destination image format, then transparent pixels will be substituted for the specified color, which must be in 32-bit RGB format.
Raw image data of the transformed image.
RaisesError – All errors. See
Image.ExecuteTransforms
for more details.-
- google.appengine.api.images.im_feeling_lucky_async(image_data, output_encoding=0, quality=None, correct_orientation=0, rpc=None, transparent_substitution_rgb=None)source
Asynchronously automatically adjusts image levels.
This is similar to the “I’m Feeling Lucky” button in Picasa.
Parameters-
image_data – String of the source image data.
-
output_encoding – A value from
OUTPUT_ENCODING_TYPES
. -
quality – A value between 1 and 100 to specify the quality of the encoding. This value is only used to control JPEG quality.
-
correct_orientation – A value from
ORIENTATION_CORRECTION_TYPE
to indicate if orientation correction should be performed during the transformation. -
rpc – An optional UserRPC object.
-
transparent_substitution_rgb – When transparent pixels are not supported in the destination image format, then transparent pixels will be substituted for the specified color, which must be in 32-bit RGB format.
A UserRPC object.
RaisesError – All errors. See
Image.ExecuteTransforms
for more details.-
- google.appengine.api.images.resize(image_data, width=0, height=0, output_encoding=0, quality=None, correct_orientation=0, crop_to_fit=False, crop_offset_x=0.5, crop_offset_y=0.5, allow_stretch=False, rpc=None, transparent_substitution_rgb=None)source
Resizes a given image file while maintaining the aspect ratio.
If both
width
andheight
are specified, the more restricting of the two values will be used when resizing the image. The maximum dimension allowed for both width and height is 4000 pixels.If both
Parameterswidth
andheight
are specified andcrop_to_fit
isTrue
, the less restricting of the two values will be used when resizing and the image will be cropped to fit the specified size. In this case, the center of cropping can be adjusted bycrop_offset_x
andcrop_offset_y
.-
image_data – String of the source image data.
-
width – Integer of the width (in pixels) to change the image width to.
-
height – Integer of the height (in pixels) to change the image height to.
-
output_encoding – A value from
OUTPUT_ENCODING_TYPES
. -
quality – A value between 1 and 100 to specify the quality of the encoding. This value is only used to control JPEG quality.
-
correct_orientation – A value from
ORIENTATION_CORRECTION_TYPE
to indicate if orientation correction should be performed during the transformation. -
crop_to_fit – If
True
, and bothwidth
andheight
are specified, the image is cropped after being resized to fit the specified dimensions. -
crop_offset_x – Float value between 0.0 and 1.0. 0 is left and 1 is right. The default value is 0.5, or the center of image.
-
crop_offset_y – Float value between 0.0 and 1.0. 0 is top and 1 is bottom. The default value is 0.5, or the center of image.
-
allow_stretch – If
True
, and bothwidth
andheight
are specified, the image is stretched to fit the resized dimensions without maintaining the aspect ratio. -
rpc – Optional UserRPC object.
-
transparent_substitution_rgb – When transparent pixels are not supported in the destination image format, then transparent pixels will be substituted for the specified color, which must be in 32-bit RGB format.
Raw image data of the resized image.
Raises-
TypeError – When
width
orheight
are not of integer or long type. -
BadRequestError – When the specified
width
orheight
is invalid. -
Error – All other errors. See
Image.ExecuteTransforms
for more details.
-
- google.appengine.api.images.resize_async(image_data, width=0, height=0, output_encoding=0, quality=None, correct_orientation=0, crop_to_fit=False, crop_offset_x=0.5, crop_offset_y=0.5, allow_stretch=False, rpc=None, transparent_substitution_rgb=None)source
Asynchronously resizes an image file, maintaining the aspect ratio.
If both
width
andheight
are specified, the more restricting of the two values will be used when resizing the image. The maximum dimension allowed for both width and height is 4000 pixels.If both
Parameterswidth
andheight
are specified andcrop_to_fit
isTrue
, the less restricting of the two values will be used when resizing and the image will be cropped to fit the specified size. In this case, the center of cropping can be adjusted bycrop_offset_x
andcrop_offset_y
.-
image_data – String of the source image data.
-
width – Integer of the width in pixels to change the image width to.
-
height – Integer of the height in pixels to change the image height to.
-
output_encoding – A value from
OUTPUT_ENCODING_TYPES
. -
quality – A value between 1 and 100 to specify the quality of the encoding. This value is only used to control JPEG quality.
-
correct_orientation – A value from
ORIENTATION_CORRECTION_TYPE
to indicate if orientation correction should be performed during the transformation. -
crop_to_fit – If
True
, and bothwidth
andheight
are specified, the image is cropped after being resized to fit the specified dimensions. -
crop_offset_x – Float value between 0.0 and 1.0. 0 is left and 1 is right. The default value is 0.5, or the center of image.
-
crop_offset_y – Float value between 0.0 and 1.0. 0 is top and 1 is bottom. The default value is 0.5, or the center of image.
-
allow_stretch – If
True
, and bothwidth
andheight
are specified, the image is stretched to fit the resized dimensions without maintaining the aspect ratio. -
rpc – Optional UserRPC object.
-
transparent_substitution_rgb – When transparent pixels are not supported in the destination image format, then transparent pixels will be substituted for the specified color, which must be in 32-bit RGB format.
A UserRPC object; call
Raisesget_result()
to obtain the result of the RPC.-
TypeError – When
width
orheight
are not of integer or long type. -
BadRequestError – When the specified
width
orheight
is invalid. -
Error – All other errors. See
Image.ExecuteTransforms
for more details.
-
- google.appengine.api.images.rotate(image_data, degrees, output_encoding=0, quality=None, correct_orientation=0, rpc=None, transparent_substitution_rgb=None)source
Rotates an image a given number of degrees clockwise.
Parameters-
image_data – String of the source image data.
-
degrees – A value from
ROTATE_DEGREE_VALUES
. -
output_encoding – A value from
OUTPUT_ENCODING_TYPES
. -
quality – A value between 1 and 100 to specify the quality of the encoding. This value is only used to control JPEG quality.
-
correct_orientation – A value from
ORIENTATION_CORRECTION_TYPE
to indicate if orientation correction should be performed during the transformation. -
rpc – An optional UserRPC object.
-
transparent_substitution_rgb – When transparent pixels are not supported in the destination image format, then transparent pixels will be substituted for the specified color, which must be in 32-bit RGB format.
Raw image data of the rotated image.
Raises-
TypeError – When
degrees
is not of integer or long type. -
BadRequestError – When the specified
degrees
value is invalid. -
Error – All other errors. See
Image.ExecuteTransforms
for more details.
-
- google.appengine.api.images.rotate_async(image_data, degrees, output_encoding=0, quality=None, correct_orientation=0, rpc=None, transparent_substitution_rgb=None)source
Asynchronously rotates an image a specified number of degrees clockwise.
Parameters-
image_data – String of the source image data.
-
degrees – A value from
ROTATE_DEGREE_VALUES
. -
output_encoding – A value from
OUTPUT_ENCODING_TYPES
. -
quality – A value between 1 and 100 to specify the quality of the encoding. This value is only used to control JPEG quality.
-
correct_orientation – A value from
ORIENTATION_CORRECTION_TYPE
to indicate if orientation correction should be performed during the transformation. -
rpc – An optional UserRPC object.
-
transparent_substitution_rgb – When transparent pixels are not supported in the destination image format, then transparent pixels will be substituted for the specified color, which must be in 32-bit RGB format.
A UserRPC object; call
Raisesget_result()
to complete the RPC and obtain the crop result.-
TypeError – When
degrees
is not of integer or long type. -
BadRequestError – When the specified
degrees
value is invalid. -
Error – All other errors. See
Image.ExecuteTransforms
for more details.
-
- google.appengine.api.images.vertical_flip(image_data, output_encoding=0, quality=None, correct_orientation=0, rpc=None, transparent_substitution_rgb=None)source
Flips the image vertically.
Parameters-
image_data – String of the source image data.
-
output_encoding – A value from
OUTPUT_ENCODING_TYPES
. -
quality – A value between 1 and 100 to specify the quality of the encoding. This value is only used to control JPEG quality.
-
correct_orientation – A value from
ORIENTATION_CORRECTION_TYPE
to indicate if orientation correction should be performed during the transformation. -
rpc – An optional UserRPC object.
-
transparent_substitution_rgb – When transparent pixels are not supported in the destination image format, then transparent pixels will be substituted for the specified color, which must be in 32-bit RGB format.
Raw image data of the transformed image.
RaisesError – All errors. See
Image.ExecuteTransforms
for more details.-
- google.appengine.api.images.vertical_flip_async(image_data, output_encoding=0, quality=None, correct_orientation=0, rpc=None, transparent_substitution_rgb=None)source
Asynchronously flips the image vertically.
Parameters-
image_data – String of the source image data.
-
output_encoding – A value from
OUTPUT_ENCODING_TYPES
. -
quality – A value between 1 and 100 to specify the quality of the encoding. This value is only used to control JPEG quality.
-
correct_orientation – A value from
ORIENTATION_CORRECTION_TYPE
to indicate if orientation correction should be performed during the transformation. -
rpc – An optional UserRPC object.
-
transparent_substitution_rgb – When transparent pixels are not supported in the destination image format, then transparent pixels will be substituted for the specified color, which must be in 32-bit RGB format.
A UserRPC object; call
Raisesget_result()
to complete the RPC and obtain the crop result.Error – All errors. See
Image.ExecuteTransforms
for more details.-