javax.imageio

ImageIO: CGImageRead_mapData 'open' failed error = 2 on app start

主宰稳场 提交于 2019-12-11 11:26:39
问题 i made an iphone app and build it with 5.0. on 5.0.1 it works fine. when i try to open the app on 5.1 or 5.1.1 the app crashes instantly. in the log there are the following entries: ImageIO: CGImageRead_mapData 'open' failed '/Applications/myApp.app/Icon.png' error = 2 (No such file or directory) libpng error: No IDATs written into file i opened the folder and Icon.png exists!! hope someone can help me :/ 回答1: Please add icon.png in your application plist file under the row icon files . 来源:

Java unknown source with ImageIO

流过昼夜 提交于 2019-12-11 09:36:01
问题 My program runs fine in Netbeans, but I get the following error when I run my applet in a browser: java.lang.IllegalArgumentException: input == null! at javax.imageio.ImageIO.read(Unknown Source) I opened the jar to verify that the png files are correctly placed there. I'm not certain why the following doesn't work (in a try block, of course): BufferedImage beam = ImageIO.read(this.getClass().getResource("images/beam.png")); I've tried other things like the following, but suspect the problem

Writing String into a image in java

别说谁变了你拦得住时间么 提交于 2019-12-11 08:43:54
问题 I am trying to write a string into a image using ImageIo . But while writing a large string ,full string is not written into that image. Here's my code: File url=new File(imgUrl); BufferedImage image = ImageIO.read(url); Graphics g = image.getGraphics(); g.setPaintMode(); g.setFont(g.getFont().deriveFont(30f)); g.drawString(text, 100, 100); g.dispose(); This code works fine for small strings.but when the width of the string exceeds the width of the image,then full string is not displayed on

Efficient way to send an image over socket in Java

落花浮王杯 提交于 2019-12-11 08:22:20
问题 I'm a bit of a Java noob, and I have read some basics about sockets and I can successfully send images over socket using ImageIO, but I want to reduce the amount of data that is sent. Ultimately I want the image (screen capture) to be send as fast as possible with the smallest possible file size. Right now, I have imageIO set up as such; DataInputStream in=new DataInputStream(client.getInputStream()); DataOutputStream out = new DataOutputStream(client.getOutputStream()); ImageIO.write

Understanding “ImageIO.read(getClass().getResource(path))”

匆匆过客 提交于 2019-12-11 07:59:47
问题 My question is about the following code-example: public class BufferedImageLoader { private BufferedImage image; public BufferedImage loadImage(String path) throws IOException { image = ImageIO.read(getClass().getResource(path)); return image; } } I looked in the Java-API and found 3 different read() methods in the ImageIO Class: 1.: read(File input) 2.: read(ImageInputStream stream) 3.: read(InputStream input) 4.: read(URL input) My question is: Which of them four methods is used in this

Java BufferedArrayOutputStream leaks in memory

那年仲夏 提交于 2019-12-11 05:59:09
问题 I made a new question because this is different from my last thread. I now know what th e problem is more exact. I create a new bytearrayoutputstream ByteArrayOutputStream byteArray = new ByteArrayOutputStream(); Nothing special. Then, when I write an image to it, this way ImageIO.write(image, "gif", byteArray); the memory increases like 100 mb first, not in eclipse, but in "reality". Then it slowly increases after that each time I write a new image to that stream OR another!! and after a

JAVA: Substitute one color with another using ColorModel

℡╲_俬逩灬. 提交于 2019-12-11 04:34:17
问题 I need to substitute one color with white on an image. I've read about ColorModel and RGBImageFilter.substituteColorModel, but I don't understand very well. The color I want to substitute is: R: 113 G: 75 B: 96 And of course, white is 255,255,255. If you can give a direct solution will be great, but if not, a bit of explanation on how to do it also will be great. I don't want just the solution, I want to understand the hows and whys. Thank u so much. 回答1: At my company we have to do this sort

Opening an image file from java InputStream

别来无恙 提交于 2019-12-11 02:10:03
问题 I am trying to open an image file that is packaged in a .jar file using the default image viewer of the computer on which i run my program. I have found numerous answers about how to access files that are packaged in a jar using InputStream but how can i open those files using that InputStream? InputStream imageStream = Test.class.getClass().getResourceAsStream("/test/DSC_6283.jpg"); I can convert this into an Image , ImageIcon or a BufferedImage but how to i further open the image in the

ImageIO.read can't read ByteArrayInputStream (image processing)

坚强是说给别人听的谎言 提交于 2019-12-11 00:15:41
问题 I'm trying to read in an image file, convert it into a bytes array, process the individual bytes, and then convert it back into an image file and export it. I've tried working on it, but it seems that ImageIO.read can't read the ByteInputArrayStream - it returns null. Here's what I've tried so far (and the line that throws the error) public static void RGBToGrayManual2(BufferedImage original) { byte[] pixels = ((DataBufferByte) original.getRaster().getDataBuffer()).getData(); /* * Code to

Performing setRGB on BufferedImage changes pixel to black instead of color

帅比萌擦擦* 提交于 2019-12-10 20:47:56
问题 ** Important update, see below! ** I am creating a program that changes the pixels of a BufferedImage to a certain color when that pixel fulfills a set of conditions in Java. However, when I write the image to disk, the pixels that should be colored are instead black. First I define the color, using RGB codes: Color purple = new Color(82, 0, 99); int PURPLE = purple.getRGB(); Then I read the image I want to alter from a File into a BufferedImage called "blank": BufferedImage blank = ImageIO