title: Bitmap Channels order different in Android
body: <p>I got a problem with an Air Native Extension in Android.</p>
  
  <p>The ANE receive a Bitmap from the Actionscript side, compress it in jpeg format and send it back to the Actionscript that will write it on the storage.</p>
  
  <p>Everything is good but one last thing.</p>
  
  <p>It seems that the channels order for Actionscript is different than in Android, so my compressed image have RED colors in place of BLUE.. here is the code:</p>
  
  <p><strong>Actionscript</strong> (I'm using a library called deng.fzip.FZipLibrary to get the bitmap from a zip package)</p>
  
  <pre><code>__image = __fl.getBitmapData(path);
  __de = new DataExchange();
  __ba = __de.bitmapEncode(__image) as ByteArray;
  </code></pre>
  
  <p><strong>Android</strong></p>
  
  <pre><code>...
  try {
      inputValue = (FREBitmapData)arg1[0];
      inputValue.acquire();
      int srcWidth = inputValue.getWidth();
      int srcHeight = inputValue.getHeight();
      Bitmap bm = Bitmap.createBitmap(srcWidth, srcHeight, Config.ARGB_8888);
      bm.copyPixelsFromBuffer(inputValue.getBits());
      ByteArrayOutputStream os = new ByteArrayOutputStream();
      bm.compress(Bitmap.CompressFormat.JPEG, 80, os);
      compressed = os.toByteArray();
      inputValue.release();
  } catch (Exception e) {
      e.printStackTrace();
  }
  
  try {
      returnValue = FREByteArray.newByteArray();
      returnValue.setProperty("length", FREObject.newObject(compressed.length));
      returnValue.acquire();
      ByteBuffer returnBytes = returnValue.getBytes();
      returnBytes.put(compressed, 0, compressed.length);
      returnValue.release();
  }
  ...
  </code></pre>
  
  <p>Anyone have an idea on how to convert the red to blue in the android side before send the image back? Or it needs to be done in the actionscript side?</p>
  
  <p>Thank you very much and regards,</p>
  
  <p>Gianpiero</p>