laurentalacoque / TouchSelfie-extended

Open Source Photobooth based on the official Raspberry Pi 7" Touchscreen
54 stars 33 forks source link

How to flip the image taken ? #81

Closed djtale closed 5 years ago

djtale commented 5 years ago

Hello,

I have found in user_interface the code to flip the image of the camera. But is it possible to flip the image that is saved and displayed on the screen ?

Thanks.

laurentalacoque commented 5 years ago

Hey djtale :)

If you want both the preview and the snapshots to be flipped, you just have to set these:

        self.camera.preview.hflip = True  #Mirror effect on preview for easier selfies
        self.camera.hflip = True  #Mirror effect on captured images

The photobooth code currently only flips the preview (so that the preview looks like a mirror) but doesn't flip the output (so that text in the picture isn't written right to left)

For more control over your captured images, you can also use the following: To flip captured images you can use a geometrical transform from PIL library

snapshot = Image.open('snapshot.jpg') # open the snapshot
snapshot = snapshot.transpose(Image.FLIP_LEFT_RIGHT) # flip it
snapshot.save("snapshot.jpg") # save it
djtale commented 5 years ago

Thanks a lot Laurent.

Indeed I have to take care of the watermark I apply to the image.

I'll do some tests.