Página Inicial > Não Categorizado > Python: Detectar o formato de uma imagem

Python: Detectar o formato de uma imagem

Como detectar o formato ou tipo  de uma imagem em python?

Numa breve pesquisa no Google encontrei a biblioteca imghdr

"imghdr — Determine the type of an image"

Ou seja, por exemplo:

>>> import imghdr
>>> imghdr.what('minha_imagem.gif')

RESULTADO:
'gif'

fonte: http://docs.python.org/library/imghdr.html

  1. Ainda sem nenhum comentário.
  1. Ainda sem nenhum trackback.
Por favor autentique-se para enviar um coment´rio.