We don't keep intermediate images except for patterns and transparency groups. And these intermediate images are usually RGB so they are not really 100% correct.

Or do you want an image of the color chart, like in PDFDebugger?

Tilman

Am 11.07.2022 um 15:13 schrieb Gianluca Sartori:
Dear all,

I need to extract, for each color separation, the rasterized image that
represents it. I need to preview each color of the PDF. This is the code I
came up with, do you know how can I get a BufferedImage?

Or a better way to approach the problem would be really helpful!

Groovy (but you can suggest with Java, no problem with that)

for (page in input.pages) {
     for (name in page.resources.colorSpaceNames) {
         PDColor color = page.resources.getColorSpace(name).initialColor
         PDColorSpace cs = color.getColorSpace()

         if (cs in PDSeparation) {
             WritableRaster raster = ???
             BufferedImage img = cs.toRGBImage(raster)
             results.add(cs.colorantName)
         }
     }
}


Gianluca Sartori
--
Cell. +39 388 1026822



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: users-h...@pdfbox.apache.org

Reply via email to