1 Reply Latest reply on Jul 4, 2011 10:36 AM by UbuntuPenguin

    Re-engineering... mx.graphics.codec.JPEGEncoder

    PurpleCasterMinion

      (Busy people version)

       

      Is there any tweaks that can be done on the Adobe encoder (I've already made it async, tyvm) or point me to a JPEG encoder / BitmapData optimizer API or script out there that can be used to get JPEG compression (low physical file size) with image quality (no pixilated images) like the Photoshop's encoder?

       

       

       

      (TL;DR version)

       

      Konnichiwa ,


      I've been fiddling around with AS3 JPEG encoders in a certain Flex 4 project for a while now, trying to find that "one" encoder to rule them all (in the terms of output quality-compression ratio)


      Basically, my Flex 4 application currently does the following -

      • imports user image (re-sizes it for the view port)
      • Gets all color profiles ignored by the Flash Player and appear washed out since its not sRGB lol
      • allows user to crop imported image (like Photoshop, but a lot crappier)
      • exports the crop and the original image (as Byte-data/ByteArray) to the server using the Adobe JPEG encoder and JSP.


      Apart from the colorloss (the fabled flash.display.stage.colorCorrection does not work, I'll give you a cookie and a brownie if you make it work) the size of the physical file is huge compared to a certain benchmark application developed in JavaFx.


      After 4 cans of Red-bull (chuck norris mode) and 16 muffins and a little time spent looking up at the JPEG format documentation, I understood that the AS3 encoder in question refuses to be a J... no wait let me re-phrase that *cough*, the AS3 encoder in question is not upto the benchmarked encoder's standards i.e. its noob. I don't understand why, but, at 100 quality settings the exported image's physical size is bigger than the original. A quality settings of 80 or below results in a pixilated (exported) image.


      The choice of the encoder and Flash platform for image processing was made by the client (i.e. nothing other than the Flex & Adobe encoder is allowed, everything has to be done in the front end also they don't want to use the libjpeg (alchemy) encoder which gives significantly better results compared to the AS3 version)... obviously they didn't foresee this and more obviously the development team pulled a LEEEEEEEEEERRRRRRROOOOOOYYYY when they took the challenge. They also upload images of size 6000x4000 (file size over 17MB) which amazingly gets loaded into the Flash player somehow (but suffers colorloss dude to Adobe RGB color profiles)... I tried to move the image processing tasks to the back-end with Image-magik but I was denied the attempt with a "fix it in the front end" comment. *sigh* If only they played Diablo II, I'd sell them SOJs and a banana phone.


      So before embarking on a massive quest to re-engineer the encoder (if its even possible rotfl) I want to ask / confirm...something...written below...errm with the adobe community,


      Is there any tweaks that can be done on the Adobe encoder (I've already made it async, tyvm) or point me to a JPEG encoder / BitmapData optimizer API or script out there that can be used to get JPEG compression (low physical file size) with image quality (no pixilated images) like the Photoshop's encoder?


      or can you guys at Adobe re-engineer your encoder and make it L337 like the one you have in Photoshop?

       

       

      'neath the endless burning sky,

      Rye