readBmp

Reads a bitmap out of an in-memory array of data. For example, from the data returned from std.file.read.

It forwards the arguments to readBmpIndirect, so see that for more details.

If you are given a raw pointer to some data, you might just slice it: bytes 2-6 of the file header (if present) are a little-endian uint giving the file size. You might slice only to that, or you could slice right to int.max and trust the library to bounds check for you based on data integrity checks.

  1. MemoryImage readBmp(string filename)
  2. MemoryImage readBmp(ubyte[] data, bool lookForFileHeader, bool hackAround64BitLongs, bool hasAndMask)
    readBmp
    (
    in ubyte[] data
    ,
    bool lookForFileHeader = true
    ,
    bool hackAround64BitLongs = false
    ,
    bool hasAndMask = false
    )
Suggestion Box / Bug Report