Go Down

Topic: Writing image file (png, jpg) to SD card? (Read 1 time) previous topic - next topic

Jeff Thompson

Has anyone looked into/had success writing image files using the Arduino, preferably to an SD card?  I don't need high resolution at all or to write the file quickly.

Some possible (but confusing) starting points:
http://www.jpegcameras.com/libjpeg/libjpeg.html
http://pngwriter.sourceforge.net

Possible?

Grumpy_Mike

The big question is where are you going to get the data of the image from?
Writing to an SD card is no problem but the arduino has very little memory to store even a part of an image.
Most image sources like JPEG cameras need the data to be transferred out of them quickly, much quicker than you can write them to an SD card.

Jeff Thompson

Hi Grumpy_Mike, sorry - I should have been a little more detailed:

I'm basically making a *super* low-resolution digital camera using light-sensitive resistors.  The "preview screen" is an array of LEDs.  The total number of pixels will likely be around 9 or 12.  The whole project will hopefully fit inside an old 35mm SLR camera, using the camera's lens.

I'd like to have the system be completely self-contained, so writing an image file is a lot better than the simple solution I have now (writing ASCII values to a .txt file and post-processing using Processing).

CargoCult

Compressed image formats such as JPEG and PNG would require far too much code support to fit practically on to an Arduino; with so few pixels you'd be better off with an uncompressed format like BMP or Netpbm. Support for the latter's images is more common on UNIX-derived systems, but I'm sure you'd be able to find Windows software to open or convert them.

Netpbm's PGM and PPM have ASCII encodings which are incredibly simple. They're really just text files arranged in particular ways.

BMP is pretty basic but more binary-oriented - but should open in pretty much anything.

Good luck!

Jeff Thompson

I was thinking a BMP might be lighter-weight... didn't consider the Wikipedia page would have such a detailed explanation!  Never heard of PGM before - seems hard to convert to any other format without a plugin, so BMP might be the way to go.

I'll have to do some more research on writing binary files.  Suggestions for good (and simple) tutorials to look at?

Go Up