java.lang.Object
org.sejda.sambox.pdmodel.graphics.image.SampledImageReader
Reads a sampled image from a PDF file.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static BufferedImageapplyColorKeyMask(BufferedImage image, BufferedImage mask) private static BufferedImageprivate static BufferedImagefrom8bit(PDImage pdImage, WritableRaster raster) private static BufferedImagefromAny(PDImage pdImage, WritableRaster raster, COSArray colorKey) private static float[]getDecodeArray(PDImage pdImage) static WritableRastergetRawRaster(PDImage pdImage) Extract the raw unconverted raster of the given imagestatic BufferedImagegetRGBImage(PDImage pdImage, COSArray colorKey) Returns the content of the given image as an AWT buffered image with an RGB color space.static BufferedImagegetStencilImage(PDImage pdImage, Paint paint) Returns an ARGB image filled with the given paint and using the given image as a mask.private static voidreadRasterFromAny(PDImage pdImage, WritableRaster raster)
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG
-
-
Constructor Details
-
SampledImageReader
private SampledImageReader()
-
-
Method Details
-
getStencilImage
Returns an ARGB image filled with the given paint and using the given image as a mask.- Parameters:
paint- the paint to fill the visible portions of the image with- Returns:
- a masked image filled with the given paint
- Throws:
IOException- if the image cannot be readIllegalStateException- if the image is not a stencil.
-
getRGBImage
Returns the content of the given image as an AWT buffered image with an RGB color space. If a color key mask is provided then an ARGB image is returned instead. This method never returns null.- Parameters:
pdImage- the image to readcolorKey- an optional color key mask- Returns:
- content of this image as an RGB buffered image
- Throws:
IOException- if the image cannot be read
-
getRawRaster
Extract the raw unconverted raster of the given image- Parameters:
pdImage- The image to get the raw raster data from- Returns:
- the raw raster of this image
- Throws:
IOException
-
readRasterFromAny
- Throws:
IOException
-
from1Bit
- Throws:
IOException
-
from8bit
- Throws:
IOException
-
fromAny
private static BufferedImage fromAny(PDImage pdImage, WritableRaster raster, COSArray colorKey) throws IOException - Throws:
IOException
-
applyColorKeyMask
-
getDecodeArray
- Throws:
IOException
-