title: java.awt.image.RasterFormatException: Data array too small (should be > 388799 )
body: <p>I am trying to do some image manipulation using <code>IConverter</code> class which is included in <strong>Xuggle</strong> library to convert the images from <code>IVideoPicture</code> type to <code>BufferedImage</code> type but am encountering the error in the title. </p>
  
  <p>Here is my code:</p>
  
  <pre><code>BufferedImage orgnlimage = new BufferedImage(Picture.getWidth(), Picture.getHeight(), BufferedImage.TYPE_3BYTE_BGR);
  IConverter converter = ConverterFactory.createConverter(orgnlimage, IPixelFormat.Type.BGR24);
  orgnlimage = converter.toImage(Picture); // Exception on this line
  </code></pre>
  
  <p>The dimensions of the image in question, is <strong>360x360</strong>.</p>
  
  <p>This is the exception I'm getting:</p>
  
  <pre><code>Exception in thread "main" java.awt.image.RasterFormatException: Data array too small (should be &gt; 388799 )
      at sun.awt.image.ByteComponentRaster.verify(ByteComponentRaster.java:947)
      at sun.awt.image.ByteComponentRaster.&lt;init&gt;(ByteComponentRaster.java:201)
      at sun.awt.image.ByteInterleavedRaster.&lt;init&gt;(ByteInterleavedRaster.java:191)
      at sun.awt.image.ByteInterleavedRaster.&lt;init&gt;(ByteInterleavedRaster.java:113)
      at java.awt.image.Raster.createWritableRaster(Raster.java:980)
      at com.xuggle.xuggler.video.BgrConverter.toImage(BgrConverter.java:195)
      at xuggler.Encrypt.main(Encrypt.java:53)
      at xuggler.DecodeAndSaveAudioVideo.main(DecodeAndSaveAudioVideo.java:141)
  </code></pre>
  
  <p>My Second attemp :</p>
  
  <pre><code>public IVideoPicture main(IVideoPicture Picture) throws NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException, IOException
  { 
          int width = Picture.getWidth();
          int height = Picture.getHeight();
          long timestamp = Picture.getTimeStamp();
  
  BufferedImage orgnlimage = videoPictureToImage(Picture);
  
  
          byte[] orgnlimagebytes =toByte(orgnlimage); 
          byte[] encryptedbytes = encrypt(orgnlimagebytes, "abc");
          //System.out.println(encryptedbytes.length);
  
          BufferedImage encryptedimage = toImage(encryptedbytes, width, height);   
  
          String desc = ConverterFactory.findDescriptor(encryptedimage);
         IConverter converter = ConverterFactory.createConverter(desc, Picture);
  
  
          IVideoPicture Pic = converter.toPicture(encryptedimage, timestamp);
  
          return Pic;
  
  }  
  </code></pre>
  
  <p>and the stack trace : </p>
  
  <pre><code>Exception in thread "main" java.nio.BufferOverflowException
  at java.nio.DirectByteBuffer.put(DirectByteBuffer.java:363)
  at java.nio.ByteBuffer.put(ByteBuffer.java:859)
  at com.xuggle.xuggler.video.BgrConverter.toPicture(BgrConverter.java:132)
  at xuggler.Encrypt.main(Encrypt.java:62)
  at xuggler.DecodeAndSaveAudioVideo.main(DecodeAndSaveAudioVideo.java:141)
  </code></pre>