Check for same image

Hi all,

I'm writing an application that can let user import images and move them around. When the user press save, the used image should be saved under a directory. My problem is, when the user press a second time, the saved images should not be saved again, how I know if it is the same image?

Currently the copy image is done by FileImageInputStream and FileImageOutputStream, so the new file has got different file name and date modified. The common part would be the length, but different images can save same length too.

I don't want to read the file into image object, as the process is quite costy (and image class doesn't provide equal check anyway). The whole purpose of this is to cut the repeated saving process faster. I don't mind suggestions of different solutions too.

Thanks in advance,

Icycool

[851 byte] By [Icycoola] at [2007-11-27 1:25:44]
# 1

Perhaps your application should have a boolean variable for each image that records whether that image has been changed and needs saving. Whenever the user does something that changes the image you set the variable to "true" and whenever they save the images you set them all to false.

(You could update the application's titlebar at the same time with a * or something to provide a visual clue that work is unsaved.)

pbrockway2a at 2007-7-12 0:19:01 > top of Java-index,Java Essentials,Java Programming...
# 2
That will do. Thanks a lot! =)
Icycoola at 2007-7-12 0:19:01 > top of Java-index,Java Essentials,Java Programming...
# 3
You're welcome.
pbrockway2a at 2007-7-12 0:19:01 > top of Java-index,Java Essentials,Java Programming...