I need some smart enough thumbnail generation lib to use it in my java app. I've found appropriate code here but I'm not sure about possible licensing issues.
Are there any free appropriate libraries?
Try thumbnailator: http://code.google.com/p/thumbnailator/. All the code you need to add is:
Thumbnails.of(new File("path/to/directory").listFiles())
.size(640, 480)
.outputFormat("jpg")
.toFiles(Rename.PREFIX_DOT_THUMBNAIL);
It's also fast: https://github.com/coobird/thumbnailator/wiki/Comparison
Good luck