1

I use a simple code that saves pictures from the picamera as a jpeg. But i want to save the pictures as a MIME-type, which should be possible according to the API, specifically as a .tiff-format.

Can someone help how to get this MIME-type as output? This is my code:

def picture():
    timestamp=datetime.now()
    pc.capture('/home/pi/Pictures/pic'+str(timestamp)+'.jpg')

1 Answer 1

2

Picamera does not seem to support TIFF. Here's a list of supported formats from the documentation:

'jpeg' - Write a JPEG file
'png' - Write a PNG file
'gif' - Write a GIF file
'bmp' - Write a Windows bitmap file
'yuv' - Write the raw image data to a file in YUV420 format
'rgb' - Write the raw image data to a file in 24-bit RGB format
'rgba' - Write the raw image data to a file in 32-bit RGBA format
'bgr' - Write the raw image data to a file in 24-bit BGR format
'bgra' - Write the raw image data to a file in 32-bit BGRA format
'raw' - Deprecated option for raw captures; the format is taken from the deprecated raw_format attribute

The "support" for MIME in picamera is limited to automatically stripping the prefix, that is, you could specify the format as jpg or image/jpg. Specifying image/tiff does not automatically makes TIFF supported.

1
  • 1
    and since TIFF is a metafile format, its contents can include data compressed as LZW (like gif), JPEG, deflate (like png) and none (like bmp) and many other schemes, it's not very useful to specify TIFF as it can be virtually anything
    – scruss
    Nov 2, 2020 at 20:54

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.