0

I have a list of RenderedImage "List imagesList", now I wanna check whether two objects from the above list are same or not. I tried with comparing two file but not with the list of RenderedImages. Does anyone have any idea how to compare RenderedImage? Do I have to use any library to do this?

  • What have you tried? Where is it failing? – Erwin Bolwidt May 28 '17 at 08:08
  • What do you mean by "comparing"? Like checking their pixels have the same colour? They are the same RenderedImage object? – Dolf May 28 '17 at 08:09
  • I know `imagemagick` has variety of options, it may help you. But not sure it has any feature for comparison, check more http://www.imagemagick.org/script/index.php – Sridhar May 28 '17 at 08:13

1 Answers1

2

I'd compare those two objects pixel by pixel. I'm sure it's slow, but I'm sure too it should work.

Related: Java Compare one BufferedImage to Another

  • 2
    Yup. That's really the only option you have. +1 – Erwin Bolwidt May 28 '17 at 08:19
  • Thanks captainepoch. I converted RenderedImage to BufferedImage and used your code and it worked. – Pramod Nikule May 28 '17 at 09:22
  • 1
    @PramodNikule I'm happy it worked. It's not my code, credit goes to the authors. –  May 28 '17 at 09:48
  • Coincidentally, that's also what is done in PDFBox as part of rendering quality testing: https://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/test/java/org/apache/pdfbox/rendering/TestPDFToImage.java?view=markup (test is disabled in standard build, it is done locally by PDFBox developers due to differences depending of the OS and installed fonts) – Tilman Hausherr May 28 '17 at 11:18