reload rotated image

P

Petr Aubrecht

Hello,

knows anybody, how to reload image from disc?

First, I load image using ImageIcon, display it. User clicks on rotation,
I run external jpegtran to turn it, load the image again, and voila -- I
get the OLD image!

I expect, there is an internal MediaTracker as a cache.

Thanks for any help.
Petr
 
D

David Bouchard

have you tried an invalidate() + repaint() on the component displaying
the image ?
 
P

Petr Aubrecht

have you tried an invalidate() + repaint() on the component displaying the
image ?

No, there's no problem with repainting -- the image in ImageIcon is the
old one! I make a thumbnail from it and save. And the new thumbnail is
made from the old image.

Petr
 
R

Roland

No, there's no problem with repainting -- the image in ImageIcon is the
old one! I make a thumbnail from it and save. And the new thumbnail is
made from the old image.

Petr
How do you obtain your image?
Some parts of the Java API use a private cache (i.e. which cannot be
flushed by you).
E.g. compare Toolkit.getImage(URL) vs Toolkit.createImage(URL). The
first method may return a cached image (if the same URL has been
requested before). The createImage method always tries to re-read the
image data.
<http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Toolkit.html#getImage(java.net.URL)>
<http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Toolkit.html#createImage(java.net.URL)>

Otherwise use ImageIO.read(URL) or related methods
<http://java.sun.com/j2se/1.4.2/docs/api/javax/imageio/ImageIO.html#read(java.net.URL)>
--
Regards,

Roland de Ruiter
___ ___
/__/ w_/ /__/
/ \ /_/ / \
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top