# JPGEncoder = only way to convert BitmapData to ByteArray?

**URL:** https://forum.kirupa.com/t/jpgencoder-only-way-to-convert-bitmapdata-to-bytearray/304580
**Category:** flash
**Created:** [February 10, 2010, 10:54am UTC](https://forum.kirupa.com/t/jpgencoder-only-way-to-convert-bitmapdata-to-bytearray/304580 "2010-02-10T10:54:22Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Ayman](https://avatars.discourse-cdn.com/v4/letter/a/dec6dc/32.png) [@Ayman](https://forum.kirupa.com/u/Ayman)
#### Post date: [February 10, 2010, 10:54am UTC](https://forum.kirupa.com/t/jpgencoder-only-way-to-convert-bitmapdata-to-bytearray/304580/1 "2010-02-10T10:54:22Z")

</div>

So JPGEncoder is amazing and everything, but I’m coming across a case, where I’m loading (at runtime) a jpg image, of unknown compression, might be small in size or large in size. I’m doing some bitwise manipulations on that image, then I want to save it somewhere. Now the problem is that JPGEncoder will force a certain quality (compression), which can really increase the size of the output image (sometimes 10 times), relative to the input one.

All Im doing is changing just a single bit in that image, and I want to then return it as a bytearray. Is there any simpler way, than using JPGEncoder? I dont want to encode at all ! The image is already encoded.

Thanks guys
