mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 18:14:26 +00:00
dspace-api: comment ImageMagick filters
Add some comments to document the functionality of the ImageMagick thumbnail filters. This will help others understand it later when we need to re-factor them.
This commit is contained in:
@@ -22,7 +22,9 @@ public class ImageMagickPdfThumbnailFilter extends ImageMagickThumbnailFilter {
|
|||||||
File f2 = null;
|
File f2 = null;
|
||||||
File f3 = null;
|
File f3 = null;
|
||||||
try {
|
try {
|
||||||
|
// Step 1: get an image from our PDF file, with PDF-specific processing options
|
||||||
f2 = getImageFile(f, verbose);
|
f2 = getImageFile(f, verbose);
|
||||||
|
// Step 2: use the image above to create the final resized and rotated thumbnail
|
||||||
f3 = getThumbnailFile(f2, verbose);
|
f3 = getThumbnailFile(f2, verbose);
|
||||||
byte[] bytes = Files.readAllBytes(f3.toPath());
|
byte[] bytes = Files.readAllBytes(f3.toPath());
|
||||||
return new ByteArrayInputStream(bytes);
|
return new ByteArrayInputStream(bytes);
|
||||||
|
@@ -116,6 +116,13 @@ public abstract class ImageMagickThumbnailFilter extends MediaFilter {
|
|||||||
return f2;
|
return f2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an image from a bitstream with specific processing options for
|
||||||
|
* PDFs. This is only used by ImageMagickPdfThumbnailFilter in order to
|
||||||
|
* generate an intermediate image file for use with getThumbnailFile. It
|
||||||
|
* is unfortunate that this means we convert from PDF to JPEG to JPEG,
|
||||||
|
* which incurs generation loss.
|
||||||
|
*/
|
||||||
public File getImageFile(File f, boolean verbose)
|
public File getImageFile(File f, boolean verbose)
|
||||||
throws IOException, InterruptedException, IM4JavaException {
|
throws IOException, InterruptedException, IM4JavaException {
|
||||||
File f2 = new File(f.getParentFile(), f.getName() + ".jpg");
|
File f2 = new File(f.getParentFile(), f.getName() + ".jpg");
|
||||||
|
Reference in New Issue
Block a user