it looks like someone found out that PIL really does not read the ICO correctly (I see the same after matching its source code with some studies in the ICO format - there is the AND bit, which defines transparency) and came up with this extension:
http://www.djangosnippets.org/snippets/1287/
since this is useful for applications other than django, I have reworked several modifications here to exclude it:
import operator import struct from PIL import BmpImagePlugin, PngImagePlugin, Image def load_icon(file, index=None): ''' Load Windows ICO image. See http://en.wikipedia.org/w/index.php?oldid=264332061 for file format description. ''' if isinstance(file, basestring): file = open(file, 'rb') try: header = struct.unpack('<3H', file.read(6)) except: raise IOError('Not an ICO file')
source share