javax.imageio

Write back modified image from imageReader

≡放荡痞女 提交于 2019-12-04 05:19:49
问题 I read separated images from animated gif and I need just make change with them in frames[i] and then set them back to file and save with writer as new file. File file = new File("gif1.gif"); ImageReader reader = ImageIO.getImageReadersBySuffix("GIF").next(); ImageInputStream in = ImageIO.createImageInputStream(file); reader.setInput(in); File output = new File("k.gif"); ImageWriter writer = ImageIO.getImageWritersBySuffix("GIF").next(); ImageOutputStream out = ImageIO.createImageOutputStream

ImageIO.read() returns 403 error

 ̄綄美尐妖づ 提交于 2019-12-04 03:42:44
问题 I have the following code: public BufferedImage urlToImage(String imageUrl) throws MalformedURLException, IOException { URL url = new URL(imageUrl); BufferedImage image = ImageIO.read(url); return image; } That is supposed to return an image from a given URL. I tested with these two randomly chosen URLs: https://www.google.co.ma/images/srpr/logo4w.png http://www.earthtimes.org/newsimage/osteoderms-storing-minerals-helped-huge-dinosaurs-survive_3011.jpg The first one works fine, but the second

Creating progressive jpeg on iOS with ImageIO produces blocky results on device

雨燕双飞 提交于 2019-12-04 02:34:45
I'm trying to create a progressive jpeg from a UIImage object, this is the code i'm NSMutableData *data = [NSMutableData data]; NSString *path = [NSHomeDirectory() stringByAppendingPathComponent: @"Library/Caches/test.jpg"]; CFURLRef url = CFURLCreateWithString(NULL, (CFStringRef)[NSString stringWithFormat:@"file://%@", path], NULL); CGImageDestinationRef destination = CGImageDestinationCreateWithURL(url, kUTTypeJPEG, 1, NULL); CFRelease(url); NSDictionary *jfifProperties = [NSDictionary dictionaryWithObjectsAndKeys: (__bridge id)kCFBooleanTrue, kCGImagePropertyJFIFIsProgressive, nil];

android Image encryption/decryption BufferedImage and ImageIO not resolved

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 21:59:24
Code given below ,is not working with the android sdk "BufferdImage and ImageIO " not resolved . I've tried to implement "Bitmap" and "BitmapFactory", but it did not work.Please help me to do this at android application . Please correct in for an android application . public class stackoverflow { public static void main(String[] arg) throws Exception { Scanner scanner = new Scanner(System.in); byte[] salt = { (byte) 0xc7, (byte) 0x73, (byte) 0x21, (byte) 0x8c, (byte) 0x7e, (byte) 0xc8, (byte) 0xee, (byte) 0x99 }; { File inputFile = new File("C:/Users/AMD/Desktop/bhp/pngg.jpg"); BufferedImage

Java read different type of image formats jpg,tif,gif,png

自古美人都是妖i 提交于 2019-12-03 21:15:10
I am trying to read some image files jpg, tif, gif, png and need to save files and create icons. And i am getting UnsupportedTypeException . ImageIO.read(file); If i use following line, as earlier discuss in form. BufferedImage img = JPEGCodec.createJPEGDecoder(inputStream).decodeAsBufferedImage(); I get JPEGCodec cannot found symbol. I am using netbean 7.0.1. I have also added jai-imageio.jar. By default, ImageIO can only read JPG, GIF and PNG file formats, if I remember right. To add new formats like TIFF, you need to add a plugin, which is a jar file, to your classpath, and to add an

iPhone iOS saving data obtained from UIImageJPEGRepresentation() fails second time: ImageIO: CGImageRead_mapData 'open' failed

*爱你&永不变心* 提交于 2019-12-03 17:33:12
问题 I'm running into a weird issue with my UIImage manipulation. I'm doing a dropbox sync, and have to store my images as local files. To do so, I save them using the UIImagePNGRepresentation(image) or UIImageJPEGRepresentation(image, 0.66) Here's my typical workflow: User selects an image or takes a photo Image gets assigned to an imageView The image view's UIImage gets saved to a file using the method below Next time the user re-opens the app, I read the image back from the file using [UIImage

save resized image java

隐身守侯 提交于 2019-12-03 14:25:46
How do i save a resized image to a specific folder? private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { ImgChooser ic = new ImgChooser(); ImageIcon icon = new ImageIcon(me,"id pic"); Image img1 = icon.getImage(); Image img2 = img1.getScaledInstance(105, 105, 0); icon.setImage(img2); jLabel1.setIcon(icon); } This first code is where i get the image and resize it. Then i want the resized image to be saved in another folder. Thanks in advance Use ImageIO.write(...) as others have already said (+1 to them), to add here is an example for you: public static void main(String[] args

Invalid PNG Image file: iDOT doesn't point to valid IDAT chunk

╄→гoц情女王★ 提交于 2019-12-03 11:04:01
I have some HTML content pages in an app and I'm using a UIWebView to display them. Some of these pages have a PNG image in them that is generating the following message in the debug console in xcode: ImageIO: PNG invalid PNG file: iDOT doesn't point to valid IDAT chunk The image still displays and looks correct. Also this only happens when I run the app on an iPad (3rd generation). My iPhone 4 doesn't display this message. My first thought was that it was caused by a ~ character in the filename (I've added the ~ipad tag to the filename). However, removing the ~ character doesn't have any

iPhone iOS saving data obtained from UIImageJPEGRepresentation() fails second time: ImageIO: CGImageRead_mapData 'open' failed

吃可爱长大的小学妹 提交于 2019-12-03 07:22:29
I'm running into a weird issue with my UIImage manipulation. I'm doing a dropbox sync, and have to store my images as local files. To do so, I save them using the UIImagePNGRepresentation(image) or UIImageJPEGRepresentation(image, 0.66) Here's my typical workflow: User selects an image or takes a photo Image gets assigned to an imageView The image view's UIImage gets saved to a file using the method below Next time the user re-opens the app, I read the image back from the file using [UIImage imageWithContentsOfFile:fullImagePath] This works once. The second time I run through the routine, I

Fastest way to read/write Images from a File into a BufferedImage?

て烟熏妆下的殇ゞ 提交于 2019-12-03 06:59:07
What is the fastest way to read Images from a File into a BufferedImage in Java/Grails? What is the fastest way to write Images from a BufferedImage into a File in Java/Grails? my variant (read): byte [] imageByteArray = new File(basePath+imageSource).readBytes() InputStream inStream = new ByteArrayInputStream(imageByteArray) BufferedImage bufferedImage = ImageIO.read(inStream) my variant (write): BufferedImage bufferedImage = // some image def fullPath = // image page + file name byte [] currentImage try{ ByteArrayOutputStream baos = new ByteArrayOutputStream(); ImageIO.write( bufferedImage,