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
public class JPEGFilter extends MediaFilter implements 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 Constructor Description JPEGFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BufferedImagegetBlurredInstance(BufferedImage buf)Convenience method that returns a blurred instance of the providedBufferedImage.StringgetBundleName()StringgetDescription()InputStreamgetDestinationStream(Item currentItem, InputStream source, boolean verbose)Read the source stream and produce the filtered content.StringgetFilteredName(String oldFilename)Get a filename for a newly created filtered bitstreamStringgetFormatString()String[]getInputDescriptions()String[]getInputExtensions()String[]getInputMIMETypes()BufferedImagegetNormalizedInstance(BufferedImage buf)BufferedImagegetScaledInstance(BufferedImage buf, int targetWidth, int targetHeight, Object hint, boolean higherQuality)Convenience method that returns a scaled instance of the providedBufferedImage.InputStreamgetThumb(Item currentItem, BufferedImage buf, boolean verbose)InputStreamgetThumbDim(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
-
-
-
-
Method Detail
-
getFilteredName
public String getFilteredName(String oldFilename)
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
public String getBundleName()
- Specified by:
getBundleNamein interfaceFormatFilter- Returns:
- String bundle name
-
getFormatString
public String getFormatString()
- Specified by:
getFormatStringin interfaceFormatFilter- Returns:
- String bitstreamformat
-
getDescription
public String 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
public InputStream getThumb(Item currentItem, BufferedImage buf, boolean verbose) throws Exception
- 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
public String[] getInputMIMETypes()
- Specified by:
getInputMIMETypesin interfaceSelfRegisterInputFormats
-
getInputDescriptions
public String[] getInputDescriptions()
- Specified by:
getInputDescriptionsin interfaceSelfRegisterInputFormats
-
getInputExtensions
public String[] getInputExtensions()
- Specified by:
getInputExtensionsin interfaceSelfRegisterInputFormats
-
getNormalizedInstance
public BufferedImage getNormalizedInstance(BufferedImage buf)
-
getBlurredInstance
public BufferedImage getBlurredInstance(BufferedImage buf)
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
-
-