How to fix - cannot encode object: 28.0, of type: <class 'PIL.TiffImagePlugin.IFDRational'>?

Viewed 319

I am attempting to serialize EXIF metadata from a JPEG file using pillow in python3. The metadata are being extracted using my_jpeg_image._getexif() (perhaps there is a better way).

When I try to serialize* those data, I receive the error

cannot encode object: 28.0, of type: <class 'PIL.TiffImagePlugin.IFDRational'>

Why is a TiffImagePlugin class being used by pillow for JPEG metadata extraction?

How can I convert a IFDRational to a serializable type e.g. float/int in this case (and/or in general)?

Thanks!

[*FWIW, into mongodb]

1 Answers
Related