use of digilib.util.ImageSize in project digilib by robcast.
the class ImageJobDescription method getWx.
/**
* Return the relative x-offset of the image area.
* Uses wx parameter.
* Converts wx in pixels to relative.
*
* @return
* @throws IOException
*/
public Float getWx() throws IOException {
// logger.debug("get_paramWX()");
if (paramWX == null) {
paramWX = getAsFloat("wx");
if (hasOption(DigilibOption.pxarea)) {
// area in absolute pixels - convert to relative
ImageSize imgSize = getHiresSize();
paramWX = paramWX / imgSize.getWidth();
} else if (hasOption(DigilibOption.sqarea)) {
// square full size area
hiresSize = getHiresSize();
float aspect = hiresSize.getAspect();
if (aspect < 1) {
// portrait
paramWX = 0f;
} else {
// landscape
paramWX = (1f - (1f / aspect)) / 2f;
}
}
}
return paramWX;
}
use of digilib.util.ImageSize in project digilib by robcast.
the class ImageLoaderDocuImage method getSize.
/*
* returns the size of the current image
* @see digilib.image.DocuImageImpl#getSize()
*/
public ImageSize getSize() {
if (imageSize == null) {
int h = 0;
int w = 0;
try {
if (img == null) {
reader = getReader(input);
// get size from ImageReader
h = reader.getHeight(0);
w = reader.getWidth(0);
} else {
// get size from image
h = img.getHeight();
w = img.getWidth();
}
imageSize = new ImageSize(w, h);
} catch (IOException e) {
logger.debug("error in getSize:", e);
}
}
return imageSize;
}
use of digilib.util.ImageSize in project digilib by robcast.
the class ImageSet method getNextBigger.
/**
* Get the next bigger ImageFile than the given size.
*
* Returns the ImageFile from the set that has a width or height bigger or
* equal the given size. Returns null if there isn't any bigger image.
*
* @param size
* @param info
* @return
*/
public ImageInput getNextBigger(ImageSize size) {
for (ListIterator<ImageInput> i = getLoresIterator(); i.hasPrevious(); ) {
ImageInput f = i.previous();
ImageSize is = f.getSize();
if (is != null && is.isBiggerThan(size)) {
return f;
}
}
return null;
}
Aggregations