Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java check if BufferedImage is a GIF

Is it possible to determine if a BufferedImage (read from an URL) is a GIF image? I want to check the MIME type, not the file extension .gif.

Thanks

like image 660
producted Avatar asked May 29 '26 07:05

producted


1 Answers

read the very first bytes from the URL, if it's a GIF image, it should start with the 'magic word' : GIF89a

like image 167
Pierre Avatar answered May 31 '26 21:05

Pierre



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!