Package org.dspace.app.mediafilter
Class JPEGFilter
java.lang.Object
org.dspace.app.mediafilter.MediaFilter
org.dspace.app.mediafilter.JPEGFilter
- All Implemented Interfaces:
FormatFilter,SelfRegisterInputFormats
Filter image bitstreams, scaling the image to be within the bounds of
thumbnail.maxwidth, thumbnail.maxheight, the size we want our thumbnail to be
no bigger than. Creates only JPEGs.
- Author:
- Jason Sherman jsherman@usao.edu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionConvenience method that returns a blurred instance of the providedBufferedImage.getDestinationStream(Item currentItem, InputStream source, boolean verbose) Read the source stream and produce the filtered content.getFilteredName(String oldFilename) Get a filename for a newly created filtered bitstreamString[]String[]String[]getScaledInstance(BufferedImage buf, int targetWidth, int targetHeight, Object hint, boolean higherQuality) Convenience method that returns a scaled instance of the providedBufferedImage.getThumb(Item currentItem, BufferedImage buf, boolean verbose) getThumbDim(Item currentItem, BufferedImage buf, boolean verbose, float xmax, float ymax, boolean blurring, boolean hqscaling, int brandHeight, int brandFontPoint, String brandFont) Methods inherited from class org.dspace.app.mediafilter.MediaFilter
postProcessBitstream, preProcessBitstream
-
Constructor Details
-
JPEGFilter
public JPEGFilter()
-
-
Method Details
-
getFilteredName
Description copied from interface:FormatFilterGet a filename for a newly created filtered bitstream- Specified by:
getFilteredNamein interfaceFormatFilter- Parameters:
oldFilename- name of source bitstream- Returns:
- filename generated by the filter - for example, document.pdf becomes document.pdf.txt
-
getBundleName
- Specified by:
getBundleNamein interfaceFormatFilter- Returns:
- String bundle name
-
getFormatString
- Specified by:
getFormatStringin interfaceFormatFilter- Returns:
- String bitstreamformat
-
getDescription
- Specified by:
getDescriptionin interfaceFormatFilter- Returns:
- String description
-
getDestinationStream
public InputStream getDestinationStream(Item currentItem, InputStream source, boolean verbose) throws Exception Description copied from interface:FormatFilterRead the source stream and produce the filtered content.- Specified by:
getDestinationStreamin interfaceFormatFilter- Parameters:
currentItem- itemsource- source input streamverbose- verbose mode- Returns:
- InputStream the resulting input stream
- Throws:
Exception- if error
-
getThumb
- Throws:
Exception
-
getThumbDim
public InputStream getThumbDim(Item currentItem, BufferedImage buf, boolean verbose, float xmax, float ymax, boolean blurring, boolean hqscaling, int brandHeight, int brandFontPoint, String brandFont) throws Exception - Throws:
Exception
-
getInputMIMETypes
- Specified by:
getInputMIMETypesin interfaceSelfRegisterInputFormats
-
getInputDescriptions
- Specified by:
getInputDescriptionsin interfaceSelfRegisterInputFormats
-
getInputExtensions
- Specified by:
getInputExtensionsin interfaceSelfRegisterInputFormats
-
getNormalizedInstance
-
getBlurredInstance
Convenience method that returns a blurred instance of the providedBufferedImage.- Parameters:
buf- buffered image- Returns:
- updated BufferedImage
-
getScaledInstance
public BufferedImage getScaledInstance(BufferedImage buf, int targetWidth, int targetHeight, Object hint, boolean higherQuality) Convenience method that returns a scaled instance of the providedBufferedImage.- Parameters:
buf- the original image to be scaledtargetWidth- the desired width of the scaled instance, in pixelstargetHeight- the desired height of the scaled instance, in pixelshint- one of the rendering hints that corresponds toRenderingHints.KEY_INTERPOLATION(e.g.RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR,RenderingHints.VALUE_INTERPOLATION_BILINEAR,RenderingHints.VALUE_INTERPOLATION_BICUBIC)higherQuality- if true, this method will use a multi-step scaling technique that provides higher quality than the usual one-step technique (only useful in downscaling cases, wheretargetWidthortargetHeightis smaller than the original dimensions, and generally only when theBILINEARhint is specified)- Returns:
- a scaled version of the original
BufferedImage
-