use of org.apache.poi.sl.image.ImageHeaderBitmap in project poi by apache.
the class XSLFPictureData method cacheProperties.
/**
* Determine and cache image properties
*/
protected void cacheProperties() {
if (origSize == null || checksum == null) {
byte[] data = getData();
checksum = IOUtils.calculateChecksum(data);
PictureType pt = getType();
if (pt == null) {
origSize = new Dimension(1, 1);
return;
}
switch(pt) {
case EMF:
origSize = new ImageHeaderEMF(data, 0).getSize();
break;
case WMF:
// wmf files in pptx usually have their placeable header
// stripped away, so this returns only the dummy size
origSize = new ImageHeaderWMF(data, 0).getSize();
break;
case PICT:
origSize = new ImageHeaderPICT(data, 0).getSize();
break;
default:
origSize = new ImageHeaderBitmap(data, 0).getSize();
break;
}
}
}
Aggregations