Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 5E22F200CBB for ; Tue, 4 Jul 2017 20:35:10 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 5C50F161D0A; Tue, 4 Jul 2017 18:35:10 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A3E44161D07 for ; Tue, 4 Jul 2017 20:35:09 +0200 (CEST) Received: (qmail 11950 invoked by uid 500); 4 Jul 2017 18:35:08 -0000 Mailing-List: contact dev-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pdfbox.apache.org Delivered-To: mailing list dev@pdfbox.apache.org Received: (qmail 11939 invoked by uid 99); 4 Jul 2017 18:35:08 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Jul 2017 18:35:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 4CC12D12B0 for ; Tue, 4 Jul 2017 18:35:08 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.211 X-Spam-Level: X-Spam-Status: No, score=-99.211 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id heaqmDxoWVm4 for ; Tue, 4 Jul 2017 18:35:07 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 180875FAEA for ; Tue, 4 Jul 2017 18:35:07 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id ED1DFE08C3 for ; Tue, 4 Jul 2017 18:35:04 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id DC00E24611 for ; Tue, 4 Jul 2017 18:35:02 +0000 (UTC) Date: Tue, 4 Jul 2017 18:35:02 +0000 (UTC) From: "Tilman Hausherr (JIRA)" To: dev@pdfbox.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (PDFBOX-3854) PDDeviceRGB.toRGBImage does not return a RGB-Typed-Image MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 04 Jul 2017 18:35:10 -0000 [ https://issues.apache.org/jira/browse/PDFBOX-3854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16073996#comment-16073996 ] Tilman Hausherr commented on PDFBOX-3854: ----------------------------------------- In the meantime I have tested your change... the times are similar. The best "before change" time was 818secs, the best "after change" time was 835secs. > PDDeviceRGB.toRGBImage does not return a RGB-Typed-Image > -------------------------------------------------------- > > Key: PDFBOX-3854 > URL: https://issues.apache.org/jira/browse/PDFBOX-3854 > Project: PDFBox > Issue Type: Bug > Affects Versions: 2.0.6 > Reporter: Yannick Haser > Attachments: rgbImageExample0.pdf, Starter.java > > > 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: > {code:title=PDDeviceRGB.java|borderStyle=solid} > @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); > } > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org For additional commands, e-mail: dev-help@pdfbox.apache.org