How to retrieve image details through the API of mitmdump script?

How can I retrieve image info such as

Format: Compuserve GIF
Version: GIF89a
Size: 1 x 1 px
background: 0

Tried http.response.text but nothing is displayed for an image.

That comes from the contentview, so you’d need to interface with mitmproxy.contentviews. There are unfortunately no docs for that, so please post here if you made it work for you.