imgscalr

How to resize images in a directory?

我只是一个虾纸丫 提交于 2019-12-24 04:52:30
问题 This code attempts to resize images in a directory called "imgs". Unfortunately for some reason when I uncomment the listFiles(..) loop ImageIO.read(sourceImageFile) will return null. Yet processing the same file straightaway outside the loop ( res("imgs/foto_3.jpg") ) works. So apparently, this loop is preventing the files from being read. Solutions? import java.awt.image.*; import java.io.*; import javax.imageio.*; import static org.imgscalr.Scalr.*; public class App { public static void

ImageIO support for raw images (jrawio)

妖精的绣舞 提交于 2019-12-22 14:01:31
问题 I was looking for raw image support and found this library (jrawio-1.6.1) which extends imageio to add raw support. It seems to work but awfully slow. I've seen snails that were faster. My code processes Jpegs in seconds and it takes minutes to process a not that much bigger .cr2 file or .nef. I could be wrong but I think it even slowed down the tiff processing. The last tiff file was very big so that could have been the problem too. Another issue I have with this library is that development

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

爱⌒轻易说出口 提交于 2019-12-18 06:12:37
问题 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);

imgscalr with background red

亡梦爱人 提交于 2019-12-18 03:37:09
问题 I'm using (org.imgscalr.Scalr) libraries to resize some images, but when after resizing the background turns red . My code is: BufferedImage imagemPng = ImageIO.read(image); BufferedImage imagemJpg = Scalr.resize(imagemPng, Method.QUALITY, 1920, 937); can you help me? Thank you 回答1: The remainder of the code you omitted (the ImageIO save) and if the PNG you are reading in has a transparent channel or not (as @Daft Punk pointed out) are the important bits here. I am willing to bet $1 that your

Scale large images using Java and AsyncScalr

 ̄綄美尐妖づ 提交于 2019-12-10 10:42:41
问题 I'm using AsyncScalr in a Servlet to scale down some large images (~ 10-15 MegaBytes), the actual resizing process takes about 40ms which is not much. The overkill comes from Reading the Image from Local Storage as a BufferedImage. so the times are mostly like : read the image file : 1630ms !! resizing the image : 41ms writing the image : 40ms below is the code that I'm using, is there any more optimal way to do this? final FileImageInputStream fileImageInputStream = new FileImageInputStream

ImageIO support for raw images (jrawio)

好久不见. 提交于 2019-12-06 09:45:46
I was looking for raw image support and found this library (jrawio-1.6.1) which extends imageio to add raw support. It seems to work but awfully slow. I've seen snails that were faster. My code processes Jpegs in seconds and it takes minutes to process a not that much bigger .cr2 file or .nef. I could be wrong but I think it even slowed down the tiff processing. The last tiff file was very big so that could have been the problem too. Another issue I have with this library is that development seems to have ceased in 2009. What are my Alternatives? I tried including JAI but some of the libraries

Scale large images using Java and AsyncScalr

烈酒焚心 提交于 2019-12-06 08:20:02
I'm using AsyncScalr in a Servlet to scale down some large images (~ 10-15 MegaBytes), the actual resizing process takes about 40ms which is not much. The overkill comes from Reading the Image from Local Storage as a BufferedImage. so the times are mostly like : read the image file : 1630ms !! resizing the image : 41ms writing the image : 40ms below is the code that I'm using, is there any more optimal way to do this? final FileImageInputStream fileImageInputStream = new FileImageInputStream(file); BufferedImage bufferedImage = ImageIO.read(fileImageInputStream); // resize file Future

How to use imgscalr using Grails

我只是一个虾纸丫 提交于 2019-12-04 09:42:06
I've just begun using Groovy and Grails the last few days. I don't have any prior experience of Java, so you'll have to excuse this (probably) very basic question. I've searched Google and Stack Overflow and haven't found anything that helps me with the actually installation. I have got an image upload working, and I am storing the file on the server. I used a IBM Grails tutorial to guide me through it. That works fine. I would also like to resize the file in a large, medium, and small format. I wanted to use imgscalr for this, but I cant get it to work. I have downloaded version 4.2 which

Taking a picture via camera and sending it to server in bytearray

梦想与她 提交于 2019-11-29 13:03:26
I am working on an Andorid application in which I would like the user to take a picture and then to save it I am sending it over to the server. Now, I am sending the picture as a byte-array to the server. When I try to save the byte-array to a file as a PNG file, and then try to open the file, the image-viewer complains that the PNG has errors and cannot be displayed. The PNG file size was 122Kb. When I tried to use Scalr library to resize the image, it says the image source cannot be null. Directly saving the byte-array is causing a corrupt PNG. How should I convert and send the file properly

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(