|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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
|
static java.util.Set<java.lang.Integer> |
SERVING_CROP_SIZES
Valid sizes for crop operation with URLs from getServingUrl(BlobKey) and
getServingUrl(BlobKey, int, boolean) . |
static java.util.Set<java.lang.Integer> |
SERVING_SIZES
Valid sizes for resize operation with URLs from getServingUrl(BlobKey) and
getServingUrl(BlobKey, int, boolean) . |
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 Composite s 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 Composite s using a
canvas with dimensions determined by width and height
and background color color . |
java.lang.String |
getServingUrl(BlobKey blobKey)
Obtains a URL that can serve the image stored as a blob dynamically. |
java.lang.String |
getServingUrl(BlobKey blobKey,
int imageSize,
boolean crop)
Calculates the serving URL for specific size and crop parameters from generic URL returned by getServingUrl(BlobKey) . |
int[][] |
histogram(Image image)
Calculates the histogram of the image. |
Field Detail |
---|
static final int MAX_TRANSFORMS_PER_REQUEST
static final int MAX_RESIZE_DIMENSIONS
static final int MAX_COMPOSITES_PER_REQUEST
static final java.util.Set<java.lang.Integer> SERVING_SIZES
getServingUrl(BlobKey)
and
getServingUrl(BlobKey, int, boolean)
.
Values: 0, 32, 48, 64, 72, 80, 90, 94, 104, 110, 120, 128, 144, 150, 160, 200, 220, 288, 320, 400, 512, 576, 640, 720, 800, 912, 1024, 1152, 1280, 1440, 1600
static final java.util.Set<java.lang.Integer> SERVING_CROP_SIZES
getServingUrl(BlobKey)
and
getServingUrl(BlobKey, int, boolean)
.
Values: 32, 48, 64, 72, 80, 104, 136, 144, 150, 160
Method Detail |
---|
Image applyTransform(Transform transform, Image image)
transform
to the provided image
encoding the transformed image stored using PNG file format. The
transform is applied in place to the provided image.
transform
- transform to be appliedimage
- image to be transformed
java.lang.IllegalArgumentException
- If transform
or image
are invalid.
ImagesServiceFailureException
- If there is a problem with the
Images ServiceImage applyTransform(Transform transform, Image image, ImagesService.OutputEncoding encoding)
transform
to the provided image
encoding the transformed image stored using encoding
file
format. The transform is applied in place to the provided image.
transform
- transform to be appliedimage
- image to be transformedencoding
- output encoding to be used
java.lang.IllegalArgumentException
- If transform
, image
or
encoding
are invalid.
ImagesServiceFailureException
- If there is a problem with the
Images ServiceImage composite(java.util.Collection<Composite> composites, int width, int height, long color)
Collection
of Composite
s using a
canvas with dimensions determined by width
and height
and background color color
. Uses PNG as its output encoding.
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.
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 ServiceImage composite(java.util.Collection<Composite> composites, int width, int height, long color, ImagesService.OutputEncoding encoding)
Collection
of Composite
s using a
canvas with dimensions determined by width
and height
and background color color
.
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.
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 Serviceint[][] histogram(Image image)
image
- image for which to calculate a histogram
java.lang.String getServingUrl(BlobKey blobKey)
This URL is served by a high-performance dynamic image serving
infrastructure that is available globally. This URL format also allows
dynamic resizing and crop with certain restrictions. To get dynamic
resizing and cropping simply append options to the end of the url obtained
via this call. Here is an example:
getServingUrl -> "http://lh3.ggpht.com/SomeCharactersGoesHere"
To get a 32 pixel sized version (aspect-ratio preserved) simply append
"=s32" to the url:
"http://lh3.ggpht.com/SomeCharactersGoesHere=s32"
To get a 32 pixel cropped version simply append "=s32-c":
"http://lh3.ggpht.com/SomeCharactersGoesHere=s32-c"
Valid sizes are also available as SERVING_SIZES
and
SERVING_CROP_SIZES
sets.
blobKey
- blob key of the image to serve by the returned URL.
java.lang.IllegalArgumentException
- If blob key is not valid or doesn't contain
an image.
ImagesServiceFailureException
- If there is a problem with the Images Servicejava.lang.String getServingUrl(BlobKey blobKey, int imageSize, boolean crop)
getServingUrl(BlobKey)
.
blobKey
- blob key of the image to serve by the returned URL with
specified size and crop.imageSize
- size of the served image in pixels.crop
- controls whether the image should be resized or cropped.
java.lang.IllegalArgumentException
- If blob key is not valid or doesn't contain
an image or specified size is not supported by the service.
ImagesServiceFailureException
- If there is a problem with the Images ServicegetServingUrl(BlobKey)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |