}
}
private void runReaders(List profiles, ImageSessionContext isc, String uri,
String mime, ImageFlavor rawFlavor) throws Exception {
ImageLoaderFactory ilfs[] = ImageImplRegistry.getDefaultInstance()
.getImageLoaderFactories(mime);
if (ilfs != null) {
for (int i = 0; i < ilfs.length; i++) {
ImageLoaderFactory ilf = ilfs[i];
try {
final ImageLoader il = ilf.newImageLoader(rawFlavor);
if (il instanceof ImageLoaderRawPNG || il instanceof ImageLoaderPNG) {
// temporary measure until ImageLoaderRawPNG and ImageLoader PNG handle ICC profiles
continue;
}
final ImageInfo im = new ImageInfo(uri, mime);
final Image img = il.loadImage(im, isc);
final ICC_Profile icc = img.getICCProfile();
// Assume the profile can only be correct if the image could
// actually be interpreted.
if (img.getColorSpace() != null) {
profiles.add(icc);
}
} catch (IllegalArgumentException e) {
// Ignore. This imageLoader does not support RAW
}
try {
final ImageLoader il = ilf.newImageLoader(ImageFlavor.BUFFERED_IMAGE);
final ImageInfo im = new ImageInfo(uri, mime);
final Image img = il.loadImage(im, isc);
final ICC_Profile icc = img.getICCProfile();
profiles.add(icc);
} catch (IllegalArgumentException e) {