import mir.storage.DatabaseFailure;
import mir.util.StreamCopier;
import mir.media.image.ImageProcessor;
-import mir.media.image.JAIImageProcessor;
+// FIXME: delete this when finished testing ImageMagickImageProcessor
+//import mir.media.image.JAIImageProcessor;
+import mir.media.image.ImageMagickImageProcessor;
public class EntityImages extends EntityUploadedMedia
{
public void setImage(InputStream anInputStream, String type) throws DatabaseFailure {
if (anInputStream != null) {
try {
- ByteArrayOutputStream inputData = new ByteArrayOutputStream();
- StreamCopier.copy(anInputStream, inputData);
+ // FIXME: delete this when finished testing ImageMagickImageProcessor
+ //ByteArrayOutputStream inputData = new ByteArrayOutputStream();
+ //StreamCopier.copy(anInputStream, inputData);
- ImageProcessor processor = new JAIImageProcessor(inputData.toByteArray());
+ ImageProcessor processor = new ImageMagickImageProcessor(anInputStream);
+ // FIXME: delete this when finished testing ImageMagickImageProcessor
+ //ImageProcessor processor = new JAIImageProcessor(inputData.toByteArray());
processor.descaleImage(maxImageSize, minDescaleRatio, minDescaleReduction);
ByteArrayOutputStream imageData = new ByteArrayOutputStream();
setFieldValue("icon_height", new Integer(processor.getScaledHeight()).toString());
setFieldValue("icon_width", new Integer(processor.getScaledWidth()).toString());
-
+ processor.cleanup();
update();
}
catch (Exception e) {