javax.imageio

ImageIO.read( ) always rotates my uploaded picture

拟墨画扇 提交于 2019-12-03 06:47:48
I want to create a web application that allow users to upload their image to the server. When they click send, their image will be uploaded to the server (multipart). Before saving, I want to make some operation with the image, so I decided to use .. ImageIO.read(InputStream) to get BufferedImage object here is the code: public static BufferedImage getBufferedImageFromMultipartFile(MultipartFile file) throws APIException { BufferedImage bi = null; try { bi = ImageIO.read(file.getInputStream()); } catch (IOException e) { throw new APIException(ErrorCode.SERVER_ERROR, e); } return bi; } The

ImageIO reading slightly different RGB values than other methods

左心房为你撑大大i 提交于 2019-12-03 05:36:14
问题 I've found that I'm getting different RGB when using Java (& actually paint.NET) than I am using ImageMagick, Gimp, Python, and Octave. The last 4 all agreeing with eachother and so I'm assuming to be correct. For these examples, I'm using this test image: http://farm3.static.flickr.com/2811/9177301733_9836174725_o.jpg Testing pixel x=4144 y=2768 R G B Java = (125, 107, 69) Paint.NET = (125, 107, 69) ImageMagick = (128, 106, 67) Python = (128, 106, 67) Octave = (128, 106, 67) Gimp = (128, 106

What is the most memory-efficient way of downscaling images on iOS?

旧巷老猫 提交于 2019-12-03 04:16:33
问题 In background thread, my application needs to read images from disk, downscale them to the size of screen (1024x768 or 2048x1536) and save them back to disk. Original images are mostly from the Camera Roll but some of them may have larger sizes (e.g. 3000x3000). Later, in a different thread, these images will frequently get downscaled to different sizes around 500x500 and saved to the disk again. This leads me to wonder: what is the most efficient way to do this in iOS, performance and memory

ImageIO dirty memory is not automatically cleared by iOS

試著忘記壹切 提交于 2019-12-03 02:48:32
问题 I am creating an application which is a kind of gallery - it shows different media content as a fullscreen viewer. Allocations instrument shows that Live Bytes parameter doesn't grow higher than 40 Mb when using application. Meanwhile the app is 100% being killed after I slide pages 20-30 times. I checked Dirty Memory parameter and found it was 10 times bigger than Live Bytes size. And the most of that dirty memory consumed Image IO: EDIT, another screenshot: The allocations peaks above are

ImageIO reading slightly different RGB values than other methods

强颜欢笑 提交于 2019-12-02 20:08:31
I've found that I'm getting different RGB when using Java (& actually paint.NET ) than I am using ImageMagick, Gimp, Python, and Octave. The last 4 all agreeing with eachother and so I'm assuming to be correct. For these examples, I'm using this test image: http://farm3.static.flickr.com/2811/9177301733_9836174725_o.jpg Testing pixel x=4144 y=2768 R G B Java = (125, 107, 69) Paint.NET = (125, 107, 69) ImageMagick = (128, 106, 67) Python = (128, 106, 67) Octave = (128, 106, 67) Gimp = (128, 106, 67) What gives? Here's a quick test using imagemagick: convert image.jpg -crop 1x1+4144+2768 -depth

Java - loading file for ImageIO.write doesn't work in .jar

三世轮回 提交于 2019-12-02 19:24:11
问题 I'm making a game in Java and I want to save the randomly generated map on an image and then load it. My code work without a problem in Eclipse, but when I export it to a .jar/.exe file it has problem with making a file ("mapf"). Thank you for your answers. private void makeMap(){ combined = new BufferedImage(maxX*Game.TILESIZE, maxY*Game.TILESIZE+16, BufferedImage.TYPE_INT_ARGB); //draw tiles Graphics g2 = combined.getGraphics(); for(int y = 0; y < tiles[1].length; y++){ for(int x = 0; x <

ImageIO dirty memory is not automatically cleared by iOS

我们两清 提交于 2019-12-02 16:22:11
I am creating an application which is a kind of gallery - it shows different media content as a fullscreen viewer. Allocations instrument shows that Live Bytes parameter doesn't grow higher than 40 Mb when using application. Meanwhile the app is 100% being killed after I slide pages 20-30 times. I checked Dirty Memory parameter and found it was 10 times bigger than Live Bytes size. And the most of that dirty memory consumed Image IO: EDIT, another screenshot: The allocations peaks above are switching video/image media contents. The problem is the dirty memory grows almost linearly and I need

JavaFX application with an ImageIO call on a thread other than JavaFX Application Thread hangs on Mac OS X

最后都变了- 提交于 2019-12-02 13:51:37
Consider I have a sample JavaFX application which updates its UI with an image read from the application's JAR, and does so in a delayed manner (i.e. the image is painted after the UI is shown): import javafx.application.Application; import javafx.application.Platform; import javafx.embed.swing.SwingFXUtils; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.Label; import javafx.scene.image.ImageView; import javafx.scene.layout.StackPane; import javafx.stage.Stage; import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io

ImageIO saves back to original size

和自甴很熟 提交于 2019-12-02 13:35:02
问题 I've been searching for some solutions from the internet yet I still haven't found an answer to my problem. I've been working or doing a program that would get an image file from my PC then will be edited using Java Graphics to add some text/object/etc. After that, Java ImageIO will save the newly modified image. So far, I was able to do it nicely but I got a problem about the size of the image. The original image and the modified image didn't have the same size. The original is a 2x3 inches

How to encode an animated GIF in Java, using ImageWriter and ImageIO?

对着背影说爱祢 提交于 2019-12-02 11:58:11
问题 I've looked all over the place, but can't seem to find any easy to understand explanation. (I've found classes and methods written by other Java users that can do this, but I'm hoping to write my own.) 回答1: Here is the createImage() method of GIFanim. Perhaps that will give you a start. public byte[] createImage() throws Exception { ImageWriter iw = ImageIO.getImageWritersByFormatName("gif").next(); ByteArrayOutputStream os = new ByteArrayOutputStream(); ImageOutputStream ios = ImageIO