ICO reader / writer¶
The flexx.util.ico
module uses the png
module plus additonal code
to be able to read and write icon files.
-
class
flexx.util.icon.
Icon
(*filenames)¶ Object for reading/creating icons. Considers only RGBA icons. Can deal with images stored raw (BMP) and compressed (PNG).
-
add
(data)¶ Add an image represented as bytes or bytearray. The size of the image is inferred from the number of bytes. The image is assumed to be square and in RGBA format.
-
from_bytes
(ext, data)¶ Read an image from the raw bytes of the encoded image. The format is specified by the extension (or filename).
-
image_sizes
()¶ Get a tuple of image sizes (integers) currently loaded.
-
read
(filename)¶ Read an image from the given filename and add to collection. Can be an ICO, PNG, or BMP file. When a grayscale or RGB image is read, it is converted to RGBA. Some restrictions may apply to the formats that can be read.
-
to_bytes
()¶ Return the bytes that represent the .ico image. This function can be used by webservers to serve the ico image without needing a physical representation on disk.
-
write
(filename)¶ Write the icon collection to an image with the given filename. Can be an ICO, ICNS, PNG, or BMP file. In case of PNG/BMP, multiple images may be generated, the image size is appended to the file name.
-