H
harryos
hi
I would like to use jai1.1 to read images of any type.Some of the
images may be grayscale pgm , truecolor png or whatever ...
i tried this
public void makeMyImage(String imagename){
RenderedImage im0=JAI.create("fileload",imagename);
Raster rastPic = im0.getData();
int widthPix = rastPic.getWidth();
int heightPix = rastPic.getHeight();
.......
}
in order to use ColorConvertOp i guess i will need to create a
BufferedImage from this .so i try to find if the color type is
TrueColor and make a BufferedImage and then apply ColorConvertOp.But i
don't know which value i should give for the imageType in
BufferedImage constructor.can somebody help with that?
BufferedImage orig;
if(im0.getProperty("color_type")=="Truecolor"){
orig=new BufferedImage(widthPix, heightPix,??);
}
after this i can put the values from Raster into this image
orig.setData( rastPic) ;
then i can apply the ColorConvertOp and create a grayscale
BufferedImage
I don't know if this is the correct way to deal with image types not
supported in std java image api. i couldn't find many examples to
learn from..if some experts can advise it would be a great help
harry
I would like to use jai1.1 to read images of any type.Some of the
images may be grayscale pgm , truecolor png or whatever ...
i tried this
public void makeMyImage(String imagename){
RenderedImage im0=JAI.create("fileload",imagename);
Raster rastPic = im0.getData();
int widthPix = rastPic.getWidth();
int heightPix = rastPic.getHeight();
.......
}
in order to use ColorConvertOp i guess i will need to create a
BufferedImage from this .so i try to find if the color type is
TrueColor and make a BufferedImage and then apply ColorConvertOp.But i
don't know which value i should give for the imageType in
BufferedImage constructor.can somebody help with that?
BufferedImage orig;
if(im0.getProperty("color_type")=="Truecolor"){
orig=new BufferedImage(widthPix, heightPix,??);
}
after this i can put the values from Raster into this image
orig.setData( rastPic) ;
then i can apply the ColorConvertOp and create a grayscale
BufferedImage
I don't know if this is the correct way to deal with image types not
supported in std java image api. i couldn't find many examples to
learn from..if some experts can advise it would be a great help
harry