I have a camera I'm planning on attaching to an arduino uno, that I want to take pictures and extract the average RGB value from each image.
This is the camera I have, but I've now realized that it takes pre-compressed JPEG images, and so I cannot make use of the data it's giving me.

I realize that an arduino is not the optimal tool to use in this case, but I'm curious as to whether there would be any way to decompress the images and convert them to a format I could use. It does not need to be fast, and I do not need to take the pictures quickly. I have experience with programming but have not done many projects with the arduino, so any help or advice is appreciated.

  • Here is the JPEG decoding algorithm if you want to give it a try. You only need the DC coefficient of every block, so you can skip a few parts of the decoding. May 13, 2016 at 8:44

1 Answer 1


No. The Arduino (or not the "normal" Arduinos) doesn't have enough memory to decompress JPEG.

I made a JPEG decompressor for chipKIT boards the other day, and it uses the absolute bare minimum memory possible, and still comes it at close to 128kB. Far more than any "normal" Arduino board.

You can possibly do it with one of these new-fangled Linux-based Intel boards that are being sold as Arduino these days, but they are not your normal run-of-the-mill Microcontroller but closer to a Raspberry Pi.

Speaking of which, the Raspberry Pi is probably a much better choice than any Arduino board for the kind of thing you are trying to do.

  • Notice that for getting the average color you only need the DC coefficient of every 8×8 block, which should significantly simplify the problem (at least you do not need to reverse the DCT). I'm not claiming it will fit in 32 KiB, but the OP may try if he finds it amusing. May 13, 2016 at 8:41
  • Alright, this was what I was expecting to hear. Thanks!
    – Ckris
    May 13, 2016 at 21:52

Your Answer

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

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