readPng

Easily reads a png file into a MemoryImage

  1. MemoryImage readPng(string filename)
    MemoryImage
    readPng
    (
    string filename
    )
  2. PNG* readPng(ubyte[] data)

Return Value

Type: MemoryImage

Please note this function doesn't return null right now, but you should still check for null anyway as that might change.

The returned MemoryImage is either a IndexedImage or a TrueColorImage, depending on the file's color mode. You can cast it to one or the other, or just call MemoryImage.getAsTrueColorImage which will cast and return or convert as needed automatically.

Greyscale pngs and bit depths other than 8 are converted for the ease of the MemoryImage interface. If you need more detail, try PNG and getDatastream etc.

Meta