|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mycore.services.imaging.MCRImgProcessor
public class MCRImgProcessor
This implementation of ImgProcessor is responsible for the manipulation of
image data. It offers methods for scaling and croping of an image and a two
encoding possibility (JPEG, TIFF). For TIFF-Encoding ones can set the tile
size, default tile size is 480.
| Field Summary | |
|---|---|
static int |
JPEG_ENC
The JPEG encoder |
static int |
PNG_ENC
The PNG encoder |
protected float |
scaleFactor
|
static int |
TIFF_ENC
The TIFF encoder |
| Constructor Summary | |
|---|---|
MCRImgProcessor()
|
|
| Method Summary | |
|---|---|
void |
encode(InputStream input,
OutputStream output,
int encoder)
Change the format of an image. |
void |
encode(OutputStream output)
|
void |
encode(OutputStream output,
int encoder)
|
void |
encodeIO(OutputStream output,
String type)
|
Dimension |
getCurrentSize()
Returns the size of the edited image. |
String |
getFileFormat()
|
Dimension |
getImageSize(InputStream input)
Returns the size of the image which is passed as InputStream. |
float |
getJpegQuality()
Return the JPEG quality setting of the image processor. |
Dimension |
getOrigSize()
Returns the original image size of the image currently loades in the processor. |
float |
getScaleFactor()
Returns the scale factor used for the accomplished scale operation. |
boolean |
hasCorrectTileSize()
Check if an image loaded into the processor has the correct tile size. |
boolean |
isTransparent()
|
void |
jpegEncode(OutputStream output)
Encode the loaded image as a JPEG image to a given OutputStream. |
void |
loadImage(InputStream input)
Loads an image into the processor. |
javax.media.jai.PlanarImage |
loadImageFileCache(InputStream input)
loadImageFileCache - load an input stream of image data into to JAI. |
javax.media.jai.PlanarImage |
loadImageIO(InputStream input)
|
void |
pngEncode(OutputStream output)
|
void |
resize(InputStream input,
int newWidth,
int newHeight,
OutputStream output)
Scales the image to fit into the new width and height in due proportion and encode it depending on the encoder setting of the ImgProcessor. |
void |
resize(int newWidth,
int newHeight)
Scales the image to fit into the new width and height in due proportion. |
void |
resizeFitHeight(InputStream input,
int newHeight,
OutputStream output)
Scales the image to the new height and encode it depending on the encoder setting of the ImgProcessor. |
void |
resizeFitHeight(int newHeight)
Scales the image to the new height in due proportion. |
void |
resizeFitWidth(InputStream input,
int newWidth,
OutputStream output)
Scales the image to the new width in due proportion and encode it depending on the encoder setting of the ImgProcessor. |
void |
resizeFitWidth(int newWidth)
Scales the image to the new width in due proportion. |
void |
scale(float scaleFactor)
Scales the image with the given scale factor in due proportion. |
void |
scale(InputStream input,
float scaleFactor,
OutputStream output)
Scales the image with the given scale factor in due proportion and encode it depending on the encoder setting of the ImgProcessor. |
void |
scaleROI(InputStream input,
int xTopPos,
int yTopPos,
int boundWidth,
int boundHeight,
float scaleFactor,
OutputStream output)
Scales the image with the given scale factor in due proportion cut off a region of interest and encode it depending on the encoder setting of the ImgProcessor. |
void |
scaleROI(int xTopPos,
int yTopPos,
int boundWidth,
int boundHeight,
float scaleFactor)
Scales the image with the given scale factor in due proportion cut off a region of interest and encode it depending on the encoder setting of the ImgProcessor. |
void |
setFileFormat(String fileFormat)
|
void |
setJpegQuality(float jpegQuality)
Set the JPEG quality of the image processor. |
void |
setScaleFactor(float scaleFactor)
|
void |
setTileSize(int tileWidth,
int tileHeight)
Set the tile width and height for a TIFF image, which is used in the encoding process. |
void |
setTransparent(boolean transparent)
|
void |
tiffEncode(OutputStream output)
Encode the loaded image as a TIFF image to a given OutputStream. |
void |
useEncoder(int Encoder)
Set which encoder to use in the encoding process. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected float scaleFactor
public static final int JPEG_ENC
public static final int TIFF_ENC
public static final int PNG_ENC
| Constructor Detail |
|---|
MCRImgProcessor()
| Method Detail |
|---|
public float getJpegQuality()
ImgProcessor
getJpegQuality in interface ImgProcessorpublic void setJpegQuality(float jpegQuality)
ImgProcessor
setJpegQuality in interface ImgProcessorjpegQuality - the float value of the JPEG quality
public void setTileSize(int tileWidth,
int tileHeight)
ImgProcessor
setTileSize in interface ImgProcessor
public void useEncoder(int Encoder)
throws Exception
ImgProcessor
useEncoder in interface ImgProcessorEncoder - the encoder should be a static field variable of the impleming
class e.g. ImplementedClass.JPEG
Exception - if you enter a number which is not in the encoder list
public void resizeFitWidth(InputStream input,
int newWidth,
OutputStream output)
ImgProcessor
resizeFitWidth in interface ImgProcessorinput - the image data as InputStreamnewWidth - the new widthoutput - the scaled and encoded image as OutputStream
public void resizeFitHeight(InputStream input,
int newHeight,
OutputStream output)
ImgProcessor
resizeFitHeight in interface ImgProcessorinput - the image data as InputStreamnewHeight - the new heightoutput - the scaled and encoded image as OutputStream
public void resize(InputStream input,
int newWidth,
int newHeight,
OutputStream output)
ImgProcessor
resize in interface ImgProcessorinput - the image data as InputStreamnewWidth - the new width to fit innewHeight - the new height to fit inoutput - the scaled and encoded image as OutputStream
public void scale(InputStream input,
float scaleFactor,
OutputStream output)
ImgProcessor
scale in interface ImgProcessorinput - the image data as InputStreamscaleFactor - the scale factor for width and heightoutput - the scaled and encoded image as OutputStream
public void scaleROI(InputStream input,
int xTopPos,
int yTopPos,
int boundWidth,
int boundHeight,
float scaleFactor,
OutputStream output)
ImgProcessor
scaleROI in interface ImgProcessorinput - the image data as InputStreamxTopPos - the x-coordinate of the top left position of the region of
interestyTopPos - the y-coordinate of the top left position of the region of
interestboundWidth - the width of the region of interestboundHeight - the height of the region of interestscaleFactor - the scale factor for width and height of the imageoutput - the scaled and encoded region of interest as OutputStreampublic float getScaleFactor()
ImgProcessor
getScaleFactor in interface ImgProcessor
public Dimension getOrigSize()
throws Exception
ImgProcessor
getOrigSize in interface ImgProcessorException - if no image is loaded in the processor
public Dimension getCurrentSize()
throws Exception
ImgProcessor
getCurrentSize in interface ImgProcessorException - if no image is loaded in the processorpublic Dimension getImageSize(InputStream input)
ImgProcessor
getImageSize in interface ImgProcessorinput - the image data as InputStream
public void encode(InputStream input,
OutputStream output,
int encoder)
throws Exception
ImgProcessor
encode in interface ImgProcessorinput - the image data as InputStreamoutput - the image in a new formatencoder - the encoder should be a static field variable of the impleming
class e.g. ImplementedClass.JPEG
Exception - if you enter a number which is not in the encoder listpublic void loadImage(InputStream input)
ImgProcessor
loadImage in interface ImgProcessorinput - the image data as InputStreampublic javax.media.jai.PlanarImage loadImageIO(InputStream input)
public boolean hasCorrectTileSize()
ImgProcessor
hasCorrectTileSize in interface ImgProcessorpublic void resizeFitWidth(int newWidth)
ImgProcessor
resizeFitWidth in interface ImgProcessornewWidth - the new widthpublic void resizeFitHeight(int newHeight)
ImgProcessor
resizeFitHeight in interface ImgProcessornewHeight - the new height
public void resize(int newWidth,
int newHeight)
ImgProcessor
resize in interface ImgProcessornewWidth - new width to fit innewHeight - new height to fit inpublic void scale(float scaleFactor)
ImgProcessor
scale in interface ImgProcessorscaleFactor - the scale factor for width and height of the image
public void scaleROI(int xTopPos,
int yTopPos,
int boundWidth,
int boundHeight,
float scaleFactor)
ImgProcessor
scaleROI in interface ImgProcessorxTopPos - the x-coordinate of the top left position of the region of
interestyTopPos - the y-coordinate of the top left position of the region of
interestboundWidth - the width of the region of interestboundHeight - the height of the region of interestscaleFactor - the scale factor for width and height of the imagepublic void jpegEncode(OutputStream output)
ImgProcessor
jpegEncode in interface ImgProcessoroutput - the encoded image
public void encodeIO(OutputStream output,
String type)
public void tiffEncode(OutputStream output)
ImgProcessor
tiffEncode in interface ImgProcessoroutput - the encodes imagepublic void pngEncode(OutputStream output)
public javax.media.jai.PlanarImage loadImageFileCache(InputStream input)
input -
public void encode(OutputStream output,
int encoder)
public void encode(OutputStream output)
public void setScaleFactor(float scaleFactor)
public boolean isTransparent()
public void setTransparent(boolean transparent)
public String getFileFormat()
public void setFileFormat(String fileFormat)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||