imgscalr

imgscalr with background red

时光毁灭记忆、已成空白 提交于 2019-11-29 02:11:50
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 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 PNG has an alpha channel in it and JPG does not support alpha; unfortunately Java's JPG encoder does not

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

ε祈祈猫儿з 提交于 2019-11-28 06:39:33
问题 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.