JyotsnaT / xuggle

Automatically exported from code.google.com/p/xuggle
0 stars 0 forks source link

javax.imageio.ImageIO.write() produces dark JPEG files. #19

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
to reproduce the problem:

1. convert an IVideoPicture to a BufferedImage
2. use a javax.imageio.ImageIO.write() out a JPEG image file.

the result is a VERY dark (nearly all black) JPEG file. a ghosting of
original image is visible.

as a workaround, write out PNG files.  this is known to work properly.

Original issue reported on code.google.com by tre...@gmail.com on 17 Jan 2009 at 2:14

GoogleCodeExporter commented 9 years ago

Original comment by tre...@gmail.com on 17 Jan 2009 at 2:43

GoogleCodeExporter commented 9 years ago
i found that the the problem occurs when any BufferedImage of TYPE_ARGB (which 
is the
type which xuggler uses) is written as JPG. so:

   BufferedImage image = new BufferedImage(50, 50, BufferedImage.TYPE_INT_ARGB);
   // code which draws on the image here
   ImageIO.write(image, "jpg", new File("image.jpg"));

produces a very dark image.

Original comment by tre...@gmail.com on 19 Jan 2009 at 8:12

GoogleCodeExporter commented 9 years ago
jpg images will be properly written out if IVideoPictures are converted into
BufferedImage.TYPE_3BYTE_BGR rather then TYPE_INT_ARGB; video.ConverterFactory
supports this.  this issue appears to be a bug in javax.imageio.ImageIO class 
or les
likely FFMPEGs construction of ARGB image types. 

Original comment by tre...@gmail.com on 2 Apr 2009 at 5:31