Java get image extension/type using BufferedImage from URL -


I'm familiar II, where the URL does not have a file extension. Then I want to do local storage, but I want to upload the image file extension (I.e. JPG, PNG, etc.), which I can not reclaim its extension through lazy imaging.

How can this be done? There will be no other way.

Use

You can get image readers using A file containing

I have not tested it myself, but you can try it:

  ImageInputStream iis = ImageIO.createImageInputStream (file); Iterator & LT; ImageReader & gt; ImageReaders = ImageIO.getImageReaders (iis); While (imageReaders.hasNext ()) {ImageReader Reader = (ImageReader) imageReaders.next (); System.out.printf ("formatName:% s% n", reader.getFormatName ()); }    

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -