Example usage for com.lowagie.text Image ORIGINAL_PNG

List of usage examples for com.lowagie.text Image ORIGINAL_PNG

Introduction

In this page you can find the example usage for com.lowagie.text Image ORIGINAL_PNG.

Prototype

int ORIGINAL_PNG

To view the source code for com.lowagie.text Image ORIGINAL_PNG.

Click Source Link

Document

type of image

Usage

From source file:codes.thischwa.jii.core.iTextImageWrapper.java

License:Apache License

@Override
public void set(File file) throws FileNotFoundException, ReadException {
    if (!file.exists())
        throw new FileNotFoundException("File not found: " + file.getAbsolutePath());
    try {//from w ww  .  j a  v a 2 s  . c  o  m
        image = Image.getInstance(file.getAbsolutePath());
    } catch (Exception e) {
        throw new ReadException(e);
    }

    int type = image.getOriginalType();
    switch (type) {
    case Image.ORIGINAL_BMP:
        imageType = ImageType.BMP;
        break;
    case Image.ORIGINAL_GIF:
        imageType = ImageType.GIF;
        break;
    case Image.ORIGINAL_JPEG:
    case Image.ORIGINAL_JPEG2000:
        imageType = ImageType.JPG;
        break;
    case Image.ORIGINAL_PNG:
        imageType = ImageType.PNG;
        break;
    default: {
        logger.warn("Couldn't analyse format from {} or image type isn't supported.", file.getAbsolutePath());
        imageType = null;
    }
    }
}