www.dextsolution.com
DEXTUPLOAD
NJ
menu toggleReference > devpia > dextuploadnj > media > ImageTool

devpia.dextuploadnj.media
Class ImageTool

Minimum version supported
1.0.0
Minimum support environment
JRE 1.6
Description

The ImageTool is a class that supports image processing.

It provides simple functions that can process image files uploaded with the DEXTUploadNJ.

Methods

getInstance

  • Returns an ImageTool object from the specified path or object.

  • Signatures

    public static ImageTool getInstance(String filePath)
    public static ImageTool getInstance(File file)
    public static ImageTool getInstance(BufferedImage image)
    public static ImageTool getInstance(FileItem item)
  • Parameters

    Name Type Description
    filePath java.lang.String The path of the image file
    file java.io.File The java.io.File object indicating the image file
    image java.awt.image.BufferedImage The java.awt.image.BufferedImage object
    item devpia.dextuploadnj.FileItem The FileItem object
  • Returns

    The ImageTool object

  • How to use

    // 1 
    ImageTool oimg = ImageTool.getInstance(item.getLastSavedFilePath());
    // 2
    ImageTool oimg = ImageTool.getInstance(new File(item.getLastSavedFilePath()));
    // 3
    ImageTool oimg = ImageTool.getInstance(buffedimg);
    // 4
    ImageTool oimg = ImageTool.getInstance(fileItem);

isImage

  • Returns whether or not the file is an image.

  • Signatures

    public static boolean isImage(String filePath)
    public static boolean isImage(File file)
    public static boolean isImage(FileItem item)
  • Parameters

    Name Type Description
    filePath java.lang.String The path of the target file
    file java.io.File The java.io.File object of the target file
    item devpia.dextuploadnj.FileItem The FileItem object
  • Returns

    true, false

  • How to use

    // 1
    boolean isCheck = ImageTool.isImage(item.getLastSavedFilePath());
    // 2
    boolean isCheck = ImageTool.isImage(new File(item.getLastSavedFilePath()));
    // 3
    boolean isCheck = ImageTool.isImage(fileItem);

getImage

  • Returns the java.awt.image.BufferedImage object.

  • Signatures

    public BufferedImage getImage()
  • Returns

    The java.awt.image.BufferedImage object

  • How to use

    ImageTool oimg = ImageTool.getInstance(new File(item2.getLastSavedFilePath()));
    BufferedImage img = oimg.getImage();

setImage

  • Sets a java.awt.image.BufferedImage object.

  • Signatures

    public void setImage(BufferedImage image)
  • Parameters

    Name Type Description
    image java.awt.image.BufferedImage The java.awt.image.BufferedImage object
  • How to use

    ImageTool oimg = ImageTool.getInstance(new File(item2.getLastSavedFilePath()));
    oimg.setImage(buffedImage);

getImageFile

  • Returns the java.io.File object of the image file.

  • Signatures

    public File getImageFile()
  • Returns

    The java.io.File object

  • How to use

    ImageTool oimg = ImageTool.getInstance(new File(item2.getLastSavedFilePath()));
    oimg.getImageFile();

setImageFile

  • Sets the java.io.File object of the image file.

  • Signatures

    public void setImageFile(File imageFile)
  • Parameters

    Name Type Description
    imageFile java.io.File The java.io.File of the image file
  • How to use

    ImageTool oimg = ImageTool.getInstance(new File(item2.getLastSavedFilePath()));
    oimg.setImageFile(imagefile);

getWidth

  • Returns the horizontal length of the image.

  • Signatures

    public int getWidth()
  • Returns

    The horizontal length(pixel)

  • How to use

    ImageTool oimg = ImageTool.getInstance(new File(item2.getLastSavedFilePath()));
    oimg.getWidth();

getHeight

  • Returns the vertical length of the image.

  • Signatures

    public int getHeight()
  • Returns

    The vertical length(pixel)

  • How to use

    ImageTool oimg = ImageTool.getInstance(new File(item2.getLastSavedFilePath()));
    oimg.getHeight();

resize

  • Returns an ImageTool object with resized image.

  • Signatures

    public ImageTool resize(int width, int height, Object hint, boolean hightQuality)
    public ImageTool resize(float widthRatio, float heightRatio, Object hint, boolean hightQuality) 
  • Parameters

    Name Type Description
    width int The horizontal length(pixel) to resize
    height int The vertical length(pixel) to resize
    hint Object

    The interpolation used when rendering new image. Chooses one of java.awt.RenderingHints.VALUE_INTERPOLATION_BICUBIC, java.awt.RenderingHints.VALUE_INTERPOLATION_BILINEAR, java.awt.RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR.

    hightQuality boolean

    If you try to upgrade the conversion quality, it must set to true, but the conversion speed will be slow.

    widthRatio float The ratio of the horizontal length(0.5f is same to 50%.)
    heightRatio float The ratio of the vertical length(0.5f is same to 50%.)
  • Returns

    An ImageTool object with image information whose size has been changed.

    Note 1) Generally a changed image is a copy of the original image.

    Note 2) The ImageTool object refers to the original image object if the size of the image is not changed.

  • How to use

    ImageTool dimg = oimg.resize(64, 64, RenderingHints.VALUE_INTERPOLATION_BILINEAR, true);
    // or
    ImageTool dimg = oimg.resize(0.5f, 0.5f, RenderingHints.VALUE_INTERPOLATION_BILINEAR, true);
    Source(120x84) Frame(120x140) Result(120x140)

resizeUniform

  • Returns an ImageTool object with resized image. It keeps maintaining the aspect ratio of the original image size, and the size of the image is changed according to the frame size. The finally converted image can be smaller than the frame size.

  • Signatures

    public ImageTool resizeUniform(int width, int height, Object hint, boolean hightQuality)
    public ImageTool resizeUniform(float widthRatio, float heightRatio, Object hint, boolean hightQuality)
  • Parameters

    Name Type Description
    width int The horizontal length(pixel) to resize
    height int The vertical length(pixel) to resize
    hint java.lang.Object

    The interpolation used when rendering new image. Choose one of java.awt.RenderingHints.VALUE_INTERPOLATION_BICUBIC, java.awt.RenderingHints.VALUE_INTERPOLATION_BILINEAR, java.awt.RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR.

    hightQuality boolean

    If you try to upgrade the conversion quality, it must set to true, but the conversion speed will be slow.

    widthRatio float The ratio of the horizontal length(0.5f is same to 50%.)
    heightRatio float The ratio of the vertical length(0.5f is same to 50%.)
  • Returns

    An ImageTool object with image information whose size has been changed.

    Note 1) Generally a changed image is a copy of the original image.

    Note 2) The ImageTool object refers to the original image object if the size of the image is not changed.

  • How to use

    ImageTool dimg = oimg.resizeUniform(300, 200, RenderingHints.VALUE_INTERPOLATION_BILINEAR, true);       
    // or 
    ImageTool dimg = oimg.resizeUniform(0.5f, 0.5f, RenderingHints.VALUE_INTERPOLATION_BILINEAR, true);
    Source(120x84) Frame(120x140) Result(120x84)
    Source(68x44) Frame(120x140) Result(68x44)

resizeUniformToFit

  • Returns an ImageTool object with image information whose size has been changed. It keeps maintaining the aspect ratio of the original image size, and the size of the image is changed according to the frame size.

  • Signatures

    public ImageTool resizeUniformToFit(int width, int height, ImageOption.Position position, Object hint, boolean hightQuality)
    public ImageTool resizeUniformToFit(float widthRatio, float heightRatio, ImageOption.Position position, Object hint, boolean hightQuality) 
    public ImageTool resizeUniformToFit(int width, int height, ImageOption.Position position, Color bgColor, Object hint, boolean hightQuality)
    public ImageTool resizeUniformToFit(float widthRatio, float heightRatio, ImageOption.Position position, Color bgColor, Object hint, boolean hightQuality) 
  • Parameters

    Name Type Description
    width int The horizontal length(pixel) to resize
    height int The vertical length(pixel) to resize
    position devpia.dextuploadnj.media.ImageOption.Position The ImageOption.Position value indicating the position to place the original image at the frame
    bgColor java.awt.Color The background color to fill in the remaining margin when adjusting the original image that is maintained the aspect ratio to fit the frame size
    hint java.lang.Object

    The interpolation used when rendering new image. Choose one of java.awt.RenderingHints.VALUE_INTERPOLATION_BICUBIC, java.awt.RenderingHints.VALUE_INTERPOLATION_BILINEAR, java.awt.RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR.

    hightQuality boolean

    If you try to upgrade the conversion quality, it must set to true, but the conversion speed will be slow.

    widthRatio float The ratio of the horizontal length(0.5f is same to 50%.)
    heightRatio float The ratio of the vertical length(0.5f is same to 50%.)
  • Returns

    An ImageTool object with image information whose size has been changed.

    Note 1) Generally a changed image is a copy of the original image.

    Note 2) The ImageTool object refers to the original image object if the size of the image is not changed.

  • How to use

    // 1
    ImageTool dimg = oimg.resizeUniformToFit(300, 200, ImageOption.Position.CenterMiddle, RenderingHints.VALUE_INTERPOLATION_BILINEAR, true);       
    // 2
    ImageTool dimg = oimg.resizeUniformToFit(0.5f, 0.5f,ImageOption.Position.CenterMiddle, RenderingHints.VALUE_INTERPOLATION_BILINEAR, true);
    // 3
    ImageTool dimg = oimg.resizeUniformToFit(300, 200, ImageOption.Position.CenterMiddle, Color.black, RenderingHints.VALUE_INTERPOLATION_BILINEAR, true);
    // 4
    ImageTool dimg = oimg.resizeUniformToFit(0.5f, 0.5f,ImageOption.Position.CenterMiddle, Color.black, RenderingHints.VALUE_INTERPOLATION_BILINEAR, true);
    Source(120x84) Frame(120x140) Result(120x140)
    Source(68x44) Frame(120x140) Result(120x140)

resizeUniformToFill

  • Returns an ImageTool object with resized image. It keeps maintaining the aspect ratio of the original image size, and the size of the image is changed according to the frame size. If the size of the original image is smaller than the target, enlarges the original image.

  • Signatures

    public ImageTool resizeUniformToFill(int width, int height, ImageOption.Position position, Object hint, boolean hightQuality)
    public ImageTool resizeUniformToFill(float widthRatio, float heightRatio, ImageOption.Position position, Object hint, boolean hightQuality)  
  • Parameters

    Name Type Description
    width int The horizontal length(pixel) to resize
    height int The vertical length(pixel) to resize
    position devpia.dextuploadnj.media.ImageOption.Position The ImageOption.Position value indicating the position to place the original image at the frame
    hint java.lang.Object

    The interpolation used when rendering new image. Choose one of java.awt.RenderingHints.VALUE_INTERPOLATION_BICUBIC, java.awt.RenderingHints.VALUE_INTERPOLATION_BILINEAR, java.awt.RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR.

    hightQuality boolean

    If you try to upgrade the conversion quality, it must set to true, but the conversion speed will be slow.

    widthRatio float The ratio of the horizontal length(0.5f is same to 50%.)
    heightRatio float The ratio of the vertical length(0.5f is same to 50%.)
  • Returns

    An ImageTool object with image information whose size has been changed.

    Note 1) Generally a changed image is a copy of the original image.

    Note 2) The ImageTool object refers to the original image object if the size of the image is not changed.

  • How to use

    ImageTool dimg = oimg.resizeUniformToFill(300, 200, ImageOption.Position.CenterMiddle, RenderingHints.VALUE_INTERPOLATION_BILINEAR, true);
    // or
    ImageTool dimg = oimg.resizeUniformToFill(0.5f, 0.5f,ImageOption.Position.CenterMiddle, RenderingHints.VALUE_INTERPOLATION_BILINEAR, true);
    Source(120x84) Frame(120x140) Result(120x140)
    Source(68x44) Frame(120x140) Result(120x140)

rotate

  • Returns an ImageTool object with rotated image.

  • Signatures

    public ImageTool rotate(double degree, Color bgColor, Object hint) 
  • Parameters

    Name Type Description
    degree double The rotation angle(degree)
    bgColor java.awt.Color The background color to fill in margins
    hint java.lang.Object

    The interpolation used when rendering new image. Choose one of java.awt.RenderingHints.VALUE_INTERPOLATION_BICUBIC, java.awt.RenderingHints.VALUE_INTERPOLATION_BILINEAR, java.awt.RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR.

  • Returns

    An ImageTool object with rotated image information.

    Note 1) Generally a changed image is a copy of the original image.

    Note 2) The ImageTool object refers to the original image object if the rotation angle is not changed or same.

  • How to use

    ImageTool dimg = oimg.rotate(30, Color.red, RenderingHints.VALUE_INTERPOLATION_BILINEAR);

rotateAuto

  • Returns an ImageTool object with the image that is automatically rotated by using rotation information contained in the image. It refers to the Exif Orientation tag of the JPG file for rotating. Since the rotation operation is performed based on the Exif information, the value of the getMetadata method must not be null and the returned ImageMetadata object must have the orientation information.

  • Signatures

    public ImageTool rotateAuto(Object hint) 
  • Parameters

    Name Type Description
    hint java.lang.Object

    The interpolation used when rendering new image. Choose one of java.awt.RenderingHints.VALUE_INTERPOLATION_BICUBIC, java.awt.RenderingHints.VALUE_INTERPOLATION_BILINEAR, java.awt.RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR.

  • Returns

    An ImageTool object with rotated image information.

    Note 1) Generally a changed image is a copy of the original image.

    Note 2) The ImageTool object refers to the original image object if the rotation angle is not changed or same.

    Note 3) If there is no Orientation Exif tag information if it is not JPG formate, automatic rotation processing is not done.

  • How to use

    ImageTool oimg = ImageTool.getInstance(new File(item.getLastSavedFilePath()));                            				            
    ImageTool dimg = oimg.rotateAuto(RenderingHints.VALUE_INTERPOLATION_BILINEAR);  

rotate90CW

  • Returns an ImageTool object with image information rotated clockwise by 90 degrees.

  • Signatures

    public ImageTool rotate90CW(Object hint)
  • Parameters

    Name Type Description
    hint java.lang.Object

    The interpolation used when rendering new image. Choose one of java.awt.RenderingHints.VALUE_INTERPOLATION_BICUBIC, java.awt.RenderingHints.VALUE_INTERPOLATION_BILINEAR, java.awt.RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR.

  • Returns

    An ImageTool object with rotated image information.

    Note 1) Generally a changed image is a copy of the original image.

  • How to use

    ImageTool oimg = ImageTool.getInstance(new File(item.getLastSavedFilePath()));                            				            
    ImageTool dimg = oimg.rotate90CW(RenderingHints.VALUE_INTERPOLATION_BILINEAR); 

rotate90CCW

  • Returns an ImageTool object with image information rotated counterclockwise by 90 degrees.

  • Signatures

    public ImageTool rotate90CCW(Object hint) 
  • Parameters

    Name Type Description
    hint java.lang.Object

    The interpolation used when rendering new image. Choose one of java.awt.RenderingHints.VALUE_INTERPOLATION_BICUBIC, java.awt.RenderingHints.VALUE_INTERPOLATION_BILINEAR, java.awt.RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR.

  • Returns

    An ImageTool object with rotated image information.

    Note 1) Generally a changed image is a copy of the original image.

  • How to use

    ImageTool oimg = ImageTool.getInstance(new File(item.getLastSavedFilePath()));                            				            
    ImageTool dimg = oimg.rotate90CCW(RenderingHints.VALUE_INTERPOLATION_BILINEAR); 

rotate180CW

  • Returns an ImageTool object with image information rotated clockwise by 180 degrees.

  • Signatures

    public ImageTool rotate180CW(Object hint) 
  • Parameters

    Name Type Description
    hint java.lang.Object

    The interpolation used when rendering new image. Choose one of java.awt.RenderingHints.VALUE_INTERPOLATION_BICUBIC, java.awt.RenderingHints.VALUE_INTERPOLATION_BILINEAR, java.awt.RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR.

  • Returns

    An ImageTool object with rotated image information.

    Note 1) Generally a changed image is a copy of the original image.

  • How to use

    ImageTool oimg = ImageTool.getInstance(new File(item.getLastSavedFilePath()));                            				            
    ImageTool dimg = oimg.rotate180CW(RenderingHints.VALUE_INTERPOLATION_BILINEAR); 

rotate180CCW

  • Returns an ImageTool object with image information rotated counterclockwise by 180 degrees.

  • Signatures

    public ImageTool rotate180CCW(Object hint) 
  • Parameters

    Name Type Description
    hint java.lang.Object

    The interpolation used when rendering new image. Choose one of java.awt.RenderingHints.VALUE_INTERPOLATION_BICUBIC, java.awt.RenderingHints.VALUE_INTERPOLATION_BILINEAR, java.awt.RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR.

  • Returns

    An ImageTool object with rotated image information.

    Note 1) Generally a changed image is a copy of the original image.

  • How to use

    ImageTool oimg = ImageTool.getInstance(new File(item.getLastSavedFilePath()));                            				            
    ImageTool dimg = oimg.rotate180CCW(RenderingHints.VALUE_INTERPOLATION_BILINEAR); 

flip

  • Returns an ImageTool object with image information rotated about the X and Y axes.

  • Signatures

    public ImageTool flip(ImageOption.Axis axis, Object hint) 
  • Parameters

    Name Type Description
    axis devpia.dextUploadNJ.media.ImageOption.Axis The devpia.dextuploadnj.media.ImageOption.Axis value indicating the axis to rotate
    hint java.lang.Object

    The interpolation used when rendering new image. Choose one of java.awt.RenderingHints.VALUE_INTERPOLATION_BICUBIC, java.awt.RenderingHints.VALUE_INTERPOLATION_BILINEAR, java.awt.RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR.

  • Returns

    The ImageTool object with image information rotated around the X and Y axes

    Note 1) Generally a changed image is a copy of the original image.

    Note 2) When turning to the X axis, it becomes an upside-down inverted image.

    Note 3) When turning to the Y axis, the image changes to the left and right.

  • How to use

    ImageTool oimg = ImageTool.getInstance(new File(item.getLastSavedFilePath()));                            				            
    ImageTool dimg = oimg.flip(ImageOption.Axis.X, RenderingHints.VALUE_INTERPOLATION_BILINEAR); 

flipX

  • Returns an ImageTool object with image information rotated about the X axis.

  • Signatures

    public ImageTool flipX(Object hint) 
  • Parameters

    Name Type Description
    hint java.lang.Object

    The interpolation used when rendering new image. Choose one of java.awt.RenderingHints.VALUE_INTERPOLATION_BICUBIC, java.awt.RenderingHints.VALUE_INTERPOLATION_BILINEAR, java.awt.RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR.

  • Returns

    The ImageTool object with image information rotated around the X axis

    Note 1) Generally a changed image is a copy of the original image.

    Note 2) When turning to the X axis, it becomes an upside-down inverted image.

  • How to use

    ImageTool oimg = ImageTool.getInstance(new File(item.getLastSavedFilePath()));                            				            
    ImageTool dimg = oimg.flipX(RenderingHints.VALUE_INTERPOLATION_BILINEAR); 

flipY

  • Returns an ImageTool object with image information rotated about the Y axis.

  • Signatures

    public ImageTool flipY(Object hint) 
  • Parameters

    Name Type Description
    hint java.lang.Object

    The interpolation used when rendering new image. Choose one of java.awt.RenderingHints.VALUE_INTERPOLATION_BICUBIC, java.awt.RenderingHints.VALUE_INTERPOLATION_BILINEAR, java.awt.RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR.

  • Returns

    The ImageTool object with image information rotated around the Y axis

    Note 1) Generally a changed image is a copy of the original image.

    Note 2) When turning to the Y axis, the image changes to the left and right.

  • How to use

    ImageTool oimg = ImageTool.getInstance(new File(item.getLastSavedFilePath()));                            				            
    ImageTool dimg = oimg.flipY(RenderingHints.VALUE_INTERPOLATION_BILINEAR); 

crop

  • Returns an ImageTool object with image information copied from a part of the original image.

  • Signatures

    public ImageTool crop(int x, int y, int width, int height) 
  • Parameters

    Name Type Description
    x int The X axis coordinate of the original image
    y int The Y axis coordinate of the original image
    width int The horizontal length(pixel) of the area to be copied
    heigth int The vertical length(pixel) of the area to be copied
  • Returns

    An ImageTool object with image copying from a specified area of the original image

  • How to use

    ImageTool oimg = ImageTool.getInstance(new File(item.getLastSavedFilePath()));                            				            
    ImageTool dimg = oimg.crop(5, 10, 200, 400); 

overlay

  • Returns an ImageTool object with the overlapped an image or a character string.

  • Signatures

    public ImageTool overlay(BufferedImage over, int x, int y, float alpha)
    public ImageTool overlay(BufferedImage over, ImageOption.Position position, float alpha)
    public ImageTool overlay(String text, int x, int y, float alpha, Font font, Color fontColo) 
  • Parameters

    Name Type Description
    over java.awt.image.BufferedImage Overlay target image object
    x int The X axis overlay coordinate of the original image
    y int The Y axis overlay coordinate of the original image
    alpha float The transparency (0.0 f - 1.0 f) of the target image (over)
    position devpia.dextuploadnj.media.ImageOption.Position A value indicating a position to overlay
    text java.lang.String String to be overlaid
    font java.awt.font A java.awt.Font object to render. Caution) Fonts that can not be supported by the system are not applied.
    fontColor java.awt.Color color
  • Returns

    ImageTool object with image information overlaid with the target image (over) in the original image Notes 1) Generally modified images are copies of the original image.

  • How to use

    ImageTool oimg = ImageTool.getInstance(new File(item.getLastSavedFilePath()));    
    //1                        				            
    ImageTool dimg = bimg.overlay(oimg.getImage(), 20, 40, 0.25f);
    //2
    ImageTool cimg = bimg.overlay(oimg.getImage(), ImageOption.Position.CenterMiddle, 0.25f); 
    //3
    ImageTool cimg = bimg.overlay(overText, bimg.getWidth() / 4, bimg.getHeight() / 2, 0.25f, new Font("Font Name", Font.PLAIN + Font.BOLD, 24), Color.pink);

save

  • Save the image object to a file.

  • Signatures

    public String save(File target, ImageOption.Format format)
    public String save(File target, ImageOption.Format format, boolean overwrite)
  • Parameters

    Name Type Description
    target java.io.File The file object to be saved
    format devpia.dextuploadnj.media.ImageOption.Format The image format to be saved
    overwrite boolean If the target file already exists, it is set whether or not to overwrite. The default value is true.
  • Returns

    Path to the saved file (Supported since version 2.13.0)

  • Exception: IOException

  • How to use

    ImageTool oimg = ImageTool.getInstance(item);
    ImageTool dimg = oimg.resize(64, 64, RenderingHints.VALUE_INTERPOLATION_BILINEAR, true);
    dimg.save(new File(repositoryDir, String.format("%s.%s", item.getFilenameWithoutExtension(), fmt.name().toLowerCase())), oimg.getFormat());

saveToJpeg

  • Save the image object as a JPG file.

  • Signatures

    public String saveToJpeg(File target)
    public String saveToJpeg(File target, boolean overwrite)
  • Parameters

    Name Type Description
    target java.io.File The file object to be saved
    overwrite boolean If the target file already exists, it is set whether or not to overwrite. The default value is true.
  • Returns

    Path to the saved file (Supported since version 2.13.0)

  • Exception: IOException

  • How to use

    ImageTool oimg = ImageTool.getInstance(item);
    oimg.saveToJpeg(new File(repositoryDir, item.getFilenameWithoutExtension().concat(".jpg")));

saveToPng

  • Save the image object as a PNG file.

  • Signatures

    public String saveToPng(File target)
    public String saveToPng(File target, boolean overwrite)
  • Parameters

    Name Type Description
    target java.io.File The file object to be saved
    overwrite boolean If the target file already exists, it is set whether or not to overwrite. The default value is true.
  • Returns

    Path to the saved file (Supported since version 2.13.0)

  • Exception: IOException

  • How to use

    ImageTool oimg = ImageTool.getInstance(item);
    oimg.saveToPng(new File(repositoryDir, item.getFilenameWithoutExtension().concat(".png")));

saveToGif

  • Save the image object as a GIF file.

  • Signatures

    public String saveToGif(File target)
    public String saveToGif(File target, boolean overwrite) 
  • Parameters

    Name Type Description
    target java.io.File The file object to be saved
    overwrite boolean If the target file already exists, it is set whether or not to overwrite. The default value is true.
  • Returns

    Path to the saved file (Supported since version 2.13.0)

  • Exception: IOException

  • How to use

    ImageTool oimg = ImageTool.getInstance(item);
    oimg.saveToGif(new File(repositoryDir, item.getFilenameWithoutExtension().concat(".gif")));

saveToBmp

  • Save image object to a BMP file.

  • Signatures

    public String saveToBmp(File target)
    public String saveToBmp(File target, boolean overwrite)
  • Parameters

    Name Type Description
    target java.io.File The file object to be saved
    overwrite boolean If the target file already exists, it is set whether or not to overwrite. The default value is true.
  • Returns

    Path to the saved file (Supported since version 2.13.0)

  • Exception: IOException

  • How to use

    ImageTool oimg = ImageTool.getInstance(item);
    oimg.saveToBmp(new File(repositoryDir, item.getFilenameWithoutExtension().concat(".bmp")));

getMetadata

  • If the target file is JPG, it returns an ImageMetadataobject with Exif, Gps, thumbnail information recorded in the file .

  • Signatures

    public ImageMetadata getMetadata()
  • Returns

    An ImageMetadataobject with Exif, Gps, Thumbnail information , or null if there is no original image or the file is not JPG.

  • How to use

    ImageTool oimg = ImageTool.getInstance(new File(item.getLastSavedFilePath()));
    ImageMetadata metadata = oimg.getMetadata(); 

setMetadata

  • Sets ImageMetadata object with Exif, Gps, Thumbnail information.

  • Signatures

    public void setMetadata(ImageMetadata metadata)
  • Parameters

    Name Type Description
    metadata devpia.dextuploadnj.media.ImageMetadata The ImageMetadata object
  • How to use

    ImageTool oimg = ImageTool.getInstance(new File(item.getLastSavedFilePath()));
    oimg.setMetadata(metadate);