javax.imageio

Why is my gif image sent from servlet not animating?

冷暖自知 提交于 2019-11-29 16:09:24
I have this following code in my servlet response.setContentType("image/gif"); String filepath = "PATH//TO//GIF.gif"; OutputStream out = response.getOutputStream(); File f = new File(filepath); BufferedImage bi = ImageIO.read(f); ImageIO.write(bi, "gif", out); out.close(); This code is just returning first frame of the image. How to achieve returning full GIF image ? haraldK Your GIF does not animate, because you are sending only the first frame to the client. :-) Actually, you are, because ImageIO.read reads only the first frame (and a BufferedImage can only contain a single frame/image). You

Could not initialize class javax.imageio.ImageIO

大兔子大兔子 提交于 2019-11-29 14: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 in the standard Java 7 JRE? Ideas that did not work I've read something about setting up a subfolder in

Pink/Reddish tint while resizing jpeg images using java thumbnailator or imgscalr

流过昼夜 提交于 2019-11-29 10:55:49
I am trying to convert an image (url below) using two libraries (thumbnailator and imgscalr. My code works on most of the images except a few which after conversion have a pink/reddish tint. I am trying to understand the cause and would welcome any recommendation. Note - Image type of this image is 5 i.e BufferedImage.TYPE_3BYTE_BGR and i am using Java 7 Using Thumbnailator Thumbnails.of(fromDir.listFiles()) .size(thumbnailWidth, thumbnailHeight) .toFiles(Rename.SUFFIX_HYPHEN_THUMBNAIL); Using imgscalr BufferedImage bufferedImage = ImageIO.read(file); final BufferedImage jpgImage; LOG.debug(

Convert and display image from byte array

自作多情 提交于 2019-11-29 10:38:01
I'm making a program, which gets data about an image in byte array from a server. I'm converting this data into 24bit BMP format (whether its jpeg, png, bmp or 8-24-32bpp). First, I'm saving it to my HD, and then I'm loading it into a JLabel's Icon. Works perfectly, though there are some cases in which I get the following exception: java.io.EOFException at javax.imageio.stream.ImageInputStreamImpl.readFully(ImageInputStreamImpl.java:353) at com.sun.imageio.plugins.bmp.BMPImageReader.read24Bit(BMPImageReader.java:1188) at com.sun.imageio.plugins.bmp.BMPImageReader.read(BMPImageReader.java:843)

Why does loading this jpg using JavaIO give CMMException?

末鹿安然 提交于 2019-11-29 10:17:58
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.readImage(Native Method) at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(Unknown Source) at com

Create Layered Tif with Java for use in Photoshop

喜欢而已 提交于 2019-11-29 08:20:34
I'm interesting in creating a layered tif with Java in a way that Photoshop will recognize the layers. I was able to create a multi-page tif , but Photoshop does not recognize the pages as layers. The pages are viewable with Acrobat though. Anyone know how Photoshop stores tif layer data and how that could be generated with Java? Thanks. I have researched this for my TIFF ImageIO plugin , and as far as I understand, the way Photoshop stores layer information in TIFFs is completely proprietary and not using standard TIFF mechanisms, like multi-page documents utilizing linked or nested IFDs (

How can I save a PNG with a tEXt or iTXt chunk from Java?

早过忘川 提交于 2019-11-29 07:55:36
问题 I am currently using javax.imageio.ImageIO to write a PNG file. I would like to include a tEXt chunk (and indeed any of the chunks listed here), but can see no means of doing so. By the looks of com.sun.imageio.plugins.png.PNGMetadata it should be possible. I should be most grateful for any clues or answers. M. 回答1: The solution I struck upon after some decompilation, goes as follows ... RenderedImage image = getMyImage(); Iterator<ImageWriter> iterator = ImageIO.getImageWritersBySuffix( "png

100% Java library for JPEG lossless decoding

自作多情 提交于 2019-11-29 03:06:04
问题 I'm searching for a library in 100% Java which could decode JPEG images with jpeg-lossless compression. I know that ImageIO and JAI already could decode this images, but they're needed a native code which do not exists for all OS. I would consider open and close source solutions, as ImageIO plugin or stand-alone. 回答1: Marco Schmidt wrote a handy "List of Java libraries to read and write pixel image files" a long time ago. It is gone from the web now, but it still possible to view it with the

Tiff compression using Java ImageIO

会有一股神秘感。 提交于 2019-11-29 02:24:21
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 = new BufferedInputStream(new FileInputStream( fInputFile)); PNGImageReaderSpi spi = new PNGImageReaderSpi

Pure Java alternative to JAI ImageIO for detecting CMYK images

拜拜、爱过 提交于 2019-11-29 01:18:13
问题 first I'd like to explain the situation/requirements that lead to the question: In our web application we can't support CMYK images (JPEG) since IE 8 and below can't display them. Thus we need to detect when someone wants to upload such an image and deny it. Unfortunately, Java's ImageIO won't read those images or would not enable me to get the detected color space. From debugging it seems like JPEGImageReader internally gets the color space code 11 (which would mean JCS_YCCK ) but I can't