Revision created by MOE tool push_codebase.
[gae.git] / java / src / main / com / google / appengine / api / images / Image.java
blob519c2972c0cce5630d0b7f3c6b004caef3c9046d
1 // Copyright 2009 Google Inc. All Rights Reserved.
3 package com.google.appengine.api.images;
5 import com.google.appengine.api.blobstore.BlobKey;
7 import java.io.Serializable;
9 /**
10 * {@code Image} represents an image that can be manipulated by the
11 * {@link ImagesService}.
14 public interface Image extends Serializable {
16 /**
17 * Image formats usable by the images api.
19 public enum Format {PNG, JPEG, GIF, TIFF, BMP, ICO, WEBP}
21 /**
22 * Gets the width of the image.
23 * @return image width
24 * @throws IllegalArgumentException If the {@code imageData} provided is
25 * invalid
27 public int getWidth();
29 /**
30 * Gets the height of the image.
31 * @return image height
32 * @throws IllegalArgumentException If the {@code imageData} provided is
33 * invalid
35 public int getHeight();
37 /**
38 * Gets the encoding format of the image.
39 * @return image format
40 * @throws IllegalArgumentException If the {@code imageData} provided is
41 * invalid
43 public Format getFormat();
45 /**
46 * Gets the raw imageData of the image.
47 * @return the image data of the image
49 public byte[] getImageData();
51 /**
52 * Sets the image to contain the image data contained in {@code imageData}.
53 * @param imageData new image data for the image to store
54 * @throws IllegalArgumentException If {@code imageData} is null or empty
56 public void setImageData(byte[] imageData);
58 /**
59 * If this image is backed by a blob, return the associated {@link
60 * BlobKey}. If this method returns non-{@code null}, none of the
61 * other methods will currently be available.
63 public BlobKey getBlobKey();