MCPcopy Create free account
hub / github.com/microsoft/SandDance / getBmpMetadata

Function getBmpMetadata

docs/app/js/sanddance-app.js:57805–57814  ·  view source on GitHub ↗
(binaryData)

Source from the content-addressed store, hash-verified

57803 };
57804}
57805function getBmpMetadata(binaryData) {
57806 var dataView = toDataView(binaryData);
57807 var isBmp = dataView.byteLength >= 14 && dataView.getUint16(0, BIG_ENDIAN) === 0x424d && dataView.getUint32(2, LITTLE_ENDIAN) === dataView.byteLength;
57808 if (!isBmp) return null;
57809 return {
57810 mimeType: "image/bmp",
57811 width: dataView.getUint32(18, LITTLE_ENDIAN),
57812 height: dataView.getUint32(22, LITTLE_ENDIAN)
57813 };
57814}
57815function getJpegMetadata(binaryData) {
57816 var dataView = toDataView(binaryData);
57817 var isJpeg = dataView.byteLength >= 3 && dataView.getUint16(0, BIG_ENDIAN) === 0xffd8 && dataView.getUint8(2) === 0xff;

Callers 1

getBinaryImageMetadataFunction · 0.70

Calls 1

toDataViewFunction · 0.70

Tested by

no test coverage detected