Skip to main content

[JAVA2D] Fast image manipulation

3 replies [Last post]
Anonymous

I will be starting a contract with a film production company soon, and
will be writing code to process large images representing frames of
movies (unknown file format at this time). I'd also like to build the
interface in Java, and do the number crunching in Java too, if Java is
powerful enough to handle it.

I'd like to know what the best ways are to accomplish this. Should I
treat image data as arrays of bytes and use the old producer/consumer
model to construct images, or is it best to use BufferedImages and
Rasters? Should I use javax.ImageIO to load images, the Toolkit and
MediaTracker, or implement my own loader that takes advantage of NIO?

Top priority tasks would include loading images quickly, writing images
quickly, caching images and/or thumbnails for realtime animation, and
applying filters and tweaking individual pixles of images. I'm very
familiar with the Java2D API, but feel I don't know much about the more
data centered aspects of image manipulation.

Is Java up to this task? Would it be best to write the heavy duty stuff
in C++ and use the JNI to call it?

Where can I find a general discussion of the data-wise impact of image
manipulation in Java? All of the Java2D stuff I find is about fancy
ways to draw shapes; I can't find much on direct access, what a Register
does, or otherwise how to deal with an image as data.

Thanks

Mark McKay
--
http://www.kitfox.com

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
irudi
Offline
Joined: 2006-02-17

Hi Mark,

I've got very similar questions - but no answers until now.
We would like to handle very large (>500MB) image data and we are still undecided if we have to use C++ instead of Java for performance reasons.
Would be very nice if you could share your experiences.

Rudi

pepe
Offline
Joined: 2003-06-10

Well, i don't know about what it gives to manipulate pixels through J2D, but i can tell you that general pixel manipulation is fast.
I'm coding a compositing application that uses images in float precision, and it's as fast as the equivalent algorithms in C. (did both, to compare) You can get directly java for filters, as far as my experience showed me. No need to bother with C.

I used java2D to generate floating point images and it was fast, even with the conversions to my internal raster organisation.

Unfortunatly, it seems that int manipulations like decals and masks are extremly slow compared to C, but i guess that if you are going to do film, you'll go float.

Aastha Bhardwaj

Hi Mark,

This might be of some interest to you:

http://archives.java.sun.com/cgi-bin/wa?A2=ind0104&L=jai-interest&P=R105...

Aastha

--
---------------------
Aastha Bhardwaj
Java Advanced Imaging
Sun Microsystems

> I will be starting a contract with a film production company soon, and
> will be writing code to process large images representing frames of
> movies (unknown file format at this time). I'd also like to build the
> interface in Java, and do the number crunching in Java too, if Java is
> powerful enough to handle it.
>
> I'd like to know what the best ways are to accomplish this. Should I
> treat image data as arrays of bytes and use the old producer/consumer
> model to construct images, or is it best to use BufferedImages and
> Rasters? Should I use javax.ImageIO to load images, the Toolkit and
> MediaTracker, or implement my own loader that takes advantage of NIO?
>
> Top priority tasks would include loading images quickly, writing images
> quickly, caching images and/or thumbnails for realtime animation, and
> applying filters and tweaking individual pixles of images. I'm very
> familiar with the Java2D API, but feel I don't know much about the more
> data centered aspects of image manipulation.
>
> Is Java up to this task? Would it be best to write the heavy duty stuff
> in C++ and use the JNI to call it?
>
> Where can I find a general discussion of the data-wise impact of image
> manipulation in Java? All of the Java2D stuff I find is about fancy
> ways to draw shapes; I can't find much on direct access, what a Register
> does, or otherwise how to deal with an image as data.
>
> Thanks
>
> Mark McKay
> --
> http://www.kitfox.com
>
> ===========================================================================
> To unsubscribe, send email to listserv@java.sun.com and include in the body
> of the message "signoff JAVA2D-INTEREST". For general help, send email to
> listserv@java.sun.com and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to listserv@java.sun.com and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
listserv@java.sun.com and include in the body of the message "help".