RE: Extracting/rendering jp2?
Thank you! -Original Message- From: Tilman Hausherr [mailto:thaush...@t-online.de] Sent: Thursday, November 10, 2016 12:33 AM To: users@pdfbox.apache.org Subject: Re: Extracting/rendering jp2? Am 10.11.2016 um 04:29 schrieb Allison, Timothy B.: >>> private static final List JP2 = >>> Arrays.asList(COSName.JPX_DECODE); > Apologies for the ignorance of how inline images are stored, but is there an > equivalent for png or tiff? Or, do we have to decode and re-encode those? There is no equivalent for png. Classic flate encoded images must be decoded and then saved as png if you need them as image files. Re tiff - there is a very similar, but not identical compression on PDF, so these too must be decoded and reencoded (preferably as G4 compressed tiffs because these are very small) Tilman - To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org For additional commands, e-mail: users-h...@pdfbox.apache.org - To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org For additional commands, e-mail: users-h...@pdfbox.apache.org
Re: Extracting/rendering jp2?
Am 10.11.2016 um 04:29 schrieb Allison, Timothy B.: private static final List JP2 = Arrays.asList(COSName.JPX_DECODE); Apologies for the ignorance of how inline images are stored, but is there an equivalent for png or tiff? Or, do we have to decode and re-encode those? There is no equivalent for png. Classic flate encoded images must be decoded and then saved as png if you need them as image files. Re tiff - there is a very similar, but not identical compression on PDF, so these too must be decoded and reencoded (preferably as G4 compressed tiffs because these are very small) Tilman - To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org For additional commands, e-mail: users-h...@pdfbox.apache.org
RE: Extracting/rendering jp2?
Got it. Thank you! -Original Message- From: Tilman Hausherr [mailto:thaush...@t-online.de] Sent: Wednesday, November 9, 2016 3:38 PM To: users@pdfbox.apache.org Subject: Re: Extracting/rendering jp2? Am 09.11.2016 um 21:26 schrieb Allison, Timothy B.: >> what do you need? The image in any format (e.g. png), or the image in the >> original JP2 compression? > Ideally the original JP2 compression. > >> And if you're using ImageIOUtil.writeImage(), what is the parameter in >> suffix? If it is JP2, then you'd need to have some plugin for it. > jpx > >> So it may be better to get the raw file, see in ExtractImages how we do it >> for DCTFilter. > Will do. To confirm, you mean this? > > InputStream data = pdImage.createInputStream(JPEG); > IOUtils.copy(data, out); > IOUtils.closeQuietly(data); Yes - that is the better solution. It makes no sense to decode a JP2 image to recode it in JP2. Instead of JPEG, use this: private static final List JP2 = Arrays.asList(COSName.JPX_DECODE); - To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org For additional commands, e-mail: users-h...@pdfbox.apache.org - To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org For additional commands, e-mail: users-h...@pdfbox.apache.org
Re: Extracting/rendering jp2?
Am 09.11.2016 um 21:26 schrieb Allison, Timothy B.: what do you need? The image in any format (e.g. png), or the image in the original JP2 compression? Ideally the original JP2 compression. And if you're using ImageIOUtil.writeImage(), what is the parameter in suffix? If it is JP2, then you'd need to have some plugin for it. jpx So it may be better to get the raw file, see in ExtractImages how we do it for DCTFilter. Will do. To confirm, you mean this? InputStream data = pdImage.createInputStream(JPEG); IOUtils.copy(data, out); IOUtils.closeQuietly(data); Yes - that is the better solution. It makes no sense to decode a JP2 image to recode it in JP2. Instead of JPEG, use this: private static final List JP2 = Arrays.asList(COSName.JPX_DECODE); - To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org For additional commands, e-mail: users-h...@pdfbox.apache.org
RE: Extracting/rendering jp2?
>what do you need? The image in any format (e.g. png), or the image in the >original JP2 compression? Ideally the original JP2 compression. >And if you're using ImageIOUtil.writeImage(), what is the parameter in suffix? >If it is JP2, then you'd need to have some plugin for it. jpx >So it may be better to get the raw file, see in ExtractImages how we do it for >DCTFilter. Will do. To confirm, you mean this? InputStream data = pdImage.createInputStream(JPEG); IOUtils.copy(data, out); IOUtils.closeQuietly(data); Thank you! - To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org For additional commands, e-mail: users-h...@pdfbox.apache.org