Identical image determination of original image and thumbnail image

Asked 2 years ago, Updated 2 years ago, 132 views

Within the image-handling system,
There is a process to generate the original image and its thumbnail image.

Thumbnail image generation method is java.

BufferedImage newBimg = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_3BYTE_BGR);
newBimg.getGraphics().drawImage(ImageIO.read(originalImage))).getScaledInstance(newWidth, newHeight, Image.SCALE_AREA_AVERAGING), 0, 0, newWidth, newHeight, null);
ImageIO.write(newBimg, "jpg", new File(thumbnailImg.getAbsolutePath()));

Is there a way to compare the two image files without regenerating the thumbnail image to determine that they are the same image if the filenames of each other fall apart after generation?

I checked ImageMagic's compare command, but it seemed that only images of the same size could be determined.
I also considered using the Linux od command to read and compare the binary data of the images, but it seems that the common parts of the images are not constant, so I couldn't do it well when I wanted to judge multiple images at once.
Please let me know if there is a good way.
Thank you for your cooperation.

image imagemagick

2022-09-30 20:17

1 Answers

Is there a way to compare the two image files without regenerating the thumbnail image to determine that they are the same image?

There is no universal means.

Furthermore, "re-create thumbnail images" cannot output the same thumbnail image file unless the operating environment is completely fixed, so simple byte comparison cannot determine the same image.

  • If you search for "similar images", you will quantify the image features such as pHash and determine how similar the values are. (See also packet0 Comments)
  • If you want to determine a strict match, you should embed meta-information that identifies the original filename in the thumbnail image file that you generate in your system.You can embed EXIF data in JPEG format.


2022-09-30 20:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.