Welcome to MacBoardz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

creating image thumbnails is slow in java, suggestions for..

 
   Macintosh computer (Home) -> Programmer Help RSS
Next:  Logout items?  
Author Message
bill52

External


Since: Dec 30, 2004
Posts: 2



(Msg. 1) Posted: Sat Jan 26, 2008 6:55 am
Post subject: creating image thumbnails is slow in java, suggestions for improvement?
Archived from groups: comp>sys>mac>programmer>help (more info?)

My java application is given a list of image files. For each image, it
creates an image thumbnail and displays this thumbnail in a separate
JFrame. The creation of these thumbnails is very slow compared to the
Mac Preview application. Is there a way to speed this up?

Each thumbnail is displayed in a separate JFrame to allow the thumbnails
to be dragged and repositioned on the screen independently. Each
thumbnail is converted to an ImageIcon and displayed in a JButton.
Clicking on the button will rotate the image 90 degrees.

Here is the method which creates the JFrame. I'd appreciate any
suggestions how I can improve performance speed.



private final static int
FRAME_WIDTH = 0,
FRAME_HEIGHT = 20,
THUMB_WIDTH = 150,
THUMB_HEIGHT = 225;


private JFrame createFrame(File file)
{
Image image =
Toolkit.getDefaultToolkit().createImage(file.getPath());

Image thumb = image.getScaledInstance(THUMB_WIDTH, THUMB_HEIGHT,
Image.SCALE_SMOOTH);

JButton button = new JButton(new ImageIcon(thumb));
button.addActionListener(myButtonListener);

JFrame frame = new JFrame();
frame.setTitle(file.getName());
frame.setSize(FRAME_WIDTH + THUMB_WIDTH, FRAME_HEIGHT +
THUMB_HEIGHT);
frame.setLayout(new BorderLayout());
frame.add(button, BorderLayout.CENTER);

return frame;
}

 >> Stay informed about: creating image thumbnails is slow in java, suggestions for.. 
Back to top
Login to vote
noreply

External


Since: Dec 02, 2004
Posts: 191



(Msg. 2) Posted: Sat Jan 26, 2008 2:38 pm
Post subject: Re: creating image thumbnails is slow in java, suggestions for improvement? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Bill wrote:

> My java application is given a list of image files. For each image, it
> creates an image thumbnail and displays this thumbnail in a separate
> JFrame. The creation of these thumbnails is very slow compared to the
> Mac Preview application. Is there a way to speed this up?

If you can require Java 1.4 you probably want to use the javax.imageio
package.

<http://java.sun.com/j2se/1.4.2/docs/api/javax/imageio/package-summary.h
tml>

patrick

 >> Stay informed about: creating image thumbnails is slow in java, suggestions for.. 
Back to top
Login to vote
Jolly Roger

External


Since: Sep 09, 2006
Posts: 1943



(Msg. 3) Posted: Sat Jan 26, 2008 2:38 pm
Post subject: Re: creating image thumbnails is slow in java, suggestions for improvement? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article ,
noreply.RemoveThis@mail.invalid (Patrick Machielse) wrote:

> Bill wrote:
>
> > My java application is given a list of image files. For each image, it
> > creates an image thumbnail and displays this thumbnail in a separate
> > JFrame. The creation of these thumbnails is very slow compared to the
> > Mac Preview application. Is there a way to speed this up?
>
> If you can require Java 1.4 you probably want to use the javax.imageio
> package.
>
> <http://java.sun.com/j2se/1.4.2/docs/api/javax/imageio/package-summary.h
> tml>

Which is part of JAI:

<http://java.sun.com/javase/technologies/desktop/media/jai/>

--
Note: Please send all responses to the relevant news group. If you
must contact me through e-mail, let me know when you send email to
this address so that your email doesn't get eaten by my SPAM filter.

JR
 >> Stay informed about: creating image thumbnails is slow in java, suggestions for.. 
Back to top
Login to vote
Chris Hanson

External


Since: Apr 30, 2004
Posts: 82



(Msg. 4) Posted: Thu Feb 07, 2008 4:36 pm
Post subject: Re: creating image thumbnails is slow in java, suggestions for improvement? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 2008-01-26 04:55:01 -0800, Bill said:

> My java application is given a list of image files. For each image, it
> creates an image thumbnail and displays this thumbnail in a separate
> JFrame. The creation of these thumbnails is very slow compared to the
> Mac Preview application. Is there a way to speed this up?

Try using a performance-tuned platform-native API.

QuickLook (introduced with Leopard) has a document-thumbnail API, and I
believe CoreImage or CoreGraphics has API for either generating a
thumbnail specifically or for quickly performing high-quality scaling
on images.

-- Chris
 >> Stay informed about: creating image thumbnails is slow in java, suggestions for.. 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Creating text image in code - What's the easiest (i.e least amount of code) way to generate an NSImage with black text on a transparent background? It needs to be done in code, as the text will be constantly changing. (The last time I did any 2D graphics programming was in QuickDraw...

Creating an OS X Framework... - Hello all, Is there a good tutorial on-line regarding how to create and use a framework? Specifically, I want to create an OS X framework for the GNU MP library, so an application I'm making can be used on any computer, if this framework is in the..

Creating a CGI with Xcode - Where might I find an example of building a Mac OS X CGI with Xcode that would work with Apache? Thanks in advance. Jonathan Hoyle

File creating problem - Hello, I'm trying to test if a file exists and if not I try to create it in order to open it for writing. So I first use FSpGetFInfo to check if the file exists, then if iErr==fnfErr I try to create the file. In my example below..

Creating a file with FSpCreate - This is probably a very stupid question, but I can't seem to get this to work. I had a very strong background programming in Classic... I want to create a file in a certain directory, /Library/Preferences/Folder. It should go on the main volume. I got...
   Macintosh computer (Home) -> Programmer Help All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]