Merge pull request #925 from tuub/DS-2550

DS-2550: fix ImageMagick/Ghostscript problems with transparent pdfs
This commit is contained in:
Pascal-Nicolas Becker
2015-04-27 14:30:36 +02:00
2 changed files with 13 additions and 0 deletions

View File

@@ -38,6 +38,7 @@ public abstract class ImageMagickThumbnailFilter extends MediaFilter implements
{
private static int width = 180;
private static int height = 120;
private static boolean flatten = true;
static String bitstreamDescription = "IM Thumbnail";
static final String defaultPattern = "Generated Thumbnail";
static Pattern replaceRegex = Pattern.compile(defaultPattern);
@@ -48,6 +49,7 @@ public abstract class ImageMagickThumbnailFilter extends MediaFilter implements
ProcessStarter.setGlobalSearchPath(s);
width = ConfigurationManager.getIntProperty("thumbnail.maxwidth", width);
height = ConfigurationManager.getIntProperty("thumbnail.maxheight", height);
flatten = ConfigurationManager.getBooleanProperty(pre + ".flatten", flatten);
String description = ConfigurationManager.getProperty(pre + ".bitstreamDescription");
if (description != null) {
bitstreamDescription = description;
@@ -132,6 +134,10 @@ public abstract class ImageMagickThumbnailFilter extends MediaFilter implements
IMOperation op = new IMOperation();
String s = "[" + page + "]";
op.addImage(f.getAbsolutePath()+s);
if (flatten)
{
op.flatten();
}
op.addImage(f2.getAbsolutePath());
if (MediaFilterManager.isVerbose) {
System.out.println("IM Image Param: "+op);

View File

@@ -497,6 +497,13 @@ filter.org.dspace.app.mediafilter.ImageMagickPdfThumbnailFilter.inputFormats = A
#
# bitstream descriptions that do not conform to the following regular expression will not be overwritten
# org.dspace.app.mediafilter.ImageMagickThumbnailFilter.replaceRegex = ^Generated Thumbnail$
#
# While PDFs may contain transparent spaces, JPEG cannot. As DSpace use JPEG
# for the generated thumbnails, PDF containing transparent spaces may lead
# to problems. To solve this the exported PDF page is flatten before it is
# resized and stored as JPEG. You can switch this behavior off by setting the
# next property false, if necessary for any reasons.
# org.dspace.app.mediafilter.ImageMagickThumbnailFilter.flatten = true
#### Crosswalk and Packager Plugin Settings ####
# Crosswalks are used to translate external metadata formats into DSpace's internal format (DIM)