org.jpedal.io
Class ColorSpaceConvertor

java.lang.Object
  extended by org.jpedal.io.ColorSpaceConvertor

public class ColorSpaceConvertor
extends java.lang.Object

set of static methods to save/load objects to convert images between different colorspaces - Several methods are very similar and I should recode my code to use a common method for the RGB conversion LogWriter is JPedal logging class


Field Summary
static boolean isUsingARGB
          Flag to trigger raster printing
static boolean wasRemoved
           
 
Constructor Summary
ColorSpaceConvertor()
           
 
Method Summary
static java.awt.image.BufferedImage algorithmicConvertCMYKImageToRGB(byte[] buffer, int w, int h)
          save raw CMYK data by converting to RGB using algorithm method - pdfsages supplied the C source and I have converted - This works very well on most colours but not dark shades which are all rolled into black This is what xpdf seems to use - Note we store the output data in our input queue to reduce memory usage - we have seen raw 2000 * 2000 images and having input and output buffers is a LOT of memory - I have kept the doubles in as I just rewrote Leonard's code - I haven't really looked at optimisation beyond memory issues
static java.awt.image.BufferedImage algorithmicConvertCMYKImageToRGB(java.awt.image.DataBuffer data, int w, int h, boolean debug)
          save raw CMYK data by converting to RGB using algorithm method - pdfsages supplied the C source and I have converted - This works very well on most colours but not dark shades which are all rolled into black
static java.awt.image.BufferedImage convertColorspace(java.awt.image.BufferedImage image, int newType)
          convert a BufferedImage to RGB colourspace
static java.awt.image.BufferedImage convertFromICCCMYK(int width, int height, byte[] data, java.awt.color.ColorSpace cs)
          slightly contrived but very effective way to convert to RGB
static java.awt.image.BufferedImage convertFromICCCMYK(int width, int height, java.awt.image.DataBuffer db, java.awt.color.ColorSpace cs)
          slightly contrived but very effective way to convert to RGB
static java.awt.image.BufferedImage convertIndexedToFlat(int d, int w, int h, byte[] data, byte[] index, int size, boolean isARGB, boolean isDownsampled)
           
static byte[] convertIndexToRGB(byte[] data, java.awt.color.ColorSpace cs)
          slightly contrived but very effective way to convert CMYK CMAP to RGB - I've treated the CMAP as an image and converted the values Default is CMYK, but I am trying to allow for other ColorSpaces
static java.awt.image.BufferedImage convertToARGB(java.awt.image.BufferedImage image)
          convert a BufferedImage to RGB colourspace (used when I clip the image)
static java.awt.image.BufferedImage convertToRGB(java.awt.image.BufferedImage image)
          convert any BufferedImage to RGB colourspace
static java.awt.image.BufferedImage iccConvertCMYKImageToRGB(byte[] buffer, int w, int h, java.lang.String profile)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wasRemoved

public static boolean wasRemoved

isUsingARGB

public static boolean isUsingARGB
Flag to trigger raster printing

Constructor Detail

ColorSpaceConvertor

public ColorSpaceConvertor()
Method Detail

convertFromICCCMYK

public static java.awt.image.BufferedImage convertFromICCCMYK(int width,
                                                              int height,
                                                              byte[] data,
                                                              java.awt.color.ColorSpace cs)
slightly contrived but very effective way to convert to RGB


convertFromICCCMYK

public static java.awt.image.BufferedImage convertFromICCCMYK(int width,
                                                              int height,
                                                              java.awt.image.DataBuffer db,
                                                              java.awt.color.ColorSpace cs)
slightly contrived but very effective way to convert to RGB


convertIndexToRGB

public static byte[] convertIndexToRGB(byte[] data,
                                       java.awt.color.ColorSpace cs)
slightly contrived but very effective way to convert CMYK CMAP to RGB - I've treated the CMAP as an image and converted the values Default is CMYK, but I am trying to allow for other ColorSpaces


convertToRGB

public static final java.awt.image.BufferedImage convertToRGB(java.awt.image.BufferedImage image)
convert any BufferedImage to RGB colourspace


convertToARGB

public static final java.awt.image.BufferedImage convertToARGB(java.awt.image.BufferedImage image)
convert a BufferedImage to RGB colourspace (used when I clip the image)


algorithmicConvertCMYKImageToRGB

public static java.awt.image.BufferedImage algorithmicConvertCMYKImageToRGB(byte[] buffer,
                                                                            int w,
                                                                            int h)
save raw CMYK data by converting to RGB using algorithm method - pdfsages supplied the C source and I have converted - This works very well on most colours but not dark shades which are all rolled into black This is what xpdf seems to use - Note we store the output data in our input queue to reduce memory usage - we have seen raw 2000 * 2000 images and having input and output buffers is a LOT of memory - I have kept the doubles in as I just rewrote Leonard's code - I haven't really looked at optimisation beyond memory issues


algorithmicConvertCMYKImageToRGB

public static java.awt.image.BufferedImage algorithmicConvertCMYKImageToRGB(java.awt.image.DataBuffer data,
                                                                            int w,
                                                                            int h,
                                                                            boolean debug)
save raw CMYK data by converting to RGB using algorithm method - pdfsages supplied the C source and I have converted - This works very well on most colours but not dark shades which are all rolled into black


convertIndexedToFlat

public static java.awt.image.BufferedImage convertIndexedToFlat(int d,
                                                                int w,
                                                                int h,
                                                                byte[] data,
                                                                byte[] index,
                                                                int size,
                                                                boolean isARGB,
                                                                boolean isDownsampled)

iccConvertCMYKImageToRGB

public static java.awt.image.BufferedImage iccConvertCMYKImageToRGB(byte[] buffer,
                                                                    int w,
                                                                    int h,
                                                                    java.lang.String profile)
                                                             throws java.io.IOException
Throws:
java.io.IOException

convertColorspace

public static final java.awt.image.BufferedImage convertColorspace(java.awt.image.BufferedImage image,
                                                                   int newType)
convert a BufferedImage to RGB colourspace