|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.wikimodel.wem.images.ImageUtil
public class ImageUtil
Contains utility methods dealing with images like image size definition or creation of thumbnails (reduced copies of images).
| Constructor Summary | |
|---|---|
ImageUtil()
|
|
| Method Summary | |
|---|---|
static void |
createThumb(InputStream input,
OutputStream output,
int thumbWidth,
int thumbHeight,
String format)
Create a reduced image (thumb) of an image from the given input stream. |
static int[] |
getImageSize(InputStream input)
Returns the size (width and height) of an image from the given input stream. |
static int[] |
getImageSize(InputStream input,
int maxWidth,
int maxHeight)
Returns the possible size of an image from the given input stream; the returned size does not overcome the specified maximal borders but keeps the ratio of the image. |
static int[] |
getNewSize(int width,
int height,
int maxWidth,
int maxHeight)
Calculates new size of an image with the specified max borders keeping the ratio between height and width of the image. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ImageUtil()
| Method Detail |
|---|
public static void createThumb(InputStream input,
OutputStream output,
int thumbWidth,
int thumbHeight,
String format)
throws IOException
input - the input stream containing the image to reduceoutput - the output stream where the resulting reduced image is
writtenthumbWidth - the maximal width of the reduced imagethumbHeight - the maximal height of the reduced imageformat - the output format of the reduced image; it can be "jpg",
"png", ...
IOException
public static int[] getImageSize(InputStream input)
throws IOException
input - the input stream with an image
IOException
public static int[] getImageSize(InputStream input,
int maxWidth,
int maxHeight)
throws IOException
input - the input stream with an imagemaxWidth - the maximal widthmaxHeight - the maximal height
IOException
public static int[] getNewSize(int width,
int height,
int maxWidth,
int maxHeight)
width - the initial width of an imageheight - the initial height of an imagemaxWidth - the maximal width of an imagemaxHeight - the maximal height of an image
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||