Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.6
Description
While converting a PDPage to a BufferedImage (using the PDFRenderer) Images-Resources located in the PDPage gets loaded in a WriteableRaster and a given Colorspace.
These get converted to a BufferedImage (with PDDeviceRGB.toRGBImage()). But the Type of the returing BufferedImage is with the given Raster and Colorspace always from Type "BufferedImage.TYPE_CUSTOM" instead of the expected "BufferedImage.TYPE_INT_RGB" for example.
Consequences:
Image-Processing-Operations with/on BufferedImages with TYPE_CUSTOM are not optimized in Java (slower) and partialy runs through "Synchronized" Blocks.
==> Converting different Documents in different Threads are blocking each other.
"Quick"-Fix for seeing a Performance-Improvement in a Multithreading Environment:
@Override public BufferedImage toRGBImage(WritableRaster raster) throws IOException { init(); ColorModel colorModel = new ComponentColorModel(awtColorSpace, false, false, Transparency.OPAQUE, raster.getDataBuffer().getDataType()); BufferedImage image = new BufferedImage(colorModel, raster, false, null); BufferedImage dest = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_RGB); ColorConvertOp op = new ColorConvertOp(dest.getColorModel().getColorSpace(), null); return op.filter(image, dest); }
Attachments
Attachments
Issue Links
- is related to
-
PDFBOX-3860 TilingPaint.getImage() should return an ARGB-Typed-Image
- Closed