javax.imageio

ImageIO inside jar file

Deadly 提交于 2019-12-31 07:07:18
问题 Okay so I'm trying to make an API for my intro screen to be used across multiple games and I've spent the last 5-6 hours trying to figure out this 1 problem. Lets say that I have the API.jar referenced in on of my games and I'm trying to call the method getByteArray() which is supposed to load the frame as a BufferedImage then return the byte[] data. I constantly get input == null when attempting to load the image. public byte[] getByteArray() throws IOException { // Open Image String url = "

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

主宰稳场 提交于 2019-12-31 05:46:09
问题 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

Problem converting PNG to JPG using Java (ImageIO.write()) [duplicate]

家住魔仙堡 提交于 2019-12-30 10:26:14
问题 This question already has answers here : Issue using ImageIO.write jpg file: pink background [closed] (6 answers) Closed 6 years ago . I am using ImageIO.write() to convert PNG files to JPG. For some reason, my result image has a pink layer over it. I have searched far and wide for a solution but haven't found any. The code works for all other types of images except PNG. 回答1: Quick reading of other SO answers tagged ImageIO led to this. The root cause can be a buggy reader. The proposed

Combining images where BG is a JPEG causes unexpected results

☆樱花仙子☆ 提交于 2019-12-30 09:07:21
问题 Why does combining images where BG is a JPEG cause unexpected results? This is a follow-up to my answer in Overlaying of 2 images doesnt work properly. The source posted there (using a BG image created in memory) looks like this: The BG image is on the left. The FG image (a PNG with transparency) is in the middle. The combined image is on the right. So far, so good. But then the person who asked the question commented that if the BG was a JPEG, it failed. Thinking they were mistaken, I

Could not initialize class javax.imageio.ImageIO

有些话、适合烂在心里 提交于 2019-12-29 08:46:52
问题 I'm trying to deploy a Spring web app to a Tomcat 7 running on a production environment on Windows Azure (tried Ubuntu and Windows Datacenter VM). Sadly, I get an error while generating thumbnails in use with ImageIo (stack trace below). During development, I used Tomcat 7 too, so I really don't understand, what is different on the production web server. When I try to load the modules by ImageIO.scanForPlugins(); the exakt same thing happens. Isn't ImageIO (or javax.awt in general) included

Could not initialize class javax.imageio.ImageIO

耗尽温柔 提交于 2019-12-29 08:46:09
问题 I'm trying to deploy a Spring web app to a Tomcat 7 running on a production environment on Windows Azure (tried Ubuntu and Windows Datacenter VM). Sadly, I get an error while generating thumbnails in use with ImageIo (stack trace below). During development, I used Tomcat 7 too, so I really don't understand, what is different on the production web server. When I try to load the modules by ImageIO.scanForPlugins(); the exakt same thing happens. Isn't ImageIO (or javax.awt in general) included

Why does loading this jpg using JavaIO give CMMException?

回眸只為那壹抹淺笑 提交于 2019-12-29 07:36:14
问题 ImageIO.read(imagePath) with this file gives a CMMException, why cant Java cope with this seemingly valid file http://www.jthink.net/jaikoz/scratch/front.jpg java.awt.color.CMMException: Invalid image format at sun.awt.color.CMM.checkStatus(Unknown Source) at sun.awt.color.ICC_Transform.<init>(Unknown Source) at java.awt.image.ColorConvertOp.filter(Unknown Source) at com.sun.imageio.plugins.jpeg.JPEGImageReader.acceptPixels(Unknown Source) at com.sun.imageio.plugins.jpeg.JPEGImageReader

Tiff compression using Java ImageIO

好久不见. 提交于 2019-12-29 05:30:11
问题 I am having issues converting a png to tiff. The conversion goes fine, but the image is huge. I think the issue is that I am not doing the compression correctly? Anyone have any suggestions?? Here is the code sample public static void test() throws IOException { // String fileName = "4958813_1"; String fileName = "4848970_1"; String inFileType = ".PNG"; String outFileType = ".TIFF"; ImageIO.scanForPlugins(); File fInputFile = new File("I:/HPF/UU/" + fileName + inFileType); InputStream fis =

Tiff compression using Java ImageIO

一个人想着一个人 提交于 2019-12-29 05:30:02
问题 I am having issues converting a png to tiff. The conversion goes fine, but the image is huge. I think the issue is that I am not doing the compression correctly? Anyone have any suggestions?? Here is the code sample public static void test() throws IOException { // String fileName = "4958813_1"; String fileName = "4848970_1"; String inFileType = ".PNG"; String outFileType = ".TIFF"; ImageIO.scanForPlugins(); File fInputFile = new File("I:/HPF/UU/" + fileName + inFileType); InputStream fis =

Java ImageIO IIOException: Unsupported image type?

自闭症网瘾萝莉.ら 提交于 2019-12-29 03:35:05
问题 Working with images in Java for the first time and am getting some bizarro exceptions that aren't documented very well. Here's the line of code that is failing: BufferedImage imgSelected = ImageIO.read(new File("/abs/url/to/file/image.jpg")); This line is throwing an IIOException with Unsupported image type as the exception message. I have checked and re-checked that it is in fact this line throwing the exception, that the File object is valid, that the URL is valid, and that the image.jpg is