I've recently acquired a Motorola Razr Maxx. I had hoped its camera would be good for those random shots of opportunity, but unfortunately its quality seems crippled by overzealous JPEG compression. Most of my shots sport visible compression artifacts, and the files are all between 1 and 3 kB.

The stock UI does not seem to have any options to set the compression level. Does anyone know of an easy procedure to allow the compression level to be changed?


1 Answer 1


There's a bit of a bug in the way Motorola set up the camera profiles on the RAZR (and many other phones in the same family, all of which use a near-identical load of Android) that causes images to be compressed a lot more than they should be.

The problem can be corrected by rooting the phone and making some minor modifications to a configuration file. How to root and modify files on your phone go beyond the scope of this site, but I've included details of what to modify the end of this answer. I've done this modification on multiple devices including my Droid 4, and it does make a difference at the expense of making the files much larger. The same change works on most other Android devices, which will have a similar file.

Android is actually capable of providing "raw" images to applications, but the hardware has to support it and the format is left up to the manufacturer. Most handsets and tablets are powered by a "system on a chip" that does all of the JPEG compression and hands the finished product off to Android. The only real option for Android applications is to set the JPEG quality.

EDIT: This problem does not appear to have been fixed in the Android 4.0.4 load which is being rolled to RAZR and Droid models.

Use the following information at your own risk.

Copy the file /system/etc/media_profiles.xml to /system/etc/media_profiles.xml-ORIG and retain the copy. You will need to restore the original file in order to install future system updates.

In the file /system/etc/media_profiles.xml:

About 30 lines from the top, change

<!ATTLIST ImageEncoding quality (90|80|70|60|50|40) #REQUIRED>


<!ATTLIST ImageEncoding quality (100|95|90|85|80|75|70|60|50|40) #REQUIRED>

Further down in the file, there is one block of lines for each camera (rear, front) that looks like the following:

<ImageEncoding quality="95" />
<ImageEncoding quality="80" />
<ImageEncoding quality="70" />
<ImageDecoding memCap="20000000" />

To disable compression completely, change all of the quality values to 100. Change the the memCap to at least twice the number of megapixels in your device's camera. Larger will not improve the quality of your photos; smaller will force Android to pick a compression value that makes the image fit into that number of bytes.

After making the change, reboot your device.

  • \$\begingroup\$ Thanks Blrfl, that's exactly the information I was looking for! \$\endgroup\$ Jul 2, 2012 at 14:33
  • \$\begingroup\$ This will not work, because it override the media profiles, the compression is being done in libraries or somewere in the apk... ( more like libraries .so ). \$\endgroup\$
    – user11518
    Sep 9, 2012 at 19:01
  • \$\begingroup\$ Hi Mak, welcome to the site. Do you know for sure that @Birfl 's method doesn't work? From the look of it, it seems completely reasonable: the compression is done by compiled code but the behaviour of this code can be acted upon by passing the right parameters \$\endgroup\$
    – Francesco
    Sep 9, 2012 at 19:23
  • \$\begingroup\$ @Francesco: The Camera API has allowed applications to set the compression level since API level 5 (Eclair). API level 8 (Froyo) brought camera profiles which have high, medium and low quality levels determined by values in the file I suggest modifying. If Mak cares to burn rep on a downvote for my answer, I'll be more than happy to rebut it by pointing out the places in the Android source where all of this happens. At any rate, the proof is in the pictures. Thanks for pointing this out. \$\endgroup\$
    – Blrfl
    Sep 9, 2012 at 21:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.