New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

exifly

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exifly - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

8

dist/Exifly.d.ts

@@ -1,2 +0,2 @@

import { ExiflyOpts } from './typings';
import { EXIF_IFD, ExiflyOpts, GPS_INFO_IFD, ZEROTH_IFD } from './typings';
/**

@@ -34,9 +34,9 @@ * Based on https://github.com/exif-heic-js/exif-heic-js

private readEXIFData;
heic(): false | Record<string, string | number | Number | Number[] | undefined> | null;
heic(): false | Record<EXIF_IFD | ZEROTH_IFD | GPS_INFO_IFD, string | number | Number | Number[] | undefined> | null;
/**
* @alias jpg
*/
jpeg(): false | Record<string, string | number | Number | Number[] | undefined> | undefined;
jpg(): false | Record<string, string | number | Number | Number[] | undefined> | undefined;
jpeg(): false | Record<EXIF_IFD | ZEROTH_IFD | GPS_INFO_IFD, string | number | Number | Number[] | undefined> | undefined;
jpg(): false | Record<EXIF_IFD | ZEROTH_IFD | GPS_INFO_IFD, string | number | Number | Number[] | undefined> | undefined;
raw(): void;
}

@@ -25,2 +25,2 @@ /**

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Exifly={})}(this,(function(e){"use strict";var t,i,n,o;e.ZEROTH_IFD=void 0,(t=e.ZEROTH_IFD||(e.ZEROTH_IFD={})).Compression="Compression",t.ImageDescription="ImageDescription",t.Make="Make",t.Model="Model",t.XResolution="XResolution",t.YResolution="YResolution",t.ResolutionUnit="ResolutionUnit",t.TransferFunction="TransferFunction",t.Artist="Artist",t.WhitePoint="WhitePoint",t.PrimaryChromaticities="PrimaryChromaticities",t.YcbCrCoefficients="YcbCrCoefficients",t.ReferenceBlackWhite="ReferenceBlackWhite",t.Copyright="Copyright",t.ImageWidth="ImageWidth",t.ImageLength="ImageLength",t.BitsPerSample="BitsPerSample",t.PhotometricInterpretation="PhotometricInterpretation",t.Orientation="Orientation",t.SamplesPerPixel="SamplesPerPixel",t.PlanarConfiguration="PlanarConfiguration",t.YCbCrSubSampling="YCbCrSubSampling",t.YCbCrPositioning="YCbCrPositioning",t.StripOffsets="StripOffsets",t.RowsPerStrip="RowsPerStrip",t.StripByteCounts="StripByteCounts",t.JPEGInterchangeFormat="JPEGInterchangeFormat",t.JPEGInterchangeFormatLength="JPEGInterchangeFormatLength",t.Software="Software",t.DateTime="DateTime",t.ExifIFDPointer="Exif IFD Pointer",t.GPSInfoIFDPointer="GPS Info IFD Pointer",t.InteroperabilityIFDPointer="Interoperability IFD Pointer",e.EXIF_IFD=void 0,(i=e.EXIF_IFD||(e.EXIF_IFD={})).ExposureTime="ExposureTime",i.FNumber="FNumber",i.ExposureProgram="ExposureProgram",i.SpectralSensitivity="SpectralSensitivity",i.PhotographicSensitivity="PhotographicSensitivity",i.OECF="OECF",i.SensitivityType="SensitivityType",i.StandardOutputSensitivity="StandardOutputSensitivity",i.RecommendedExposurelndex="RecommendedExposurelndex",i.ISOSpeed="ISOSpeed",i.ISOSpeedLatitudeyyy="ISOSpeedLatitudeyyy",i.ISOSpeedLatitudezzz="ISOSpeedLatitudezzz",i.ExifVersion="ExifVersion",i.DateTimeOriginal="DateTimeOriginal",i.DateTimeDigitized="DateTimeDigitized",i.ComponentsConfiguration="ComponentsConfiguration",i.ShutterSpeedValue="ShutterSpeedValue",i.ApertureValue="ApertureValue",i.BrightnessValue="Brightness Value",i.ExposureBiasValue="ExposureBiasValue",i.MaxApertureValue="MaxAperture Value",i.SubjectDistance="SubjectDistance",i.MeteringMode="MeteringMode",i.LightSource="LightSource",i.Flash="Flash",i.FocalLength="FocalLength",i.MakerNote="MakerNote",i.UserComment="UserComment",i.SubSecTime="SubSecTime",i.SubSecTimeOriginal="SubSecTimeOriginal",i.SubSecTimeDigitized="SubSecTimeDigitized",i.FlashpixVersion="FlashpixVersion",i.ColorSpace="ColorSpace",i.RelatedSoundFile="RelatedSoundFile",i.FlashEnergy="FlashEnergy",i.SpatialFrequencyResponse="SpatialFrequencyResponse",i["FocalPlaneX-Resolution"]="FocalPlaneX-Resolution",i["FocalPlaneY-Resolution"]="FocalPlaneY-Resolution",i["FocalPlane-ResolutionUnit"]="FocalPlane-ResolutionUnit",i.Exposurelndex="Exposurelndex",i.SensingMethod="SensingMethod",i.FileSource="FileSource",i.SceneType="SceneType",i.CFApattern="CFApattern",i.ExposureMode="ExposureMode",i.WhiteBalance="WhiteBalance",i.DigitalZoomRatio="DigitalZoomRatio",i.FocalLengthIn35mmFilm="FocalLengthIn35mmFilm",i["SceneCapture Type"]="SceneCapture Type",i.GainControl="GainControl",i.Contrast="Contrast",i.Saturation="Saturation",i.Sharpness="Sharpness",i.DeviceSettingDescription="DeviceSettingDescription",i.SubjectDistanceRange="SubjectDistanceRange",i.ImageUniquelD="ImageUniquelD",i.CameraOwnerName="CameraOwnerName",i.BodySerialNumber="BodySerialNumber",i.LensSpecification="LensSpecification",i.LensMake="LensMake",i.LensModel="LensModel",i.LensSerialNumber="LensSerialNumber",i.Gamma="Gamma",i.CompressedBitsPerPixel="CompressedBitsPerPixel",i.PixelXDimension="PixelXDimension",i.PixelYDimension="PixelYDimension",i.SubjectArea="SubjectArea",i.FocalPlaneXResolution="FocalPlaneXResolution",i.FocalPlaneYResolution="FocalPlaneYResolution",i.FocalPlaneResolutionUnit="FocalPlaneResolutionUnit",i.SubjectLocation="SubjectLocation",i.ExposureIndex="ExposureIndex",i.CFAPattern="CFAPattern",i.CustomRendered="CustomRendered",i.DigitalZoomRation="DigitalZoomRation",i.SceneCaptureType="SceneCaptureType",i.ImageUniqueID="ImageUniqueID",e.INTEROPERABILITY_IFD=void 0,(e.INTEROPERABILITY_IFD||(e.INTEROPERABILITY_IFD={})).InteroperabilityIndex="InteroperabilityIndex",e.GPS_INFO_IFD=void 0,(n=e.GPS_INFO_IFD||(e.GPS_INFO_IFD={})).GPSVersionID="GPSVersionID",n.GPSLatitudeRef="GPSLatitudeRef",n.GPSLatitude="GPSLatitude",n.GPSImgDirection="GPSImgDirection",n.GPSLongitudeRef="GPSLongitudeRef",n.GPSLongitude="GPSLongitude",n.GPSAltitudeRef="GPSAltitudeRef",n.GPSAltitude="GPSAltitude",n.GPSTimeStamp="GPSTimeStamp",n.GPSSatellites="GPSSatellites",n.GPSStatus="GPSStatus",n.GPSMeasureMode="GPSMeasureMode",n.GPSDOP="GPSOP",n.GPSSpeedRef="GPSSpeedRef",n.GPSSpeed="GPSSpeed",n.GPSTrackRef="GPSTrackRef",n.GPSTrack="GPSTrack",n.GPSImgDirectionRef="GPSImgDirectionRef",n.GPSImgDirectionGPSMapDatum="GP SImgDirection GPSMapDatum",n.GPSDestLatitudeRef="GPSDestLatitudeRef",n.GPSDestLatitude="GPSDestLatitude",n.GPSDestLongitudeRef="GPSDestLongitudeRef",n.GPSDestLongitude="GPSDestLongitude",n.GPSDestBearingRef="GPSDestBearingRef",n.GPSDestBearing="GPSDestBearing",n.GPSDestDistanceRef="GPSDestDistanceRef",n.GPSDestDistance="GPSDestDistance",n.GPSProcessingMethod="GPSProcessingMethod",n.GPSArealnformation="GPSArealnformation",n.GPSDateStamp="GPSDateStamp",n.GPSDifferential="GPSDifferential",n.GPSHPositioningError="GPSHPositioningError",n.GPSMapDatum="GPSMapDatum",n.GPSAreaInformation="GPSAreaInformation",e.FIRST_IFD=void 0,(o=e.FIRST_IFD||(e.FIRST_IFD={})).Compression="Compression",o.ImageDescription="ImageDescription",o.Make="Make",o.Model="Model",o.TransferFunction="TransferFunction",o.Artist="Artist",o.WhitePoint="WhitePoint",o.PrimaryChromaticities="PrimaryChromaticities",o.YCbCrCoefficients="YCbCrCoefficients",o.ReferenceBlackWhite="ReferenceBlackWhite",o.Copyright="Copyright",o.ExifIFDPointer="Exif IFD Pointer",o.GPSInfoIFDPointer="GPS Info IFD Pointer";const r={ZEROTH_IFD:e.ZEROTH_IFD,EXIF_IFD:e.EXIF_IFD,GPS_INFO_IFD:e.GPS_INFO_IFD,INTEROPERABILITY_IFD:e.INTEROPERABILITY_IFD,FIRST_IFD:e.FIRST_IFD},a={36864:r.EXIF_IFD.ExifVersion,40960:r.EXIF_IFD.FlashpixVersion,40961:r.EXIF_IFD.ColorSpace,40962:r.EXIF_IFD.PixelXDimension,40963:r.EXIF_IFD.PixelYDimension,37121:r.EXIF_IFD.ComponentsConfiguration,37122:r.EXIF_IFD.CompressedBitsPerPixel,37500:r.EXIF_IFD.MakerNote,37510:r.EXIF_IFD.UserComment,40964:r.EXIF_IFD.RelatedSoundFile,36867:r.EXIF_IFD.DateTimeOriginal,36868:r.EXIF_IFD.DateTimeDigitized,37520:r.EXIF_IFD.SubSecTime,37521:r.EXIF_IFD.SubSecTimeOriginal,37522:r.EXIF_IFD.SubSecTimeDigitized,33434:r.EXIF_IFD.ExposureTime,33437:r.EXIF_IFD.FNumber,34850:r.EXIF_IFD.ExposureProgram,34852:r.EXIF_IFD.SpectralSensitivity,34855:r.EXIF_IFD.PhotographicSensitivity,34856:r.EXIF_IFD.OECF,37377:r.EXIF_IFD.ShutterSpeedValue,37378:r.EXIF_IFD.ApertureValue,37379:r.EXIF_IFD.BrightnessValue,37380:r.EXIF_IFD.ExposureBiasValue,37381:r.EXIF_IFD.MaxApertureValue,37382:r.EXIF_IFD.SubjectDistance,37383:r.EXIF_IFD.MeteringMode,37384:r.EXIF_IFD.LightSource,37385:r.EXIF_IFD.Flash,37396:r.EXIF_IFD.SubjectArea,37386:r.EXIF_IFD.FocalLength,41483:r.EXIF_IFD.FlashEnergy,41484:r.EXIF_IFD.SpatialFrequencyResponse,41486:r.EXIF_IFD.FocalPlaneXResolution,41487:r.EXIF_IFD.FocalPlaneYResolution,41488:r.EXIF_IFD.FocalPlaneResolutionUnit,41492:r.EXIF_IFD.SubjectLocation,41493:r.EXIF_IFD.ExposureIndex,41495:r.EXIF_IFD.SensingMethod,41728:r.EXIF_IFD.FileSource,41729:r.EXIF_IFD.SceneType,41730:r.EXIF_IFD.CFAPattern,41985:r.EXIF_IFD.CustomRendered,41986:r.EXIF_IFD.ExposureMode,41987:r.EXIF_IFD.WhiteBalance,41988:r.EXIF_IFD.DigitalZoomRation,41989:r.EXIF_IFD.FocalLengthIn35mmFilm,41990:r.EXIF_IFD.SceneCaptureType,41991:r.EXIF_IFD.GainControl,41992:r.EXIF_IFD.Contrast,41993:r.EXIF_IFD.Saturation,41994:r.EXIF_IFD.Sharpness,41995:r.EXIF_IFD.DeviceSettingDescription,41996:r.EXIF_IFD.SubjectDistanceRange,40965:r.ZEROTH_IFD.InteroperabilityIFDPointer,42016:r.EXIF_IFD.ImageUniqueID,42034:r.EXIF_IFD.LensSpecification,42035:r.EXIF_IFD.LensMake,42036:r.EXIF_IFD.LensModel,42037:r.EXIF_IFD.LensSerialNumber},s={256:r.ZEROTH_IFD.ImageWidth,257:r.ZEROTH_IFD.ImageLength,34665:r.ZEROTH_IFD.ExifIFDPointer,34853:r.ZEROTH_IFD.GPSInfoIFDPointer,40965:r.ZEROTH_IFD.InteroperabilityIFDPointer,258:r.ZEROTH_IFD.BitsPerSample,259:r.ZEROTH_IFD.Compression,262:r.ZEROTH_IFD.PhotometricInterpretation,274:r.ZEROTH_IFD.Orientation,277:r.ZEROTH_IFD.SamplesPerPixel,284:r.ZEROTH_IFD.PlanarConfiguration,530:r.ZEROTH_IFD.YCbCrSubSampling,531:r.ZEROTH_IFD.YCbCrPositioning,282:r.ZEROTH_IFD.XResolution,283:r.ZEROTH_IFD.YResolution,296:r.ZEROTH_IFD.ResolutionUnit,273:r.ZEROTH_IFD.StripOffsets,278:r.ZEROTH_IFD.RowsPerStrip,279:r.ZEROTH_IFD.StripByteCounts,513:r.ZEROTH_IFD.JPEGInterchangeFormat,514:r.ZEROTH_IFD.JPEGInterchangeFormatLength,301:r.ZEROTH_IFD.TransferFunction,318:r.ZEROTH_IFD.WhitePoint,319:r.ZEROTH_IFD.PrimaryChromaticities,529:r.ZEROTH_IFD.YcbCrCoefficients,532:r.ZEROTH_IFD.ReferenceBlackWhite,306:r.ZEROTH_IFD.DateTime,270:r.ZEROTH_IFD.ImageDescription,271:r.ZEROTH_IFD.Make,272:r.ZEROTH_IFD.Model,305:r.ZEROTH_IFD.Software,315:r.ZEROTH_IFD.Artist,33432:r.ZEROTH_IFD.Copyright},F={0:r.GPS_INFO_IFD.GPSVersionID,1:r.GPS_INFO_IFD.GPSLatitudeRef,2:r.GPS_INFO_IFD.GPSLatitude,3:r.GPS_INFO_IFD.GPSLongitudeRef,4:r.GPS_INFO_IFD.GPSLongitude,5:r.GPS_INFO_IFD.GPSAltitudeRef,6:r.GPS_INFO_IFD.GPSAltitude,7:r.GPS_INFO_IFD.GPSTimeStamp,8:r.GPS_INFO_IFD.GPSSatellites,9:r.GPS_INFO_IFD.GPSStatus,10:r.GPS_INFO_IFD.GPSMeasureMode,11:r.GPS_INFO_IFD.GPSDOP,12:r.GPS_INFO_IFD.GPSSpeedRef,13:r.GPS_INFO_IFD.GPSSpeed,14:r.GPS_INFO_IFD.GPSTrackRef,15:r.GPS_INFO_IFD.GPSTrack,16:r.GPS_INFO_IFD.GPSImgDirectionRef,17:r.GPS_INFO_IFD.GPSImgDirection,18:r.GPS_INFO_IFD.GPSMapDatum,19:r.GPS_INFO_IFD.GPSDestLatitudeRef,20:r.GPS_INFO_IFD.GPSDestLatitude,21:r.GPS_INFO_IFD.GPSDestLongitudeRef,22:r.GPS_INFO_IFD.GPSDestLongitude,23:r.GPS_INFO_IFD.GPSDestBearingRef,24:r.GPS_INFO_IFD.GPSDestBearing,25:r.GPS_INFO_IFD.GPSDestDistanceRef,26:r.GPS_INFO_IFD.GPSDestDistance,27:r.GPS_INFO_IFD.GPSProcessingMethod,28:r.GPS_INFO_IFD.GPSAreaInformation,29:r.GPS_INFO_IFD.GPSDateStamp,30:r.GPS_INFO_IFD.GPSDifferential},I={ExposureProgram:{0:"Not defined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},SensingMethod:{1:"Not defined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{0:"Normal process",1:"Custom process"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},GainControl:{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{0:"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},Components:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}};e.EXIF_TAGS=r,e.ExifTags=a,e.GPSTags=F,e.StringValues=I,e.TiffTags=s,e.getExt=function(e){return e.split(".").at(-1)},e.load=class{buf;opts;constructor(e,t){this.buf=e,this.opts=Object.create(null),this.opts.debug=t?.debug??!1}readTags(e,t,i,n,o){let r,a,s,F=e.getUint16(i,!o),I={};for(s=0;s<F;s++)r=i+12*s+2,a=n[e.getUint16(r,!o)],!a&&this.opts.debug&&console.log("Unknown tag: "+e.getUint16(r,!o)),I[a]=this.readTagValue(e,r,t,i,o);return I}readTagValue(e,t,i,n,o){let r,a,s,F,I,l=e.getUint16(t+2,!o),S=e.getUint32(t+4,!o),u=e.getUint32(t+8,!o)+i;switch(l){case 1:case 7:if(1==S)return e.getUint8(t+8);r=S>4?u:t+8,a=[];for(let t=0;t<S;t++)a[t]=e.getUint8(r+t);return a;case 2:return r=S>4?u:t+8,this.getStringFromDB(e,r,S-1);case 3:if(1==S)return e.getUint16(t+8,!o);r=S>2?u:t+8,a=[];for(let t=0;t<S;t++)a[t]=e.getUint16(r+2*t,!o);return a;case 4:if(1==S)return e.getUint32(t+8,!o);a=[];for(let t=0;t<S;t++)a[t]=e.getUint32(u+4*t,!o);return a;case 5:if(1==S)return F=e.getUint32(u,!o),I=e.getUint32(u+4,!o),s=new Number(F/I),s.numerator=F,s.denominator=I,s;a=[];for(let t=0;t<S;t++)F=e.getUint32(u+8*t,!o),I=e.getUint32(u+4+8*t,!o),a[t]=new Number(F/I),a[t].numerator=F,a[t].denominator=I;return a;case 9:if(1==S)return e.getInt32(t+8,!o);a=[];for(let t=0;t<S;t++)a[t]=e.getInt32(u+4*t,!o);return a;case 10:if(1==S)return e.getInt32(u,!o)/e.getInt32(u+4,!o);a=[];for(let t=0;t<S;t++)a[t]=e.getInt32(u+8*t,!o)/e.getInt32(u+4+8*t,!o);return a}}getStringFromDB(e,t,i){let n="";for(let o=t;o<t+i;o++)n+=String.fromCharCode(e.getUint8(o));return n}readEXIFData(e,t){let i,n,o,r,l;if(18761==e.getUint16(t))i=!1;else{if(19789!=e.getUint16(t))return this.opts.debug&&console.log("Not valid TIFF data! (no 0x4949 or 0x4D4D)"),!1;i=!0}if(42!=e.getUint16(t+2,!i))return this.opts.debug&&console.log("Not valid TIFF data! (no 0x002A)"),!1;const S=e.getUint32(t+4,!i);if(S<8)return this.opts.debug&&console.log("Not valid TIFF data! (First offset less than 8)"),!1;if(n=this.readTags(e,t,t+S,s,i),n.ExifIFDPointer)for(o in r=this.readTags(e,t,t+n.ExifIFDPointer,a,i),r){switch(o){case"LightSource":case"Flash":case"MeteringMode":case"ExposureProgram":case"SensingMethod":case"SceneCaptureType":case"SceneType":case"CustomRendered":case"WhiteBalance":case"GainControl":case"Contrast":case"Saturation":case"Sharpness":case"SubjectDistanceRange":case"FileSource":r[o]=I[o][r[o]];break;case"ExifVersion":case"FlashpixVersion":r[o]=String.fromCharCode(r[o][0],r[o][1],r[o][2],r[o][3]);break;case"ComponentsConfiguration":r[o]=I.Components[r[o][0]]+I.Components[r[o][1]]+I.Components[r[o][2]]+I.Components[r[o][3]]}n[o]=r[o]}if(n.GPSInfoIFDPointer)for(o in l=this.readTags(e,t,t+n.GPSInfoIFDPointer,F,i),l){if("GPSVersionID"===o)l[o]=l[o][0]+"."+l[o][1]+"."+l[o][2]+"."+l[o][3];n[o]=l[o]}return n}heic(){const e=new DataView(this.buf),t=e.getUint32(0),i=e.getUint32(t);let n=-1,o=-1;for(let r=t;r<i+t;r++)"Exif"==this.getStringFromDB(e,r,4)?n=r:"iloc"==this.getStringFromDB(e,r,4)&&(o=r);if(-1==n||-1==o)return null;const r=e.getUint16(n-4);for(let a=o+12;a<i+t;a+=16){if(e.getUint16(a)==r){const t=e.getUint32(a+8);e.getUint32(a+12);return n=t+(4+e.getUint32(t)),this.readEXIFData(e,n)}}return null}jpeg(){const e=this.buf,t=new DataView(e);if(255!=t.getUint8(0)||216!=t.getUint8(1))return this.opts.debug&&console.log("Not a valid JPEG"),!1;let i,n=2,o=e.byteLength;for(;n<o;){if(255!=t.getUint8(n))return this.opts.debug&&console.log("Not a valid marker at offset "+n+", found: "+t.getUint8(n)),!1;if(i=t.getUint8(n+1),this.opts.debug&&console.log(i),225==i)return this.opts.debug&&console.log("Found 0xFFE1 marker"),this.readEXIFData(t,n+4+6);n+=2+t.getUint16(n+2)}}jpg(){return this.jpeg()}raw(){const e=this.buf;console.log(e)}},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Exifly={})}(this,(function(e){"use strict";var t,i,n,o;e.ZEROTH_IFD=void 0,(t=e.ZEROTH_IFD||(e.ZEROTH_IFD={})).Compression="Compression",t.ImageDescription="ImageDescription",t.Make="Make",t.Model="Model",t.XResolution="XResolution",t.YResolution="YResolution",t.ResolutionUnit="ResolutionUnit",t.TransferFunction="TransferFunction",t.Artist="Artist",t.WhitePoint="WhitePoint",t.PrimaryChromaticities="PrimaryChromaticities",t.YcbCrCoefficients="YcbCrCoefficients",t.ReferenceBlackWhite="ReferenceBlackWhite",t.Copyright="Copyright",t.ImageWidth="ImageWidth",t.ImageLength="ImageLength",t.BitsPerSample="BitsPerSample",t.PhotometricInterpretation="PhotometricInterpretation",t.Orientation="Orientation",t.SamplesPerPixel="SamplesPerPixel",t.PlanarConfiguration="PlanarConfiguration",t.YCbCrSubSampling="YCbCrSubSampling",t.YCbCrPositioning="YCbCrPositioning",t.StripOffsets="StripOffsets",t.RowsPerStrip="RowsPerStrip",t.StripByteCounts="StripByteCounts",t.JPEGInterchangeFormat="JPEGInterchangeFormat",t.JPEGInterchangeFormatLength="JPEGInterchangeFormatLength",t.Software="Software",t.DateTime="DateTime",t.ExifIFDPointer="Exif IFD Pointer",t.GPSInfoIFDPointer="GPS Info IFD Pointer",t.InteroperabilityIFDPointer="Interoperability IFD Pointer",e.EXIF_IFD=void 0,(i=e.EXIF_IFD||(e.EXIF_IFD={})).ExposureTime="ExposureTime",i.FNumber="FNumber",i.ExposureProgram="ExposureProgram",i.SpectralSensitivity="SpectralSensitivity",i.PhotographicSensitivity="PhotographicSensitivity",i.OECF="OECF",i.SensitivityType="SensitivityType",i.StandardOutputSensitivity="StandardOutputSensitivity",i.RecommendedExposurelndex="RecommendedExposurelndex",i.ISOSpeed="ISOSpeed",i.ISOSpeedLatitudeyyy="ISOSpeedLatitudeyyy",i.ISOSpeedLatitudezzz="ISOSpeedLatitudezzz",i.ExifVersion="ExifVersion",i.DateTimeOriginal="DateTimeOriginal",i.DateTimeDigitized="DateTimeDigitized",i.ComponentsConfiguration="ComponentsConfiguration",i.ShutterSpeedValue="ShutterSpeedValue",i.ApertureValue="ApertureValue",i.BrightnessValue="Brightness Value",i.ExposureBiasValue="ExposureBiasValue",i.MaxApertureValue="MaxAperture Value",i.SubjectDistance="SubjectDistance",i.MeteringMode="MeteringMode",i.LightSource="LightSource",i.Flash="Flash",i.FocalLength="FocalLength",i.MakerNote="MakerNote",i.UserComment="UserComment",i.SubSecTime="SubSecTime",i.SubSecTimeOriginal="SubSecTimeOriginal",i.SubSecTimeDigitized="SubSecTimeDigitized",i.FlashpixVersion="FlashpixVersion",i.ColorSpace="ColorSpace",i.RelatedSoundFile="RelatedSoundFile",i.FlashEnergy="FlashEnergy",i.SpatialFrequencyResponse="SpatialFrequencyResponse",i["FocalPlaneX-Resolution"]="FocalPlaneX-Resolution",i["FocalPlaneY-Resolution"]="FocalPlaneY-Resolution",i["FocalPlane-ResolutionUnit"]="FocalPlane-ResolutionUnit",i.Exposurelndex="Exposurelndex",i.SensingMethod="SensingMethod",i.FileSource="FileSource",i.SceneType="SceneType",i.CFApattern="CFApattern",i.ExposureMode="ExposureMode",i.WhiteBalance="WhiteBalance",i.DigitalZoomRatio="DigitalZoomRatio",i.FocalLengthIn35mmFilm="FocalLengthIn35mmFilm",i["SceneCapture Type"]="SceneCapture Type",i.GainControl="GainControl",i.Contrast="Contrast",i.Saturation="Saturation",i.Sharpness="Sharpness",i.DeviceSettingDescription="DeviceSettingDescription",i.SubjectDistanceRange="SubjectDistanceRange",i.ImageUniquelD="ImageUniquelD",i.CameraOwnerName="CameraOwnerName",i.BodySerialNumber="BodySerialNumber",i.LensSpecification="LensSpecification",i.LensMake="LensMake",i.LensModel="LensModel",i.LensSerialNumber="LensSerialNumber",i.Gamma="Gamma",i.CompressedBitsPerPixel="CompressedBitsPerPixel",i.PixelXDimension="PixelXDimension",i.PixelYDimension="PixelYDimension",i.SubjectArea="SubjectArea",i.FocalPlaneXResolution="FocalPlaneXResolution",i.FocalPlaneYResolution="FocalPlaneYResolution",i.FocalPlaneResolutionUnit="FocalPlaneResolutionUnit",i.SubjectLocation="SubjectLocation",i.ExposureIndex="ExposureIndex",i.CFAPattern="CFAPattern",i.CustomRendered="CustomRendered",i.DigitalZoomRation="DigitalZoomRation",i.SceneCaptureType="SceneCaptureType",i.ImageUniqueID="ImageUniqueID",e.INTEROPERABILITY_IFD=void 0,(e.INTEROPERABILITY_IFD||(e.INTEROPERABILITY_IFD={})).InteroperabilityIndex="InteroperabilityIndex",e.GPS_INFO_IFD=void 0,(n=e.GPS_INFO_IFD||(e.GPS_INFO_IFD={})).GPSVersionID="GPSVersionID",n.GPSLatitudeRef="GPSLatitudeRef",n.GPSLatitude="GPSLatitude",n.GPSImgDirection="GPSImgDirection",n.GPSLongitudeRef="GPSLongitudeRef",n.GPSLongitude="GPSLongitude",n.GPSAltitudeRef="GPSAltitudeRef",n.GPSAltitude="GPSAltitude",n.GPSTimeStamp="GPSTimeStamp",n.GPSSatellites="GPSSatellites",n.GPSStatus="GPSStatus",n.GPSMeasureMode="GPSMeasureMode",n.GPSDOP="GPSOP",n.GPSSpeedRef="GPSSpeedRef",n.GPSSpeed="GPSSpeed",n.GPSTrackRef="GPSTrackRef",n.GPSTrack="GPSTrack",n.GPSImgDirectionRef="GPSImgDirectionRef",n.GPSImgDirectionGPSMapDatum="GP SImgDirection GPSMapDatum",n.GPSDestLatitudeRef="GPSDestLatitudeRef",n.GPSDestLatitude="GPSDestLatitude",n.GPSDestLongitudeRef="GPSDestLongitudeRef",n.GPSDestLongitude="GPSDestLongitude",n.GPSDestBearingRef="GPSDestBearingRef",n.GPSDestBearing="GPSDestBearing",n.GPSDestDistanceRef="GPSDestDistanceRef",n.GPSDestDistance="GPSDestDistance",n.GPSProcessingMethod="GPSProcessingMethod",n.GPSArealnformation="GPSArealnformation",n.GPSDateStamp="GPSDateStamp",n.GPSDifferential="GPSDifferential",n.GPSHPositioningError="GPSHPositioningError",n.GPSMapDatum="GPSMapDatum",n.GPSAreaInformation="GPSAreaInformation",e.FIRST_IFD=void 0,(o=e.FIRST_IFD||(e.FIRST_IFD={})).Compression="Compression",o.ImageDescription="ImageDescription",o.Make="Make",o.Model="Model",o.TransferFunction="TransferFunction",o.Artist="Artist",o.WhitePoint="WhitePoint",o.PrimaryChromaticities="PrimaryChromaticities",o.YCbCrCoefficients="YCbCrCoefficients",o.ReferenceBlackWhite="ReferenceBlackWhite",o.Copyright="Copyright",o.ExifIFDPointer="Exif IFD Pointer",o.GPSInfoIFDPointer="GPS Info IFD Pointer";const r={ZEROTH_IFD:e.ZEROTH_IFD,EXIF_IFD:e.EXIF_IFD,GPS_INFO_IFD:e.GPS_INFO_IFD,INTEROPERABILITY_IFD:e.INTEROPERABILITY_IFD,FIRST_IFD:e.FIRST_IFD},a={36864:r.EXIF_IFD.ExifVersion,40960:r.EXIF_IFD.FlashpixVersion,40961:r.EXIF_IFD.ColorSpace,40962:r.EXIF_IFD.PixelXDimension,40963:r.EXIF_IFD.PixelYDimension,37121:r.EXIF_IFD.ComponentsConfiguration,37122:r.EXIF_IFD.CompressedBitsPerPixel,37500:r.EXIF_IFD.MakerNote,37510:r.EXIF_IFD.UserComment,40964:r.EXIF_IFD.RelatedSoundFile,36867:r.EXIF_IFD.DateTimeOriginal,36868:r.EXIF_IFD.DateTimeDigitized,37520:r.EXIF_IFD.SubSecTime,37521:r.EXIF_IFD.SubSecTimeOriginal,37522:r.EXIF_IFD.SubSecTimeDigitized,33434:r.EXIF_IFD.ExposureTime,33437:r.EXIF_IFD.FNumber,34850:r.EXIF_IFD.ExposureProgram,34852:r.EXIF_IFD.SpectralSensitivity,34855:r.EXIF_IFD.PhotographicSensitivity,34856:r.EXIF_IFD.OECF,37377:r.EXIF_IFD.ShutterSpeedValue,37378:r.EXIF_IFD.ApertureValue,37379:r.EXIF_IFD.BrightnessValue,37380:r.EXIF_IFD.ExposureBiasValue,37381:r.EXIF_IFD.MaxApertureValue,37382:r.EXIF_IFD.SubjectDistance,37383:r.EXIF_IFD.MeteringMode,37384:r.EXIF_IFD.LightSource,37385:r.EXIF_IFD.Flash,37396:r.EXIF_IFD.SubjectArea,37386:r.EXIF_IFD.FocalLength,41483:r.EXIF_IFD.FlashEnergy,41484:r.EXIF_IFD.SpatialFrequencyResponse,41486:r.EXIF_IFD.FocalPlaneXResolution,41487:r.EXIF_IFD.FocalPlaneYResolution,41488:r.EXIF_IFD.FocalPlaneResolutionUnit,41492:r.EXIF_IFD.SubjectLocation,41493:r.EXIF_IFD.ExposureIndex,41495:r.EXIF_IFD.SensingMethod,41728:r.EXIF_IFD.FileSource,41729:r.EXIF_IFD.SceneType,41730:r.EXIF_IFD.CFAPattern,41985:r.EXIF_IFD.CustomRendered,41986:r.EXIF_IFD.ExposureMode,41987:r.EXIF_IFD.WhiteBalance,41988:r.EXIF_IFD.DigitalZoomRation,41989:r.EXIF_IFD.FocalLengthIn35mmFilm,41990:r.EXIF_IFD.SceneCaptureType,41991:r.EXIF_IFD.GainControl,41992:r.EXIF_IFD.Contrast,41993:r.EXIF_IFD.Saturation,41994:r.EXIF_IFD.Sharpness,41995:r.EXIF_IFD.DeviceSettingDescription,41996:r.EXIF_IFD.SubjectDistanceRange,40965:r.ZEROTH_IFD.InteroperabilityIFDPointer,42016:r.EXIF_IFD.ImageUniqueID,42034:r.EXIF_IFD.LensSpecification,42035:r.EXIF_IFD.LensMake,42036:r.EXIF_IFD.LensModel,42037:r.EXIF_IFD.LensSerialNumber},s={256:r.ZEROTH_IFD.ImageWidth,257:r.ZEROTH_IFD.ImageLength,34665:r.ZEROTH_IFD.ExifIFDPointer,34853:r.ZEROTH_IFD.GPSInfoIFDPointer,40965:r.ZEROTH_IFD.InteroperabilityIFDPointer,258:r.ZEROTH_IFD.BitsPerSample,259:r.ZEROTH_IFD.Compression,262:r.ZEROTH_IFD.PhotometricInterpretation,274:r.ZEROTH_IFD.Orientation,277:r.ZEROTH_IFD.SamplesPerPixel,284:r.ZEROTH_IFD.PlanarConfiguration,530:r.ZEROTH_IFD.YCbCrSubSampling,531:r.ZEROTH_IFD.YCbCrPositioning,282:r.ZEROTH_IFD.XResolution,283:r.ZEROTH_IFD.YResolution,296:r.ZEROTH_IFD.ResolutionUnit,273:r.ZEROTH_IFD.StripOffsets,278:r.ZEROTH_IFD.RowsPerStrip,279:r.ZEROTH_IFD.StripByteCounts,513:r.ZEROTH_IFD.JPEGInterchangeFormat,514:r.ZEROTH_IFD.JPEGInterchangeFormatLength,301:r.ZEROTH_IFD.TransferFunction,318:r.ZEROTH_IFD.WhitePoint,319:r.ZEROTH_IFD.PrimaryChromaticities,529:r.ZEROTH_IFD.YcbCrCoefficients,532:r.ZEROTH_IFD.ReferenceBlackWhite,306:r.ZEROTH_IFD.DateTime,270:r.ZEROTH_IFD.ImageDescription,271:r.ZEROTH_IFD.Make,272:r.ZEROTH_IFD.Model,305:r.ZEROTH_IFD.Software,315:r.ZEROTH_IFD.Artist,33432:r.ZEROTH_IFD.Copyright},F={0:r.GPS_INFO_IFD.GPSVersionID,1:r.GPS_INFO_IFD.GPSLatitudeRef,2:r.GPS_INFO_IFD.GPSLatitude,3:r.GPS_INFO_IFD.GPSLongitudeRef,4:r.GPS_INFO_IFD.GPSLongitude,5:r.GPS_INFO_IFD.GPSAltitudeRef,6:r.GPS_INFO_IFD.GPSAltitude,7:r.GPS_INFO_IFD.GPSTimeStamp,8:r.GPS_INFO_IFD.GPSSatellites,9:r.GPS_INFO_IFD.GPSStatus,10:r.GPS_INFO_IFD.GPSMeasureMode,11:r.GPS_INFO_IFD.GPSDOP,12:r.GPS_INFO_IFD.GPSSpeedRef,13:r.GPS_INFO_IFD.GPSSpeed,14:r.GPS_INFO_IFD.GPSTrackRef,15:r.GPS_INFO_IFD.GPSTrack,16:r.GPS_INFO_IFD.GPSImgDirectionRef,17:r.GPS_INFO_IFD.GPSImgDirection,18:r.GPS_INFO_IFD.GPSMapDatum,19:r.GPS_INFO_IFD.GPSDestLatitudeRef,20:r.GPS_INFO_IFD.GPSDestLatitude,21:r.GPS_INFO_IFD.GPSDestLongitudeRef,22:r.GPS_INFO_IFD.GPSDestLongitude,23:r.GPS_INFO_IFD.GPSDestBearingRef,24:r.GPS_INFO_IFD.GPSDestBearing,25:r.GPS_INFO_IFD.GPSDestDistanceRef,26:r.GPS_INFO_IFD.GPSDestDistance,27:r.GPS_INFO_IFD.GPSProcessingMethod,28:r.GPS_INFO_IFD.GPSAreaInformation,29:r.GPS_INFO_IFD.GPSDateStamp,30:r.GPS_INFO_IFD.GPSDifferential},I={ExposureProgram:{0:"Not defined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},SensingMethod:{1:"Not defined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{0:"Normal process",1:"Custom process"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},GainControl:{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{0:"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},Components:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"}};e.EXIF_TAGS=r,e.ExifTags=a,e.GPSTags=F,e.StringValues=I,e.TiffTags=s,e.getExt=function(e){return e.split(".").at(-1)},e.load=class{buf;opts;constructor(e,t){this.buf=e,this.opts=Object.create(null),this.opts.debug=t?.debug??!1}readTags(e,t,i,n,o){let r,a,s,F=e.getUint16(i,!o),I={};for(s=0;s<F;s++)r=i+12*s+2,a=n[e.getUint16(r,!o)],!a&&this.opts.debug&&console.log("Unknown tag: "+e.getUint16(r,!o)),I[a]=this.readTagValue(e,r,t,i,o);return I}readTagValue(e,t,i,n,o){let r,a,s,F,I,l=e.getUint16(t+2,!o),S=e.getUint32(t+4,!o),u=e.getUint32(t+8,!o)+i;switch(l){case 1:case 7:if(1==S)return e.getUint8(t+8);r=S>4?u:t+8,a=[];for(let t=0;t<S;t++)a[t]=e.getUint8(r+t);return a;case 2:return r=S>4?u:t+8,this.getStringFromDB(e,r,S-1);case 3:if(1==S)return e.getUint16(t+8,!o);r=S>2?u:t+8,a=[];for(let t=0;t<S;t++)a[t]=e.getUint16(r+2*t,!o);return a;case 4:if(1==S)return e.getUint32(t+8,!o);a=[];for(let t=0;t<S;t++)a[t]=e.getUint32(u+4*t,!o);return a;case 5:if(1==S)return F=e.getUint32(u,!o),I=e.getUint32(u+4,!o),s=new Number(F/I),s.numerator=F,s.denominator=I,s;a=[];for(let t=0;t<S;t++)F=e.getUint32(u+8*t,!o),I=e.getUint32(u+4+8*t,!o),a[t]=new Number(F/I),a[t].numerator=F,a[t].denominator=I;return a;case 9:if(1==S)return e.getInt32(t+8,!o);a=[];for(let t=0;t<S;t++)a[t]=e.getInt32(u+4*t,!o);return a;case 10:if(1==S)return e.getInt32(u,!o)/e.getInt32(u+4,!o);a=[];for(let t=0;t<S;t++)a[t]=e.getInt32(u+8*t,!o)/e.getInt32(u+4+8*t,!o);return a}}getStringFromDB(e,t,i){let n="";for(let o=t;o<t+i;o++)n+=String.fromCharCode(e.getUint8(o));return n}readEXIFData(e,t){let i,n,o,l,S;if(18761==e.getUint16(t))i=!1;else{if(19789!=e.getUint16(t))return this.opts.debug&&console.log("Not valid TIFF data! (no 0x4949 or 0x4D4D)"),!1;i=!0}if(42!=e.getUint16(t+2,!i))return this.opts.debug&&console.log("Not valid TIFF data! (no 0x002A)"),!1;const u=e.getUint32(t+4,!i);if(u<8)return this.opts.debug&&console.log("Not valid TIFF data! (First offset less than 8)"),!1;if(n=this.readTags(e,t,t+u,s,i),n["Exif IFD Pointer"])for(o in l=this.readTags(e,t,t+n["Exif IFD Pointer"],a,i),l){switch(o){case r.EXIF_IFD.LightSource:case r.EXIF_IFD.Flash:case r.EXIF_IFD.MeteringMode:case r.EXIF_IFD.ExposureProgram:case r.EXIF_IFD.SensingMethod:case r.EXIF_IFD.SceneCaptureType:case r.EXIF_IFD.SceneType:case r.EXIF_IFD.CustomRendered:case r.EXIF_IFD.WhiteBalance:case r.EXIF_IFD.GainControl:case r.EXIF_IFD.Contrast:case r.EXIF_IFD.Saturation:case r.EXIF_IFD.Sharpness:case r.EXIF_IFD.SubjectDistanceRange:case r.EXIF_IFD.FileSource:l[o]=I[o][l[o]];break;case r.EXIF_IFD.ExifVersion:case r.EXIF_IFD.FlashpixVersion:l[o]=String.fromCharCode(l[o][0],l[o][1],l[o][2],l[o][3]);break;case r.EXIF_IFD.ComponentsConfiguration:l[o]=I.Components[l[o][0]]+I.Components[l[o][1]]+I.Components[l[o][2]]+I.Components[l[o][3]]}n[o]=l[o]}if(n["GPS Info IFD Pointer"])for(o in S=this.readTags(e,t,t+n["GPS Info IFD Pointer"],F,i),S){if(o===r.GPS_INFO_IFD.GPSVersionID)S[o]=S[o][0]+"."+S[o][1]+"."+S[o][2]+"."+S[o][3];n[o]=S[o]}return n}heic(){const e=new DataView(this.buf),t=e.getUint32(0),i=e.getUint32(t);let n=-1,o=-1;for(let r=t;r<i+t;r++)"Exif"==this.getStringFromDB(e,r,4)?n=r:"iloc"==this.getStringFromDB(e,r,4)&&(o=r);if(-1==n||-1==o)return null;const r=e.getUint16(n-4);for(let a=o+12;a<i+t;a+=16){if(e.getUint16(a)==r){const t=e.getUint32(a+8);e.getUint32(a+12);return n=t+(4+e.getUint32(t)),this.readEXIFData(e,n)}}return null}jpeg(){const e=this.buf,t=new DataView(e);if(255!=t.getUint8(0)||216!=t.getUint8(1))return this.opts.debug&&console.log("Not a valid JPEG"),!1;let i,n=2,o=e.byteLength;for(;n<o;){if(255!=t.getUint8(n))return this.opts.debug&&console.log("Not a valid marker at offset "+n+", found: "+t.getUint8(n)),!1;if(i=t.getUint8(n+1),this.opts.debug&&console.log(i),225==i)return this.opts.debug&&console.log("Found 0xFFE1 marker"),this.readEXIFData(t,n+4+6);n+=2+t.getUint16(n+2)}}jpg(){return this.jpeg()}raw(){const e=this.buf;console.log(e)}},Object.defineProperty(e,"__esModule",{value:!0})}));

@@ -533,3 +533,5 @@ /**

readTags(file, tiffStart, dirStart, strings, bigEnd) {
let entries = file.getUint16(dirStart, !bigEnd), tags = {}, entryOffset, tag, i;
let entries = file.getUint16(dirStart, !bigEnd),
// @ts-ignore
tags = {}, entryOffset, tag, i;
for (i = 0; i < entries; i++) {

@@ -539,3 +541,3 @@ entryOffset = dirStart + i * 12 + 2;

if (!tag && this.opts.debug)
console.log("Unknown tag: " + file.getUint16(entryOffset, !bigEnd));
console.log('Unknown tag: ' + file.getUint16(entryOffset, !bigEnd));
tags[tag] = this.readTagValue(file, entryOffset, tiffStart, dirStart, bigEnd);

@@ -554,3 +556,3 @@ }

else {
offset = numValues > 4 ? valueOffset : (entryOffset + 8);
offset = numValues > 4 ? valueOffset : entryOffset + 8;
vals = [];

@@ -563,3 +565,3 @@ for (let n = 0; n < numValues; n++) {

case 2: // ascii, 8-bit byte
offset = numValues > 4 ? valueOffset : (entryOffset + 8);
offset = numValues > 4 ? valueOffset : entryOffset + 8;
return this.getStringFromDB(file, offset, numValues - 1);

@@ -571,3 +573,3 @@ case 3: // short, 16 bit int

else {
offset = numValues > 2 ? valueOffset : (entryOffset + 8);
offset = numValues > 2 ? valueOffset : entryOffset + 8;
vals = [];

@@ -627,3 +629,4 @@ for (let n = 0; n < numValues; n++) {

if (numValues == 1) {
return file.getInt32(valueOffset, !bigEnd) / file.getInt32(valueOffset + 4, !bigEnd);
return (file.getInt32(valueOffset, !bigEnd) /
file.getInt32(valueOffset + 4, !bigEnd));
}

@@ -633,3 +636,5 @@ else {

for (let n = 0; n < numValues; n++) {
vals[n] = file.getInt32(valueOffset + 8 * n, !bigEnd) / file.getInt32(valueOffset + 4 + 8 * n, !bigEnd);
vals[n] =
file.getInt32(valueOffset + 8 * n, !bigEnd) /
file.getInt32(valueOffset + 4 + 8 * n, !bigEnd);
}

@@ -641,3 +646,3 @@ return vals;

getStringFromDB(buffer, start, length) {
let outstr = "";
let outstr = '';
for (let n = start; n < start + length; n++) {

@@ -654,3 +659,3 @@ outstr += String.fromCharCode(buffer.getUint8(n));

}
else if (file.getUint16(start) == 0x4D4D) {
else if (file.getUint16(start) == 0x4d4d) {
bigEnd = true;

@@ -660,8 +665,8 @@ }

if (this.opts.debug)
console.log("Not valid TIFF data! (no 0x4949 or 0x4D4D)");
console.log('Not valid TIFF data! (no 0x4949 or 0x4D4D)');
return false;
}
if (file.getUint16(start + 2, !bigEnd) != 0x002A) {
if (file.getUint16(start + 2, !bigEnd) != 0x002a) {
if (this.opts.debug)
console.log("Not valid TIFF data! (no 0x002A)");
console.log('Not valid TIFF data! (no 0x002A)');
return false;

@@ -672,34 +677,42 @@ }

if (this.opts.debug)
console.log("Not valid TIFF data! (First offset less than 8)");
console.log('Not valid TIFF data! (First offset less than 8)');
return false;
}
tags = this.readTags(file, start, start + firstIFDOffset, TiffTags, bigEnd);
if (tags.ExifIFDPointer) {
exifData = this.readTags(file, start, start + tags.ExifIFDPointer, ExifTags, bigEnd);
if (tags['Exif IFD Pointer']) {
exifData = this.readTags(file, start, start + tags['Exif IFD Pointer'], ExifTags, bigEnd);
for (tag in exifData) {
switch (tag) {
case "LightSource":
case "Flash":
case "MeteringMode":
case "ExposureProgram":
case "SensingMethod":
case "SceneCaptureType":
case "SceneType":
case "CustomRendered":
case "WhiteBalance":
case "GainControl":
case "Contrast":
case "Saturation":
case "Sharpness":
case "SubjectDistanceRange":
case "FileSource":
case EXIF_TAGS.EXIF_IFD.LightSource:
case EXIF_TAGS.EXIF_IFD.Flash:
case EXIF_TAGS.EXIF_IFD.MeteringMode:
case EXIF_TAGS.EXIF_IFD.ExposureProgram:
case EXIF_TAGS.EXIF_IFD.SensingMethod:
case EXIF_TAGS.EXIF_IFD.SceneCaptureType:
case EXIF_TAGS.EXIF_IFD.SceneType:
case EXIF_TAGS.EXIF_IFD.CustomRendered:
case EXIF_TAGS.EXIF_IFD.WhiteBalance:
case EXIF_TAGS.EXIF_IFD.GainControl:
case EXIF_TAGS.EXIF_IFD.Contrast:
case EXIF_TAGS.EXIF_IFD.Saturation:
case EXIF_TAGS.EXIF_IFD.Sharpness:
case EXIF_TAGS.EXIF_IFD.SubjectDistanceRange:
case EXIF_TAGS.EXIF_IFD.FileSource:
// @ts-ignore
exifData[tag] = StringValues[tag][exifData[tag]];
break;
case "ExifVersion":
case "FlashpixVersion":
case EXIF_TAGS.EXIF_IFD.ExifVersion:
case EXIF_TAGS.EXIF_IFD.FlashpixVersion:
// @ts-ignore
exifData[tag] = String.fromCharCode(exifData[tag][0], exifData[tag][1], exifData[tag][2], exifData[tag][3]);
exifData[tag] = String.fromCharCode(
// @ts-ignore
exifData[tag][0],
// @ts-ignore
exifData[tag][1],
// @ts-ignore
exifData[tag][2],
// @ts-ignore
exifData[tag][3]);
break;
case "ComponentsConfiguration":
case EXIF_TAGS.EXIF_IFD.ComponentsConfiguration:
exifData[tag] =

@@ -716,20 +729,27 @@ // @ts-ignore

}
// @ts-ignore
tags[tag] = exifData[tag];
}
}
if (tags.GPSInfoIFDPointer) {
gpsData = this.readTags(file, start, start + tags.GPSInfoIFDPointer, GPSTags, bigEnd);
if (tags['GPS Info IFD Pointer']) {
gpsData = this.readTags(file, start, start + tags['GPS Info IFD Pointer'], GPSTags, bigEnd);
for (tag in gpsData) {
switch (tag) {
case "GPSVersionID":
case EXIF_TAGS.GPS_INFO_IFD.GPSVersionID:
// @ts-ignore
gpsData[tag] = gpsData[tag][0] +
gpsData[tag] =
// @ts-ignore
"." + gpsData[tag][1] +
// @ts-ignore
"." + gpsData[tag][2] +
// @ts-ignore
"." + gpsData[tag][3];
gpsData[tag][0] +
'.' +
// @ts-ignore
gpsData[tag][1] +
'.' +
// @ts-ignore
gpsData[tag][2] +
'.' +
// @ts-ignore
gpsData[tag][3];
break;
}
// @ts-ignore
tags[tag] = gpsData[tag];

@@ -749,6 +769,6 @@ }

for (let i = ftypeSize; i < metadataSize + ftypeSize; i++) {
if (this.getStringFromDB(dataView, i, 4) == "Exif") {
if (this.getStringFromDB(dataView, i, 4) == 'Exif') {
exifOffset = i;
}
else if (this.getStringFromDB(dataView, i, 4) == "iloc") {
else if (this.getStringFromDB(dataView, i, 4) == 'iloc') {
ilocOffset = i;

@@ -781,5 +801,5 @@ }

const dataView = new DataView(data);
if ((dataView.getUint8(0) != 0xFF) || (dataView.getUint8(1) != 0xD8)) {
if (dataView.getUint8(0) != 0xff || dataView.getUint8(1) != 0xd8) {
if (this.opts.debug)
console.log("Not a valid JPEG");
console.log('Not a valid JPEG');
return false; // not a valid jpeg

@@ -789,5 +809,8 @@ }

while (offset < length) {
if (dataView.getUint8(offset) != 0xFF) {
if (dataView.getUint8(offset) != 0xff) {
if (this.opts.debug)
console.log("Not a valid marker at offset " + offset + ", found: " + dataView.getUint8(offset));
console.log('Not a valid marker at offset ' +
offset +
', found: ' +
dataView.getUint8(offset));
return false; // not a valid marker, something is wrong

@@ -802,3 +825,3 @@ }

if (this.opts.debug)
console.log("Found 0xFFE1 marker");
console.log('Found 0xFFE1 marker');
return this.readEXIFData(dataView, offset + 4 + 6);

@@ -805,0 +828,0 @@ }

@@ -529,3 +529,5 @@ /**

readTags(file, tiffStart, dirStart, strings, bigEnd) {
let entries = file.getUint16(dirStart, !bigEnd), tags = {}, entryOffset, tag, i;
let entries = file.getUint16(dirStart, !bigEnd),
// @ts-ignore
tags = {}, entryOffset, tag, i;
for (i = 0; i < entries; i++) {

@@ -535,3 +537,3 @@ entryOffset = dirStart + i * 12 + 2;

if (!tag && this.opts.debug)
console.log("Unknown tag: " + file.getUint16(entryOffset, !bigEnd));
console.log('Unknown tag: ' + file.getUint16(entryOffset, !bigEnd));
tags[tag] = this.readTagValue(file, entryOffset, tiffStart, dirStart, bigEnd);

@@ -550,3 +552,3 @@ }

else {
offset = numValues > 4 ? valueOffset : (entryOffset + 8);
offset = numValues > 4 ? valueOffset : entryOffset + 8;
vals = [];

@@ -559,3 +561,3 @@ for (let n = 0; n < numValues; n++) {

case 2: // ascii, 8-bit byte
offset = numValues > 4 ? valueOffset : (entryOffset + 8);
offset = numValues > 4 ? valueOffset : entryOffset + 8;
return this.getStringFromDB(file, offset, numValues - 1);

@@ -567,3 +569,3 @@ case 3: // short, 16 bit int

else {
offset = numValues > 2 ? valueOffset : (entryOffset + 8);
offset = numValues > 2 ? valueOffset : entryOffset + 8;
vals = [];

@@ -623,3 +625,4 @@ for (let n = 0; n < numValues; n++) {

if (numValues == 1) {
return file.getInt32(valueOffset, !bigEnd) / file.getInt32(valueOffset + 4, !bigEnd);
return (file.getInt32(valueOffset, !bigEnd) /
file.getInt32(valueOffset + 4, !bigEnd));
}

@@ -629,3 +632,5 @@ else {

for (let n = 0; n < numValues; n++) {
vals[n] = file.getInt32(valueOffset + 8 * n, !bigEnd) / file.getInt32(valueOffset + 4 + 8 * n, !bigEnd);
vals[n] =
file.getInt32(valueOffset + 8 * n, !bigEnd) /
file.getInt32(valueOffset + 4 + 8 * n, !bigEnd);
}

@@ -637,3 +642,3 @@ return vals;

getStringFromDB(buffer, start, length) {
let outstr = "";
let outstr = '';
for (let n = start; n < start + length; n++) {

@@ -650,3 +655,3 @@ outstr += String.fromCharCode(buffer.getUint8(n));

}
else if (file.getUint16(start) == 0x4D4D) {
else if (file.getUint16(start) == 0x4d4d) {
bigEnd = true;

@@ -656,8 +661,8 @@ }

if (this.opts.debug)
console.log("Not valid TIFF data! (no 0x4949 or 0x4D4D)");
console.log('Not valid TIFF data! (no 0x4949 or 0x4D4D)');
return false;
}
if (file.getUint16(start + 2, !bigEnd) != 0x002A) {
if (file.getUint16(start + 2, !bigEnd) != 0x002a) {
if (this.opts.debug)
console.log("Not valid TIFF data! (no 0x002A)");
console.log('Not valid TIFF data! (no 0x002A)');
return false;

@@ -668,34 +673,42 @@ }

if (this.opts.debug)
console.log("Not valid TIFF data! (First offset less than 8)");
console.log('Not valid TIFF data! (First offset less than 8)');
return false;
}
tags = this.readTags(file, start, start + firstIFDOffset, TiffTags, bigEnd);
if (tags.ExifIFDPointer) {
exifData = this.readTags(file, start, start + tags.ExifIFDPointer, ExifTags, bigEnd);
if (tags['Exif IFD Pointer']) {
exifData = this.readTags(file, start, start + tags['Exif IFD Pointer'], ExifTags, bigEnd);
for (tag in exifData) {
switch (tag) {
case "LightSource":
case "Flash":
case "MeteringMode":
case "ExposureProgram":
case "SensingMethod":
case "SceneCaptureType":
case "SceneType":
case "CustomRendered":
case "WhiteBalance":
case "GainControl":
case "Contrast":
case "Saturation":
case "Sharpness":
case "SubjectDistanceRange":
case "FileSource":
case EXIF_TAGS.EXIF_IFD.LightSource:
case EXIF_TAGS.EXIF_IFD.Flash:
case EXIF_TAGS.EXIF_IFD.MeteringMode:
case EXIF_TAGS.EXIF_IFD.ExposureProgram:
case EXIF_TAGS.EXIF_IFD.SensingMethod:
case EXIF_TAGS.EXIF_IFD.SceneCaptureType:
case EXIF_TAGS.EXIF_IFD.SceneType:
case EXIF_TAGS.EXIF_IFD.CustomRendered:
case EXIF_TAGS.EXIF_IFD.WhiteBalance:
case EXIF_TAGS.EXIF_IFD.GainControl:
case EXIF_TAGS.EXIF_IFD.Contrast:
case EXIF_TAGS.EXIF_IFD.Saturation:
case EXIF_TAGS.EXIF_IFD.Sharpness:
case EXIF_TAGS.EXIF_IFD.SubjectDistanceRange:
case EXIF_TAGS.EXIF_IFD.FileSource:
// @ts-ignore
exifData[tag] = StringValues[tag][exifData[tag]];
break;
case "ExifVersion":
case "FlashpixVersion":
case EXIF_TAGS.EXIF_IFD.ExifVersion:
case EXIF_TAGS.EXIF_IFD.FlashpixVersion:
// @ts-ignore
exifData[tag] = String.fromCharCode(exifData[tag][0], exifData[tag][1], exifData[tag][2], exifData[tag][3]);
exifData[tag] = String.fromCharCode(
// @ts-ignore
exifData[tag][0],
// @ts-ignore
exifData[tag][1],
// @ts-ignore
exifData[tag][2],
// @ts-ignore
exifData[tag][3]);
break;
case "ComponentsConfiguration":
case EXIF_TAGS.EXIF_IFD.ComponentsConfiguration:
exifData[tag] =

@@ -712,20 +725,27 @@ // @ts-ignore

}
// @ts-ignore
tags[tag] = exifData[tag];
}
}
if (tags.GPSInfoIFDPointer) {
gpsData = this.readTags(file, start, start + tags.GPSInfoIFDPointer, GPSTags, bigEnd);
if (tags['GPS Info IFD Pointer']) {
gpsData = this.readTags(file, start, start + tags['GPS Info IFD Pointer'], GPSTags, bigEnd);
for (tag in gpsData) {
switch (tag) {
case "GPSVersionID":
case EXIF_TAGS.GPS_INFO_IFD.GPSVersionID:
// @ts-ignore
gpsData[tag] = gpsData[tag][0] +
gpsData[tag] =
// @ts-ignore
"." + gpsData[tag][1] +
// @ts-ignore
"." + gpsData[tag][2] +
// @ts-ignore
"." + gpsData[tag][3];
gpsData[tag][0] +
'.' +
// @ts-ignore
gpsData[tag][1] +
'.' +
// @ts-ignore
gpsData[tag][2] +
'.' +
// @ts-ignore
gpsData[tag][3];
break;
}
// @ts-ignore
tags[tag] = gpsData[tag];

@@ -745,6 +765,6 @@ }

for (let i = ftypeSize; i < metadataSize + ftypeSize; i++) {
if (this.getStringFromDB(dataView, i, 4) == "Exif") {
if (this.getStringFromDB(dataView, i, 4) == 'Exif') {
exifOffset = i;
}
else if (this.getStringFromDB(dataView, i, 4) == "iloc") {
else if (this.getStringFromDB(dataView, i, 4) == 'iloc') {
ilocOffset = i;

@@ -777,5 +797,5 @@ }

const dataView = new DataView(data);
if ((dataView.getUint8(0) != 0xFF) || (dataView.getUint8(1) != 0xD8)) {
if (dataView.getUint8(0) != 0xff || dataView.getUint8(1) != 0xd8) {
if (this.opts.debug)
console.log("Not a valid JPEG");
console.log('Not a valid JPEG');
return false; // not a valid jpeg

@@ -785,5 +805,8 @@ }

while (offset < length) {
if (dataView.getUint8(offset) != 0xFF) {
if (dataView.getUint8(offset) != 0xff) {
if (this.opts.debug)
console.log("Not a valid marker at offset " + offset + ", found: " + dataView.getUint8(offset));
console.log('Not a valid marker at offset ' +
offset +
', found: ' +
dataView.getUint8(offset));
return false; // not a valid marker, something is wrong

@@ -798,3 +821,3 @@ }

if (this.opts.debug)
console.log("Found 0xFFE1 marker");
console.log('Found 0xFFE1 marker');
return this.readEXIFData(dataView, offset + 4 + 6);

@@ -801,0 +824,0 @@ }

{
"name": "exifly",
"version": "0.1.1",
"version": "0.1.2",
"description": "An ES modules Typescript implementation to get EXIF of an image",

@@ -5,0 +5,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc