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

Function getJpegMetadata

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

Source from the content-addressed store, hash-verified

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;
57818 if (!isJpeg) return null;
57819 var _getJpegMarkers = getJpegMarkers(), tableMarkers = _getJpegMarkers.tableMarkers, sofMarkers = _getJpegMarkers.sofMarkers;
57820 var i = 2;
57821 while(i + 9 < dataView.byteLength){
57822 var marker = dataView.getUint16(i, BIG_ENDIAN);
57823 if (sofMarkers.has(marker)) return {
57824 mimeType: "image/jpeg",
57825 height: dataView.getUint16(i + 5, BIG_ENDIAN),
57826 width: dataView.getUint16(i + 7, BIG_ENDIAN)
57827 };
57828 if (!tableMarkers.has(marker)) return null;
57829 i += 2;
57830 i += dataView.getUint16(i, BIG_ENDIAN);
57831 }
57832 return null;
57833}
57834function getJpegMarkers() {
57835 var tableMarkers = new Set([
57836 0xffdb,

Callers 1

getBinaryImageMetadataFunction · 0.70

Calls 3

toDataViewFunction · 0.70
getJpegMarkersFunction · 0.70
hasMethod · 0.45

Tested by

no test coverage detected