MCPcopy Index your code
hub / github.com/microsoft/SandDance / getPngMetadata

Function getPngMetadata

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

Source from the content-addressed store, hash-verified

57783 return getPngMetadata(dataView) || getJpegMetadata(dataView) || getGifMetadata(dataView) || getBmpMetadata(dataView);
57784}
57785function getPngMetadata(binaryData) {
57786 var dataView = toDataView(binaryData);
57787 var isPng = dataView.byteLength >= 24 && dataView.getUint32(0, BIG_ENDIAN) === 0x89504e47;
57788 if (!isPng) return null;
57789 return {
57790 mimeType: "image/png",
57791 width: dataView.getUint32(16, BIG_ENDIAN),
57792 height: dataView.getUint32(20, BIG_ENDIAN)
57793 };
57794}
57795function getGifMetadata(binaryData) {
57796 var dataView = toDataView(binaryData);
57797 var isGif = dataView.byteLength >= 10 && dataView.getUint32(0, BIG_ENDIAN) === 0x47494638;

Callers 1

getBinaryImageMetadataFunction · 0.70

Calls 1

toDataViewFunction · 0.70

Tested by

no test coverage detected