diff --git a/Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java b/Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java index 51f4a4c7e5..fc418a005f 100755 --- a/Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java +++ b/Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java @@ -504,87 +504,6 @@ public class ImageUtils { return fileHeaderBuffer; } - /** - * Generate an icon and save it to specified location. - * - * @param file File to generate icon for - * @param iconSize size in pixels of the thumbnail - * @param cacheFile Location to save thumbnail to - * - * @return Generated icon or null on error - */ - private static BufferedImage generateAndSaveThumbnail(AbstractFile file, int iconSize, File cacheFile) { - BufferedImage thumbnail = null; - try { - if (VideoUtils.isVideoThumbnailSupported(file)) { - if (openCVLoaded) { - thumbnail = VideoUtils.generateVideoThumbnail(file, iconSize); - } else { - return DEFAULT_THUMBNAIL; - } - } else { - thumbnail = generateImageThumbnail(file, iconSize); - } - - if (thumbnail == null) { - return DEFAULT_THUMBNAIL; - - } else { - BufferedImage toSave = thumbnail; - imageSaver.execute(() -> { - try { - Files.createParentDirs(cacheFile); - if (cacheFile.exists()) { - cacheFile.delete(); - } - ImageIO.write(toSave, FORMAT, cacheFile); - } catch (IllegalArgumentException | IOException ex1) { - LOGGER.log(Level.WARNING, COULD_NOT_WRITE_CACHE_THUMBNAIL + file, ex1); - } - }); - } - } catch (NullPointerException ex) { - LOGGER.log(Level.WARNING, COULD_NOT_WRITE_CACHE_THUMBNAIL + file, ex); - } - return thumbnail; - } - - /** - * Generate and return a scaled image - * - * @param content - * @param iconSize - * - * @return a Thumbnail of the given content at the given size, or null if - * there was a problem. - */ - @Nullable - private static BufferedImage generateImageThumbnail(AbstractFile content, int iconSize) { - - try { - final ReadImageTask readImageTask = new ReadImageTask(content); - - readImageTask.run(); - BufferedImage bi = SwingFXUtils.fromFXImage(readImageTask.get(), null); - - if (bi == null) { - return null; - } - try { - return ScalrWrapper.resizeFast(bi, iconSize); - } catch (IllegalArgumentException e) { - // if resizing does not work due to extreme aspect ratio, - // crop the image instead. - return ScalrWrapper.cropImage(bi, Math.min(iconSize, bi.getWidth()), Math.min(iconSize, bi.getHeight())); - } - } catch (OutOfMemoryError e) { - LOGGER.log(Level.WARNING, "Could not scale image (too large) " + content.getName() + ": " + e.toString()); //NON-NLS //NOI18N - } catch (Exception e) { - LOGGER.log(Level.WARNING, "ImageIO could not load image " + content.getName() + ": " + e.toString()); //NON-NLS //NOI18N - } - return null; - } - /** * Get the width of the given image, in pixels. * diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java index 7865f6ca67..fb08256f83 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java @@ -36,7 +36,6 @@ import javax.annotation.Nonnull; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.text.WordUtils; import org.sleuthkit.autopsy.casemodule.Case; -import org.sleuthkit.autopsy.coreutils.ImageUtils; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.imagegallery.FileTypeUtils; import org.sleuthkit.autopsy.imagegallery.ThumbnailCache; @@ -293,7 +292,7 @@ public abstract class DrawableFile extends AbstractFile try { imageRef = new SoftReference<>(readImageTask.get()); } catch (InterruptedException | ExecutionException exception) { - ImageUtils.logContentError(LOGGER, Level.WARNING, getMessageTemplate(exception), this); + LOGGER.log(Level.WARNING, getMessageTemplate(exception), getContentPathSafe()); } break; }