Forum Stats

  • 3,852,891 Users
  • 2,264,146 Discussions
  • 7,905,157 Comments

Discussions

Get format (PNG, JPG..) of an image?

990159
990159 Member Posts: 22
edited Feb 16, 2013 9:27AM in JavaFX 2.0 and Later
I am creating an application that for some reasons shall only accept PNG images.

How can I check if an image is really a PNG image? Currently I am using the Image class to load the image.

Thanks for any hint!
Tagged:

Answers

  • 990159
    990159 Member Posts: 22
    I found the answer here: http://stackoverflow.com/questions/51438/getting-a-files-mime-type-in-java (Post of Chris Mowforth):
    http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#probeContentType%28java.nio.file.Path%29
This discussion has been closed.