mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-13 13:03:11 +00:00
Merge pull request #925 from tuub/DS-2550
DS-2550: fix ImageMagick/Ghostscript problems with transparent pdfs
This commit is contained in:
@@ -38,6 +38,7 @@ public abstract class ImageMagickThumbnailFilter extends MediaFilter implements
|
|||||||
{
|
{
|
||||||
private static int width = 180;
|
private static int width = 180;
|
||||||
private static int height = 120;
|
private static int height = 120;
|
||||||
|
private static boolean flatten = true;
|
||||||
static String bitstreamDescription = "IM Thumbnail";
|
static String bitstreamDescription = "IM Thumbnail";
|
||||||
static final String defaultPattern = "Generated Thumbnail";
|
static final String defaultPattern = "Generated Thumbnail";
|
||||||
static Pattern replaceRegex = Pattern.compile(defaultPattern);
|
static Pattern replaceRegex = Pattern.compile(defaultPattern);
|
||||||
@@ -48,6 +49,7 @@ public abstract class ImageMagickThumbnailFilter extends MediaFilter implements
|
|||||||
ProcessStarter.setGlobalSearchPath(s);
|
ProcessStarter.setGlobalSearchPath(s);
|
||||||
width = ConfigurationManager.getIntProperty("thumbnail.maxwidth", width);
|
width = ConfigurationManager.getIntProperty("thumbnail.maxwidth", width);
|
||||||
height = ConfigurationManager.getIntProperty("thumbnail.maxheight", height);
|
height = ConfigurationManager.getIntProperty("thumbnail.maxheight", height);
|
||||||
|
flatten = ConfigurationManager.getBooleanProperty(pre + ".flatten", flatten);
|
||||||
String description = ConfigurationManager.getProperty(pre + ".bitstreamDescription");
|
String description = ConfigurationManager.getProperty(pre + ".bitstreamDescription");
|
||||||
if (description != null) {
|
if (description != null) {
|
||||||
bitstreamDescription = description;
|
bitstreamDescription = description;
|
||||||
@@ -132,6 +134,10 @@ public abstract class ImageMagickThumbnailFilter extends MediaFilter implements
|
|||||||
IMOperation op = new IMOperation();
|
IMOperation op = new IMOperation();
|
||||||
String s = "[" + page + "]";
|
String s = "[" + page + "]";
|
||||||
op.addImage(f.getAbsolutePath()+s);
|
op.addImage(f.getAbsolutePath()+s);
|
||||||
|
if (flatten)
|
||||||
|
{
|
||||||
|
op.flatten();
|
||||||
|
}
|
||||||
op.addImage(f2.getAbsolutePath());
|
op.addImage(f2.getAbsolutePath());
|
||||||
if (MediaFilterManager.isVerbose) {
|
if (MediaFilterManager.isVerbose) {
|
||||||
System.out.println("IM Image Param: "+op);
|
System.out.println("IM Image Param: "+op);
|
||||||
|
@@ -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
|
# bitstream descriptions that do not conform to the following regular expression will not be overwritten
|
||||||
# org.dspace.app.mediafilter.ImageMagickThumbnailFilter.replaceRegex = ^Generated Thumbnail$
|
# 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 ####
|
#### Crosswalk and Packager Plugin Settings ####
|
||||||
# Crosswalks are used to translate external metadata formats into DSpace's internal format (DIM)
|
# Crosswalks are used to translate external metadata formats into DSpace's internal format (DIM)
|
||||||
|
Reference in New Issue
Block a user