termal receipt camera

Hello to everybody,
I'm at my first project in the Arduino big (and wild... at least for me) world so be patient about my stupid questions...

I want to create a camera that take a snapshot and print it immediately on thermal paper like a sort of polaroid camera...

This is my cart on Adafruit
1 x Mini Thermal Receipt Printer Starter Pack[ID:600]
1 x Miniature TTL Serial JPEG Camera with NTSC Video[ID:1386]
1 x Adafruit METRO 328 with Headers (ATmega328) [ID:2488]
1 x 16mm Illuminated Pushbutton - White Momentary
1 x SD card breakout board+ (from amazon not Adafruit)
(various wiring and battery case)

i've found online a lot of sketch to take a snapshot and save it to a SD card, other which read when a button is pressed and another one to print a bitmap image... but nothing that combines all "out of the box"...

the first problem, before linking all the sketch into a "big- sketch", i need something that convert an image (JPEG) to a bitmap that i can print... is there something that do this thing?
Or there is a way to save the image captured by the TTL camera directly in Bitmap format?

An Arduino does not have the memory or speed to deal with images. A Raspberry Pi would be more suitable.

...R

Somewhere there is a JPEG decoder, but I think it takes at least a Mega.

That Adafruit example relies on the camera to do the JPG compression so that it doesn't have to spend several minutes per photo reading each byte of data. The example just copies data without understanding what it is copying.

You may have to do the JPG decompression inside the Arduino. Then you need a Mega or bigger. Not the most simple project.

then i need a MEGA...

i've found this on GitHub
that is a JPEG decoder written to "rendering of Jpeg files stored both on SD card and in arrays within program memory (FLASH) onto a TFT display"

can this be usefull?

Useful, but slow.

... and still limited to rather small images, as you still have only 8 kB of RAM to work with.

You can probably swap the metro 328 in your cart for the metro m0 and do your project. The M0 is essentially the same as an Arduino zero, which has boo-koo ram and runs 4 times faster than a 328.

So I'll go for a MEGA but from another company (order already placed) and I'll use the metro for other projects!

I don't need a super faster processor cause I'll take it low with resolution: the printer is limited to 384dots/line so my image will be low resolution and relatively small in size!

I was thinking to add an algorithm to have 1 shade of gray in addition to black and white:
I want to define if every pixel is white gray or black using the sum of the output on the RGB channel
Ex. A white pixel will be (255+255+255=765) a black one (0+0+0=0) so if I divide the range 765:0 in 3 section I'll obtain 765:510 white 510:255 gray 255:0 black
And this can be outputted by 4 dots:
White
0 0
0 0

Gray
1 0
0 1

Black
1 1
1 1

With this "pixel quadruplication" and the limitations of dot/line of the printer the best resolution will be something like NNN X 190 so I'll go for 320x240 image losing something like 1/3 of the image in height

Is there a way to decode a JPEG image in an array of pixel with RGB value?
The only "coding" language I know is MATLAB so I think in order of vector and matrix of value... Can this be done in Arduino?

Ok. So multiply it out. 320x240 times 3 bytes per pixel. Does that fit in the memory of the Mega with space left over for the jpg processor and anything else?

mhhh...
you are speaking a foreign language for me...
320x240x3=230400 bytes
from the tech specs the MEGA has "256 KB of which 8 KB used by bootloader" so this left me with 248000 bytes of free space, ergo 17kb for the sketch... will this be enough?

is better to go with a raspberry and follow this guide? thermal receipt camera

You're confusing RAM (for images) with flash (for code)

Also, 1 kB = 1024 bytes.