com.google.appengine.api.images
Interface ImagesService


public interface ImagesService

The images service provides methods to apply transformations to images.


Nested Class Summary
static class ImagesService.OutputEncoding
          Valid output encoding formats usable for image transforms.
 
Field Summary
static int MAX_COMPOSITES_PER_REQUEST
           
static int MAX_RESIZE_DIMENSIONS
           
static int MAX_TRANSFORMS_PER_REQUEST
           
 
Method Summary
 Image applyTransform(Transform transform, Image image)
          Applies the provided transform to the provided image encoding the transformed image stored using PNG file format.
 Image applyTransform(Transform transform, Image image, ImagesService.OutputEncoding encoding)
          Applies the provided transform to the provided image encoding the transformed image stored using encoding file format.
 Image composite(java.util.Collection<Composite> composites, int width, int height, long color)
          Applies the provided Collection of Composites using a canvas with dimensions determined by width and height and background color color.
 Image composite(java.util.Collection<Composite> composites, int width, int height, long color, ImagesService.OutputEncoding encoding)
          Applies the provided Collection of Composites using a canvas with dimensions determined by width and height and background color color.
 int[][] histogram(Image image)
          Calculates the histogram of the image.
 

Field Detail

MAX_TRANSFORMS_PER_REQUEST

static final int MAX_TRANSFORMS_PER_REQUEST
See Also:
Constant Field Values

MAX_RESIZE_DIMENSIONS

static final int MAX_RESIZE_DIMENSIONS
See Also:
Constant Field Values

MAX_COMPOSITES_PER_REQUEST

static final int MAX_COMPOSITES_PER_REQUEST
See Also:
Constant Field Values
Method Detail

applyTransform

Image applyTransform(Transform transform,
                     Image image)
Applies the provided transform to the provided image encoding the transformed image stored using PNG file format. The transform is applied in place to the provided image.

Parameters:
transform - transform to be applied
image - image to be transformed
Returns:
transformed image
Throws:
java.lang.IllegalArgumentException - If transform or image are invalid.
ImagesServiceFailureException - If there is a problem with the Images Service

applyTransform

Image applyTransform(Transform transform,
                     Image image,
                     ImagesService.OutputEncoding encoding)
Applies the provided transform to the provided image encoding the transformed image stored using encoding file format. The transform is applied in place to the provided image.

Parameters:
transform - transform to be applied
image - image to be transformed
encoding - output encoding to be used
Returns:
transformed image
Throws:
java.lang.IllegalArgumentException - If transform, image or encoding are invalid.
ImagesServiceFailureException - If there is a problem with the Images Service

composite

Image composite(java.util.Collection<Composite> composites,
                int width,
                int height,
                long color)
Applies the provided Collection of Composites using a canvas with dimensions determined by width and height and background color color. Uses PNG as its output encoding.

Parameters:
composites - Compositing operations to be applied.
width - Width of the canvas in pixels.
height - Height of the canvas in pixels.
color - Background color of the canvas in ARGB format.
Returns:
A new image containing the result of composition.
Throws:
java.lang.IllegalArgumentException - If width or height is greater than 4000, color is outside the range [0, 0xffffffff], composites contains more than 16 elements or something is wrong with the contents of composites.
ImagesServiceFailureException - If there is a problem with the Images Service

composite

Image composite(java.util.Collection<Composite> composites,
                int width,
                int height,
                long color,
                ImagesService.OutputEncoding encoding)
Applies the provided Collection of Composites using a canvas with dimensions determined by width and height and background color color.

Parameters:
composites - Compositing operations to be applied.
width - Width of the canvas in pixels.
height - Height of the canvas in pixels.
color - Background color of the canvas in ARGB format.
encoding - Encoding to be used for the resulting image.
Returns:
A new image containing the result of composition.
Throws:
java.lang.IllegalArgumentException - If width or height is greater than 4000, color is outside the range [0, 0xffffffff], composites contains more than 16 elements or something is wrong with the contents of composites.
ImagesServiceFailureException - If there is a problem with the Images Service

histogram

int[][] histogram(Image image)
Calculates the histogram of the image.

Parameters:
image - image for which to calculate a histogram
Returns:
An array of 3 arrays of length 256, each containing the image histogram for one color channel. The channels are ordered RGB from entry 0 to 3. Each channel ranges from 0 where the color is not present to 255 where the color is fully bright.