Note that there are some explanatory texts on larger screens.

plurals
  1. PO"mimetype: application" display on a picture instead of "mimetype: image" after a ImageIO.write
    primarykey
    data
    text
    <p>When I simply create a new image from another like this: </p> <pre><code> public static void scaleByTwoRight(String src, String dest) throws IOException { BufferedImage bsrc = ImageIO.read(new File(src)); int width = bsrc.getWidth()/2; int height = bsrc.getHeight(); BufferedImage bdest = bsrc.getSubimage(width, 0, width, height); ImageIO.write(bdest,"PNG",new File(dest)); } </code></pre> <p>Source file (src) = C:...\Manga\Shonan Juna_ Gumi Tome 11\Shonan Junaï Gumi Tome 11 - 091B.png Destination file (dest) = C:...\Manga\Shonan Junaï Gumi Tome 11 - 091B_A.png</p> <p>Example of generated file: <a href="https://docs.google.com/file/d/0B1vKCZzB5hxqYzNsUWF5RHA2Wm8/edit?usp=sharing" rel="nofollow">https://docs.google.com/file/d/0B1vKCZzB5hxqYzNsUWF5RHA2Wm8/edit?usp=sharing</a></p> <p>Problem: The new image has mimetype: application instead of mimetype: image</p> <p>How I arrive to this conclusion: I'm using a function to test if the file is an image or not: </p> <pre><code>public static boolean isImage(String src) throws IOException { File f = new File(src); String mimetype= new MimetypesFileTypeMap().getContentType(f); String type = mimetype.split("/")[0]; if(type.equals("image")){ return true; }else{ System.out.println("mimetype: "+type); return false; } } </code></pre> <p>It has not a huge impact if the Mime-type is not correct but I prefer to have that working properly.. </p> <p>Thanks for your help! </p> <p>Note: I'm running under Windows 7 / 32b JVM 1.7 / Eclipse Helios</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload