Return |Bmp| instance having header properties parsed from the BMP image in `stream`.
(cls, stream)
| 8 | |
| 9 | @classmethod |
| 10 | def from_stream(cls, stream): |
| 11 | """Return |Bmp| instance having header properties parsed from the BMP image in |
| 12 | `stream`.""" |
| 13 | stream_rdr = StreamReader(stream, LITTLE_ENDIAN) |
| 14 | |
| 15 | px_width = stream_rdr.read_long(0x12) |
| 16 | px_height = stream_rdr.read_long(0x16) |
| 17 | |
| 18 | horz_px_per_meter = stream_rdr.read_long(0x26) |
| 19 | vert_px_per_meter = stream_rdr.read_long(0x2A) |
| 20 | |
| 21 | horz_dpi = cls._dpi(horz_px_per_meter) |
| 22 | vert_dpi = cls._dpi(vert_px_per_meter) |
| 23 | |
| 24 | return cls(px_width, px_height, horz_dpi, vert_dpi) |
| 25 | |
| 26 | @property |
| 27 | def content_type(self): |
nothing calls this directly
no test coverage detected