0

I have problem getting mp3 file thumbnail using java, for example we have file:

File MP3File = new File(<directory>);

So, How can i retrieve its thumbnail?

Thanks for your attention, any ideas would be appreciated.

A.R.S.D.
  • 180
  • 3
  • 13

2 Answers2

2

Something like this might work:

Image icn=((ImageIcon) FileSystemView.getFileSystemView().getSystemIcon(new File(<directory>))).getImage();
icn = icn.getScaledInstance(32,32, Image.SCALE_SMOOTH);
Bart
  • 267
  • 1
  • 10
  • Thanks , that works but how can i covert java.awt.image to java.scene.image.image in order to show it in an image view? – A.R.S.D. Jul 17 '18 at 06:54
  • I'm not 100% sure since I can't test this on my system but you can look at this: https://stackoverflow.com/questions/30970005/bufferedimage-to-javafx-image – Bart Jul 17 '18 at 07:06
1

Try to get the metadata from the mp3 file, see mp3agic from github.

According from the tutorial, I think you could get a byte[] and convert into a bufferedImage.

evanshwu
  • 43
  • 6