java - Mimetypes for ImageIO read() and write() -


i trying use mime types define output imageio. simple write() method

public static boolean write(renderedimage im,             string formatname,             outputstream output)                      throws ioexception 

uses " informal name of format." (e.g. "png"). there simple equivalent mimetypes (e.g. "image/png") or failing code achieves purpose of writing image? starting point have found is

public static iterator<imagewriter> getimagewritersbymimetype(string mimetype) 

which seems more complex, requiring imagewriter, iiostream etc. , haven't managed create solution.

update: reason using mime is formal part of image in svg, e.g.

 xlink:href="data:image/png;base64,ivborw0kggoaaaa... 

and seemed appropriate use rather converting less defined "informal" formats. managed find precise solution (in java2s.com) question , have added answer.

i printed list of imageio informal formats, using getreaderformatnames method, on windows xp, java 6 computer.

bmp, bmp, jpg, jpg, wbmp, jpeg, png, png, jpeg, wbmp, gif, gif 

here equivalent mime types

image/bmp image/jpeg image/png image/gif 

i couldn't find mime wbmp format.

seems strip off "image/" mime pass informal format imageio read or write methods.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -