reuterbal / photobooth

A flexible photobooth software
GNU Affero General Public License v3.0
319 stars 157 forks source link

[Feature request] support thermal receipt printer like Epson TM serie #169

Open mbauer-0805 opened 5 years ago

mbauer-0805 commented 5 years ago

Hi, I think it could be a fun, fast and inexpensive solution to use a thermal receipt printer to print out the pictures. The Epson TM printer seems to be one of the standard receipt printer and there are a lot of used models available. Unfortunately there is no official CUPS driver for the ARM architecture of Raspberry. Here is a unofficial driver available, but it seems to be slow (not testet yet). I found a python project where you can send the prints direct to the printer, no use of CUPS is needed. It seems to be very fast. Unhappily my developer skills are not good enough to add the python printing solution by myself. Additional thing that had to be considered is the arrangement of the final picture. I think a good solution could be the send the 4 pictures in a row the the printer, like the old analog photobooth, and create the 2x2 picture to store and upload.
Thank you for the great work! Greetings Marc

mbauer-0805 commented 5 years ago

Hi, I played around with different settings. Actually the CUPS driver is fast enough, it takes 3 - 5 seconds for the print. Now I would like to test with black and white pictures. Currently I test with a Logitech webcam and OpenCV. Best solution will be to create two final images, one in black and white 1x4 for the printer and one colored 2x2 to store. If one of you can put me in the right direction where to change, I would be happy. Thanks, greetings Marc

mbauer-0805 commented 5 years ago

OK, I think I have a setup. The assembled picture will send to CUPS for print out. I store the single shots in a higher resolution for later post processing. With my setup, raspberry + Logitech C920 I have to add this two lines in CameraOpenCV.py: ` def getPicture(self):

    self.setActive()
    **self._cap.set(3, 1920)
    self._cap.set(4, 1080)**
    status, frame = self._cap.read()
    if not status:
        raise RuntimeError('Failed to capture picture')

` With out I'm only able to store the pictures in 640x480 resolution.

Now I searching how I can add a post processing for the assemble picture, to optimize it for the thermal printer. Something like "convert gradient.png -ordered-dither h6x6a od_h6x6a.gif" with imagemagick or pymagick. any ideas? THX Marc

mbauer-0805 commented 5 years ago

Update: OK, to set a larger resolution was not the best idea, or the wrong place. Also the preview will be displayed in high resolution an this make it really slow in my environment. To convert the assembled picture to B/W + Dither, I simple add convert('1') to line 170 in camera/init.py resized = shot.resize(self._pic_dims.thumbnailSize).convert('1') but currently I like the prints in pure B/W (convert("L") ) more, I will play around with different settings thx Marc