Hi,

When I load a Jpeg with ImageIO.read(stream); I get a BufferedImage of Type 5:

Example:
[EMAIL PROTECTED]: type = 5 ColorModel: #pixelBits = 24 numComponents = 3 color 
space = [EMAIL PROTECTED] transparency = 1 has alpha = false isAlphaPre = false 
ByteInterleavedRaster: width = 1700 height = 2550 #numDataElements 3 dataOff[0] 
= 2


When I now want to use this Type 5 BufferedImage to perform a Filter-Operation 
via:

new ConvolveOp(kernel).filter(src, null);

I get an Error:

Exception in thread "main" java.awt.image.ImagingOpException: Unable to 
convolve src image
    at java.awt.image.ConvolveOp.filter(ConvolveOp.java:180)
    at krachtus.mvc.util.FilterUtils.filterBlur2(FilterUtils.java:24)
    at Performance_Image.main(Performance_Image.java:28)


The Point is I have to use a Type 1 BufferedImage to do a successful filtering. 
So far I convert the Type 5 into a Type 1 BufferedImage and the filtering works!



My Problem - is a Performance Problem:

The conversion from Type 5 to Type 1 takes very mucht time !!!

Example: I used 10 different jpegs and did the filtering - it takes 20 sec. 
when I have to do this conversion. And only 10 sec. with the conversion !!!

Question: Why can't ImageIO.read(...) return a BufferedImage of my choice ? ie. 
Type 1 ?


Wild Guess: I think reading the Jpeg as a Type 1 BufferedImage could also be 
much faster!
Why ? I use a non-JDK Lib. that returns BufferedImages of Type 1 - it is more 
then twice as fast as ImageIO.read() !!!

It may be possible that ImageIO.read() is slower because it is more 
time-consuming to generate Type 5 BufferedImage (data is structured 
differently) :

Type 5:
[EMAIL PROTECTED]: type = 5 ColorModel: #pixelBits = 24 numComponents = 3 color 
space = [EMAIL PROTECTED] transparency = 1 has alpha = false isAlphaPre = false 
ByteInterleavedRaster: width = 1700 height = 2550 #numDataElements 3 dataOff[0] 
= 2

Type 1:
[EMAIL PROTECTED]: type = 1 DirectColorModel: rmask=ff0000 gmask=ff00 bmask=ff 
amask=0 IntegerInterleavedRaster: width = 1700 height = 2550 #Bands = 3 xOff = 
0 yOff = 0 dataOffset[0] 0


Type 5: ByteInterleavedRaster
Type 1: IntegerInterleavedRaster

Could their be done some optimization and ImageIO.read() be speed up by 
creating a BufferedImage of Type 1 ???

Cheers,
jago

P.S.: How about Acceleration ? Which one is accelerated ? Type 5 or Type 1 ?

Cheers,
jg
[Message sent by forum member 'javagoodies' (javagoodies)]

http://forums.java.net/jive/thread.jspa?messageID=128763

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to