Date: Tue, 19 Mar 2024 02:44:17 -0400 (EDT) Message-ID: <2010728982.8663.1710830657969@lyrasis1-roc-mp1> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_8662_2030403228.1710830657969" ------=_Part_8662_2030403228.1710830657969 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
The ImageMagick Media Filters provide consistent, high quality thumbnail= s for image bitstreams and PDF bitstreams.
These filters require a separate software installation of the conversion= utilities (ImageMagick and Ghostscript).
The media filters use the library im4java to invo= ke the conversion utilities. This library constructs a conversio= n command launches a sub-process to perform the generation of media files.<= /p>
/usr/bin
)In the filter.plugins section of your dspace.cf= g file, uncomment the ImageMagick media filter definition.
Ima= geMagick Image Thumbnail, ImageMagick PDF Thumbnail, \
This will activate the following settings which are already present in <= strong>dspace.cfg:
org= .dspace.app.mediafilter.ImageMagickImageThumbnailFilter =3D ImageMagick Ima= ge Thumbnail, \ org.dspace.app.mediafilter.ImageMagickPdfThumbnailFilter =3D ImageMagic= k PDF Thumbnail
These media filters contain the several properties which can be configur= ed.
The following properties are used to define the dimensions of the genera= ted thumbnails.
# maxim= um width and height of generated thumbnails thumbnail.maxwidth =3D 80 thumbnail.maxheight =3D 80
The following property provides a path to the ImageMagick and GhostScrip= t utilities.
org.dsp= ace.app.mediafilter.ImageMagickThumbnailFilter.ProcessStarter =3D /usr/bin<= /pre>
The ImageMagick media filters can differentiate thumbnails created by th= e DSpace default thumbnail generator and thumbnails that were manually uplo= aded by a user. The media filter reads the bitstream description fiel= d to make this determination. A regular expression can be provided to= define the set of thumbnails that should be overwritten by the ImageMagick= thumbnail generator. Thumbnail descriptions matching this pattern will be = overwritten even if the -f option is not passed to the filter media process= .
org.dsp= ace.app.mediafilter.ImageMagickThumbnailFilter.replaceRegex =3D ^Generated = Thumbnail$
The ImageMagick media filter will use the bitstream description field to= identify bitstreams that it has created using the following setting.  = ;Bitstreams containing this label will be overwritten only if the -f filter= is applied.
org.dsp= ace.app.mediafilter.ImageMagickThumbnailFilter.bitstreamDescription =3D IM = Thumbnail
Thumbnail descriptions that do not match either of the patterns listed a= bove are presumed to be manually uploaded thumbnails. These thumbnail= s will not be replaced even if the -f option is passed to the filter media = process.
DSpaces uses JPEG as format for thumbnails. While JPEG doesn't support t= ransparency, PDF, PNG and other formats does. As those formats are used as = outgoing material in DSpace, DSpace has to care about transparency during t= he generation of the thumbnails. In combination of special versions of Imag= eMagick and Ghostscript it may occur, that completely transparent areas wil= l become black. As solution ImageMagick recommends to flatten images extrac= ted from PDFs before they are stored as JPEG. Since DSpace 5.2 the ImageMag= ick media filter flatten thumbnails extracted from PDFs. If you run in to p= roblems you lead back to flattening of the extracted images, you can switch= the flattening off by setting the following property in dspace.cfg to fals= e:
org.dsp= ace.app.mediafilter.ImageMagickThumbnailFilter.flatten =3D false
PDFs optimized for physical printing often use the CMYK color space. On = the web, however, the de facto color system is sRGB. By default, DSpace's I= mageMagick-based thumbnailing system will create thumbnails that use the sa= me color space as the source PDF. Most web browsers are not able to correct= ly display images that use the CMYK color space, which leads to images with= visibly inaccurate colors. Furthermore, the JSPUI currently does not suppo= rt the display of thumbnails that use the CMYK color space (see DS-2834).
If you are using Ghostscript version 9 or above, it is possible for DSpa= ce to correctly convert images from CMYK to sRGB by providing it with appro= priate ICC color profiles to use during thumbnail creation. Default ones ar= e provided by most Ghostscript installations (version 9 or above). The foll= owing configuration options tell DSpace where those ICC profiles are locate= d.
# org.d= space.app.mediafilter.ImageMagickThumbnailFilter.cmyk_profile =3D /usr/shar= e/ghostscript/9.18/iccprofiles/default_cmyk.icc # org.dspace.app.mediafilter.ImageMagickThumbnailFilter.srgb_profile =3D /u= sr/share/ghostscript/9.18/iccprofiles/default_rgb.icc
You may need to adjust those paths for your OS or the version of Ghostsc= ript that you have.
Providing ICC profiles to ImageMagick is optional. If these configuratio= n properties are unset, no profiles will be supplied to ImageMagick, and th= umbnails produced from PDFs using the CMYK color space will also use CMYK. = The transformation from CMYK to RGB is optional, but keep in mind that thum= bnails using CMYK will cause problems if you use JSPUI and display thumbnai= ls on browse and search pages (see DS-2834).
The ImageMagick conversion software provides a large number of conversio= n options. Subclasses of these media filters could be written to take= advantage of the additional conversion properties available in the softwar= e.
Note: The PDF thumbnail generator is hard-coded to generate a thumbnail = from the first page of the PDF.
On Ubuntu (possibly other OSes), you may see errors like these when atte= mpting to generate PDF thumbnails:
ERROR f= iltering, skipping bitstream: Item Handle: 1234/5678 Bundle Name: ORIGINAL File Size: 30406135 Checksum: c1df4b3a4755e9bed956383b61fc5042 (MD5) Asset Store: 0 org.im4java.core.CommandException: org.im4java.core.CommandException: conve= rt.im6: not authorized `/tmp/impdfthumb6294641076817830415.pdf' @ error/con= stitute.c/ReadImage/454. OR org.im4java.core.CommandException: convert-im6.q16: attempt to perform an o= peration not allowed by the security policy 'PDF' @ error/constitute.c/IsCo= derAuthorized/421
These may be caused by a change in your ImageMagick policy configuration o=
n your server.
In Ubuntu, the default "policy.xml" was recently updated to exclude all Ghostscript formats (including PDF, PS, etc).&nb= sp; See this ticket: http= s://bugs.launchpad.net/ubuntu/+source/imagemagick/+bug/1796563
The newly added lines in the /etc/ImageMagick/policy.xml
ar=
e these ones:
<!--= disable ghostscript format types --> <policy domain=3D"coder" rights=3D"none" pattern=3D"PS" /> <policy domain=3D"coder" rights=3D"none" pattern=3D"EPS" /> <policy domain=3D"coder" rights=3D"none" pattern=3D"PDF" /> <policy domain=3D"coder" rights=3D"none" pattern=3D"XPS" />
If you wish to re-enable ImageMagick to process Ghostscript format types= , you can simply comment out those lines in the configuration file. B= e aware that, as the fix to this vulnerability is not yet verified, you sho= uld only do so at your own risk.