| @@ 28-388 (lines=361) @@ | ||
| 25 | // Browser globals: |
|
| 26 | factory(window.loadImage) |
|
| 27 | } |
|
| 28 | })(function (loadImage) { |
|
| 29 | 'use strict' |
|
| 30 | ||
| 31 | loadImage.ExifMap.prototype.tags = { |
|
| 32 | // ================= |
|
| 33 | // TIFF tags (IFD0): |
|
| 34 | // ================= |
|
| 35 | 0x0100: 'ImageWidth', |
|
| 36 | 0x0101: 'ImageHeight', |
|
| 37 | 0x8769: 'ExifIFDPointer', |
|
| 38 | 0x8825: 'GPSInfoIFDPointer', |
|
| 39 | 0xa005: 'InteroperabilityIFDPointer', |
|
| 40 | 0x0102: 'BitsPerSample', |
|
| 41 | 0x0103: 'Compression', |
|
| 42 | 0x0106: 'PhotometricInterpretation', |
|
| 43 | 0x0112: 'Orientation', |
|
| 44 | 0x0115: 'SamplesPerPixel', |
|
| 45 | 0x011c: 'PlanarConfiguration', |
|
| 46 | 0x0212: 'YCbCrSubSampling', |
|
| 47 | 0x0213: 'YCbCrPositioning', |
|
| 48 | 0x011a: 'XResolution', |
|
| 49 | 0x011b: 'YResolution', |
|
| 50 | 0x0128: 'ResolutionUnit', |
|
| 51 | 0x0111: 'StripOffsets', |
|
| 52 | 0x0116: 'RowsPerStrip', |
|
| 53 | 0x0117: 'StripByteCounts', |
|
| 54 | 0x0201: 'JPEGInterchangeFormat', |
|
| 55 | 0x0202: 'JPEGInterchangeFormatLength', |
|
| 56 | 0x012d: 'TransferFunction', |
|
| 57 | 0x013e: 'WhitePoint', |
|
| 58 | 0x013f: 'PrimaryChromaticities', |
|
| 59 | 0x0211: 'YCbCrCoefficients', |
|
| 60 | 0x0214: 'ReferenceBlackWhite', |
|
| 61 | 0x0132: 'DateTime', |
|
| 62 | 0x010e: 'ImageDescription', |
|
| 63 | 0x010f: 'Make', |
|
| 64 | 0x0110: 'Model', |
|
| 65 | 0x0131: 'Software', |
|
| 66 | 0x013b: 'Artist', |
|
| 67 | 0x8298: 'Copyright', |
|
| 68 | // ================== |
|
| 69 | // Exif Sub IFD tags: |
|
| 70 | // ================== |
|
| 71 | 0x9000: 'ExifVersion', // EXIF version |
|
| 72 | 0xa000: 'FlashpixVersion', // Flashpix format version |
|
| 73 | 0xa001: 'ColorSpace', // Color space information tag |
|
| 74 | 0xa002: 'PixelXDimension', // Valid width of meaningful image |
|
| 75 | 0xa003: 'PixelYDimension', // Valid height of meaningful image |
|
| 76 | 0xa500: 'Gamma', |
|
| 77 | 0x9101: 'ComponentsConfiguration', // Information about channels |
|
| 78 | 0x9102: 'CompressedBitsPerPixel', // Compressed bits per pixel |
|
| 79 | 0x927c: 'MakerNote', // Any desired information written by the manufacturer |
|
| 80 | 0x9286: 'UserComment', // Comments by user |
|
| 81 | 0xa004: 'RelatedSoundFile', // Name of related sound file |
|
| 82 | 0x9003: 'DateTimeOriginal', // Date and time when the original image was generated |
|
| 83 | 0x9004: 'DateTimeDigitized', // Date and time when the image was stored digitally |
|
| 84 | 0x9290: 'SubSecTime', // Fractions of seconds for DateTime |
|
| 85 | 0x9291: 'SubSecTimeOriginal', // Fractions of seconds for DateTimeOriginal |
|
| 86 | 0x9292: 'SubSecTimeDigitized', // Fractions of seconds for DateTimeDigitized |
|
| 87 | 0x829a: 'ExposureTime', // Exposure time (in seconds) |
|
| 88 | 0x829d: 'FNumber', |
|
| 89 | 0x8822: 'ExposureProgram', // Exposure program |
|
| 90 | 0x8824: 'SpectralSensitivity', // Spectral sensitivity |
|
| 91 | 0x8827: 'PhotographicSensitivity', // EXIF 2.3, ISOSpeedRatings in EXIF 2.2 |
|
| 92 | 0x8828: 'OECF', // Optoelectric conversion factor |
|
| 93 | 0x8830: 'SensitivityType', |
|
| 94 | 0x8831: 'StandardOutputSensitivity', |
|
| 95 | 0x8832: 'RecommendedExposureIndex', |
|
| 96 | 0x8833: 'ISOSpeed', |
|
| 97 | 0x8834: 'ISOSpeedLatitudeyyy', |
|
| 98 | 0x8835: 'ISOSpeedLatitudezzz', |
|
| 99 | 0x9201: 'ShutterSpeedValue', // Shutter speed |
|
| 100 | 0x9202: 'ApertureValue', // Lens aperture |
|
| 101 | 0x9203: 'BrightnessValue', // Value of brightness |
|
| 102 | 0x9204: 'ExposureBias', // Exposure bias |
|
| 103 | 0x9205: 'MaxApertureValue', // Smallest F number of lens |
|
| 104 | 0x9206: 'SubjectDistance', // Distance to subject in meters |
|
| 105 | 0x9207: 'MeteringMode', // Metering mode |
|
| 106 | 0x9208: 'LightSource', // Kind of light source |
|
| 107 | 0x9209: 'Flash', // Flash status |
|
| 108 | 0x9214: 'SubjectArea', // Location and area of main subject |
|
| 109 | 0x920a: 'FocalLength', // Focal length of the lens in mm |
|
| 110 | 0xa20b: 'FlashEnergy', // Strobe energy in BCPS |
|
| 111 | 0xa20c: 'SpatialFrequencyResponse', |
|
| 112 | 0xa20e: 'FocalPlaneXResolution', // Number of pixels in width direction per FPRUnit |
|
| 113 | 0xa20f: 'FocalPlaneYResolution', // Number of pixels in height direction per FPRUnit |
|
| 114 | 0xa210: 'FocalPlaneResolutionUnit', // Unit for measuring the focal plane resolution |
|
| 115 | 0xa214: 'SubjectLocation', // Location of subject in image |
|
| 116 | 0xa215: 'ExposureIndex', // Exposure index selected on camera |
|
| 117 | 0xa217: 'SensingMethod', // Image sensor type |
|
| 118 | 0xa300: 'FileSource', // Image source (3 == DSC) |
|
| 119 | 0xa301: 'SceneType', // Scene type (1 == directly photographed) |
|
| 120 | 0xa302: 'CFAPattern', // Color filter array geometric pattern |
|
| 121 | 0xa401: 'CustomRendered', // Special processing |
|
| 122 | 0xa402: 'ExposureMode', // Exposure mode |
|
| 123 | 0xa403: 'WhiteBalance', // 1 = auto white balance, 2 = manual |
|
| 124 | 0xa404: 'DigitalZoomRatio', // Digital zoom ratio |
|
| 125 | 0xa405: 'FocalLengthIn35mmFilm', |
|
| 126 | 0xa406: 'SceneCaptureType', // Type of scene |
|
| 127 | 0xa407: 'GainControl', // Degree of overall image gain adjustment |
|
| 128 | 0xa408: 'Contrast', // Direction of contrast processing applied by camera |
|
| 129 | 0xa409: 'Saturation', // Direction of saturation processing applied by camera |
|
| 130 | 0xa40a: 'Sharpness', // Direction of sharpness processing applied by camera |
|
| 131 | 0xa40b: 'DeviceSettingDescription', |
|
| 132 | 0xa40c: 'SubjectDistanceRange', // Distance to subject |
|
| 133 | 0xa420: 'ImageUniqueID', // Identifier assigned uniquely to each image |
|
| 134 | 0xa430: 'CameraOwnerName', |
|
| 135 | 0xa431: 'BodySerialNumber', |
|
| 136 | 0xa432: 'LensSpecification', |
|
| 137 | 0xa433: 'LensMake', |
|
| 138 | 0xa434: 'LensModel', |
|
| 139 | 0xa435: 'LensSerialNumber', |
|
| 140 | // ============== |
|
| 141 | // GPS Info tags: |
|
| 142 | // ============== |
|
| 143 | 0x0000: 'GPSVersionID', |
|
| 144 | 0x0001: 'GPSLatitudeRef', |
|
| 145 | 0x0002: 'GPSLatitude', |
|
| 146 | 0x0003: 'GPSLongitudeRef', |
|
| 147 | 0x0004: 'GPSLongitude', |
|
| 148 | 0x0005: 'GPSAltitudeRef', |
|
| 149 | 0x0006: 'GPSAltitude', |
|
| 150 | 0x0007: 'GPSTimeStamp', |
|
| 151 | 0x0008: 'GPSSatellites', |
|
| 152 | 0x0009: 'GPSStatus', |
|
| 153 | 0x000a: 'GPSMeasureMode', |
|
| 154 | 0x000b: 'GPSDOP', |
|
| 155 | 0x000c: 'GPSSpeedRef', |
|
| 156 | 0x000d: 'GPSSpeed', |
|
| 157 | 0x000e: 'GPSTrackRef', |
|
| 158 | 0x000f: 'GPSTrack', |
|
| 159 | 0x0010: 'GPSImgDirectionRef', |
|
| 160 | 0x0011: 'GPSImgDirection', |
|
| 161 | 0x0012: 'GPSMapDatum', |
|
| 162 | 0x0013: 'GPSDestLatitudeRef', |
|
| 163 | 0x0014: 'GPSDestLatitude', |
|
| 164 | 0x0015: 'GPSDestLongitudeRef', |
|
| 165 | 0x0016: 'GPSDestLongitude', |
|
| 166 | 0x0017: 'GPSDestBearingRef', |
|
| 167 | 0x0018: 'GPSDestBearing', |
|
| 168 | 0x0019: 'GPSDestDistanceRef', |
|
| 169 | 0x001a: 'GPSDestDistance', |
|
| 170 | 0x001b: 'GPSProcessingMethod', |
|
| 171 | 0x001c: 'GPSAreaInformation', |
|
| 172 | 0x001d: 'GPSDateStamp', |
|
| 173 | 0x001e: 'GPSDifferential', |
|
| 174 | 0x001f: 'GPSHPositioningError' |
|
| 175 | } |
|
| 176 | ||
| 177 | loadImage.ExifMap.prototype.stringValues = { |
|
| 178 | ExposureProgram: { |
|
| 179 | 0: 'Undefined', |
|
| 180 | 1: 'Manual', |
|
| 181 | 2: 'Normal program', |
|
| 182 | 3: 'Aperture priority', |
|
| 183 | 4: 'Shutter priority', |
|
| 184 | 5: 'Creative program', |
|
| 185 | 6: 'Action program', |
|
| 186 | 7: 'Portrait mode', |
|
| 187 | 8: 'Landscape mode' |
|
| 188 | }, |
|
| 189 | MeteringMode: { |
|
| 190 | 0: 'Unknown', |
|
| 191 | 1: 'Average', |
|
| 192 | 2: 'CenterWeightedAverage', |
|
| 193 | 3: 'Spot', |
|
| 194 | 4: 'MultiSpot', |
|
| 195 | 5: 'Pattern', |
|
| 196 | 6: 'Partial', |
|
| 197 | 255: 'Other' |
|
| 198 | }, |
|
| 199 | LightSource: { |
|
| 200 | 0: 'Unknown', |
|
| 201 | 1: 'Daylight', |
|
| 202 | 2: 'Fluorescent', |
|
| 203 | 3: 'Tungsten (incandescent light)', |
|
| 204 | 4: 'Flash', |
|
| 205 | 9: 'Fine weather', |
|
| 206 | 10: 'Cloudy weather', |
|
| 207 | 11: 'Shade', |
|
| 208 | 12: 'Daylight fluorescent (D 5700 - 7100K)', |
|
| 209 | 13: 'Day white fluorescent (N 4600 - 5400K)', |
|
| 210 | 14: 'Cool white fluorescent (W 3900 - 4500K)', |
|
| 211 | 15: 'White fluorescent (WW 3200 - 3700K)', |
|
| 212 | 17: 'Standard light A', |
|
| 213 | 18: 'Standard light B', |
|
| 214 | 19: 'Standard light C', |
|
| 215 | 20: 'D55', |
|
| 216 | 21: 'D65', |
|
| 217 | 22: 'D75', |
|
| 218 | 23: 'D50', |
|
| 219 | 24: 'ISO studio tungsten', |
|
| 220 | 255: 'Other' |
|
| 221 | }, |
|
| 222 | Flash: { |
|
| 223 | 0x0000: 'Flash did not fire', |
|
| 224 | 0x0001: 'Flash fired', |
|
| 225 | 0x0005: 'Strobe return light not detected', |
|
| 226 | 0x0007: 'Strobe return light detected', |
|
| 227 | 0x0009: 'Flash fired, compulsory flash mode', |
|
| 228 | 0x000d: 'Flash fired, compulsory flash mode, return light not detected', |
|
| 229 | 0x000f: 'Flash fired, compulsory flash mode, return light detected', |
|
| 230 | 0x0010: 'Flash did not fire, compulsory flash mode', |
|
| 231 | 0x0018: 'Flash did not fire, auto mode', |
|
| 232 | 0x0019: 'Flash fired, auto mode', |
|
| 233 | 0x001d: 'Flash fired, auto mode, return light not detected', |
|
| 234 | 0x001f: 'Flash fired, auto mode, return light detected', |
|
| 235 | 0x0020: 'No flash function', |
|
| 236 | 0x0041: 'Flash fired, red-eye reduction mode', |
|
| 237 | 0x0045: 'Flash fired, red-eye reduction mode, return light not detected', |
|
| 238 | 0x0047: 'Flash fired, red-eye reduction mode, return light detected', |
|
| 239 | 0x0049: 'Flash fired, compulsory flash mode, red-eye reduction mode', |
|
| 240 | 0x004d: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected', |
|
| 241 | 0x004f: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light detected', |
|
| 242 | 0x0059: 'Flash fired, auto mode, red-eye reduction mode', |
|
| 243 | 0x005d: 'Flash fired, auto mode, return light not detected, red-eye reduction mode', |
|
| 244 | 0x005f: 'Flash fired, auto mode, return light detected, red-eye reduction mode' |
|
| 245 | }, |
|
| 246 | SensingMethod: { |
|
| 247 | 1: 'Undefined', |
|
| 248 | 2: 'One-chip color area sensor', |
|
| 249 | 3: 'Two-chip color area sensor', |
|
| 250 | 4: 'Three-chip color area sensor', |
|
| 251 | 5: 'Color sequential area sensor', |
|
| 252 | 7: 'Trilinear sensor', |
|
| 253 | 8: 'Color sequential linear sensor' |
|
| 254 | }, |
|
| 255 | SceneCaptureType: { |
|
| 256 | 0: 'Standard', |
|
| 257 | 1: 'Landscape', |
|
| 258 | 2: 'Portrait', |
|
| 259 | 3: 'Night scene' |
|
| 260 | }, |
|
| 261 | SceneType: { |
|
| 262 | 1: 'Directly photographed' |
|
| 263 | }, |
|
| 264 | CustomRendered: { |
|
| 265 | 0: 'Normal process', |
|
| 266 | 1: 'Custom process' |
|
| 267 | }, |
|
| 268 | WhiteBalance: { |
|
| 269 | 0: 'Auto white balance', |
|
| 270 | 1: 'Manual white balance' |
|
| 271 | }, |
|
| 272 | GainControl: { |
|
| 273 | 0: 'None', |
|
| 274 | 1: 'Low gain up', |
|
| 275 | 2: 'High gain up', |
|
| 276 | 3: 'Low gain down', |
|
| 277 | 4: 'High gain down' |
|
| 278 | }, |
|
| 279 | Contrast: { |
|
| 280 | 0: 'Normal', |
|
| 281 | 1: 'Soft', |
|
| 282 | 2: 'Hard' |
|
| 283 | }, |
|
| 284 | Saturation: { |
|
| 285 | 0: 'Normal', |
|
| 286 | 1: 'Low saturation', |
|
| 287 | 2: 'High saturation' |
|
| 288 | }, |
|
| 289 | Sharpness: { |
|
| 290 | 0: 'Normal', |
|
| 291 | 1: 'Soft', |
|
| 292 | 2: 'Hard' |
|
| 293 | }, |
|
| 294 | SubjectDistanceRange: { |
|
| 295 | 0: 'Unknown', |
|
| 296 | 1: 'Macro', |
|
| 297 | 2: 'Close view', |
|
| 298 | 3: 'Distant view' |
|
| 299 | }, |
|
| 300 | FileSource: { |
|
| 301 | 3: 'DSC' |
|
| 302 | }, |
|
| 303 | ComponentsConfiguration: { |
|
| 304 | 0: '', |
|
| 305 | 1: 'Y', |
|
| 306 | 2: 'Cb', |
|
| 307 | 3: 'Cr', |
|
| 308 | 4: 'R', |
|
| 309 | 5: 'G', |
|
| 310 | 6: 'B' |
|
| 311 | }, |
|
| 312 | Orientation: { |
|
| 313 | 1: 'top-left', |
|
| 314 | 2: 'top-right', |
|
| 315 | 3: 'bottom-right', |
|
| 316 | 4: 'bottom-left', |
|
| 317 | 5: 'left-top', |
|
| 318 | 6: 'right-top', |
|
| 319 | 7: 'right-bottom', |
|
| 320 | 8: 'left-bottom' |
|
| 321 | } |
|
| 322 | } |
|
| 323 | ||
| 324 | loadImage.ExifMap.prototype.getText = function (id) { |
|
| 325 | var value = this.get(id) |
|
| 326 | switch (id) { |
|
| 327 | case 'LightSource': |
|
| 328 | case 'Flash': |
|
| 329 | case 'MeteringMode': |
|
| 330 | case 'ExposureProgram': |
|
| 331 | case 'SensingMethod': |
|
| 332 | case 'SceneCaptureType': |
|
| 333 | case 'SceneType': |
|
| 334 | case 'CustomRendered': |
|
| 335 | case 'WhiteBalance': |
|
| 336 | case 'GainControl': |
|
| 337 | case 'Contrast': |
|
| 338 | case 'Saturation': |
|
| 339 | case 'Sharpness': |
|
| 340 | case 'SubjectDistanceRange': |
|
| 341 | case 'FileSource': |
|
| 342 | case 'Orientation': |
|
| 343 | return this.stringValues[id][value] |
|
| 344 | case 'ExifVersion': |
|
| 345 | case 'FlashpixVersion': |
|
| 346 | if (!value) return |
|
| 347 | return String.fromCharCode(value[0], value[1], value[2], value[3]) |
|
| 348 | case 'ComponentsConfiguration': |
|
| 349 | if (!value) return |
|
| 350 | return ( |
|
| 351 | this.stringValues[id][value[0]] + |
|
| 352 | this.stringValues[id][value[1]] + |
|
| 353 | this.stringValues[id][value[2]] + |
|
| 354 | this.stringValues[id][value[3]] |
|
| 355 | ) |
|
| 356 | case 'GPSVersionID': |
|
| 357 | if (!value) return |
|
| 358 | return value[0] + '.' + value[1] + '.' + value[2] + '.' + value[3] |
|
| 359 | } |
|
| 360 | return String(value) |
|
| 361 | } |
|
| 362 | ;(function (exifMapPrototype) { |
|
| 363 | var tags = exifMapPrototype.tags |
|
| 364 | var map = exifMapPrototype.map |
|
| 365 | var prop |
|
| 366 | // Map the tag names to tags: |
|
| 367 | for (prop in tags) { |
|
| 368 | if (tags.hasOwnProperty(prop)) { |
|
| 369 | map[tags[prop]] = prop |
|
| 370 | } |
|
| 371 | } |
|
| 372 | })(loadImage.ExifMap.prototype) |
|
| 373 | ||
| 374 | loadImage.ExifMap.prototype.getAll = function () { |
|
| 375 | var map = {} |
|
| 376 | var prop |
|
| 377 | var id |
|
| 378 | for (prop in this) { |
|
| 379 | if (this.hasOwnProperty(prop)) { |
|
| 380 | id = this.tags[prop] |
|
| 381 | if (id) { |
|
| 382 | map[id] = this.getText(id) |
|
| 383 | } |
|
| 384 | } |
|
| 385 | } |
|
| 386 | return map |
|
| 387 | } |
|
| 388 | }) |
|
| 389 | ||
| @@ 1-1 (lines=1) @@ | ||
| 1 | !function(e){"use strict";function t(e,i,a){var o,n=document.createElement("img");return n.onerror=function(o){return t.onerror(n,o,e,i,a)},n.onload=function(o){return t.onload(n,o,e,i,a)},"string"==typeof e?(t.fetchBlob(e,function(i){i?(e=i,o=t.createObjectURL(e)):(o=e,a&&a.crossOrigin&&(n.crossOrigin=a.crossOrigin)),n.src=o},a),n):t.isInstanceOf("Blob",e)||t.isInstanceOf("File",e)?(o=n._objectURL=t.createObjectURL(e))?(n.src=o,n):t.readFile(e,function(e){var t=e.target;t&&t.result?n.src=t.result:i&&i(e)}):void 0}function i(e,i){!e._objectURL||i&&i.noRevoke||(t.revokeObjectURL(e._objectURL),delete e._objectURL)}var a=e.createObjectURL&&e||e.URL&&URL.revokeObjectURL&&URL||e.webkitURL&&webkitURL;t.fetchBlob=function(e,t,i){t()},t.isInstanceOf=function(e,t){return Object.prototype.toString.call(t)==="[object "+e+"]"},t.transform=function(e,t,i,a,o){i(e,o)},t.onerror=function(e,t,a,o,n){i(e,n),o&&o.call(e,t)},t.onload=function(e,a,o,n,r){i(e,r),n&&t.transform(e,r,n,o,{})},t.createObjectURL=function(e){return!!a&&a.createObjectURL(e)},t.revokeObjectURL=function(e){return!!a&&a.revokeObjectURL(e)},t.readFile=function(t,i,a){if(e.FileReader){var o=new FileReader;if(o.onload=o.onerror=i,a=a||"readAsDataURL",o[a])return o[a](t),o}return!1},"function"==typeof define&&define.amd?define(function(){return t}):"object"==typeof module&&module.exports?module.exports=t:e.loadImage=t}("undefined"!=typeof window&&window||this),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image"],e):e("object"==typeof module&&module.exports?require("./load-image"):window.loadImage)}(function(e){"use strict";var t=e.transform;e.transform=function(i,a,o,n,r){t.call(e,e.scale(i,a,r),a,o,n,r)},e.transformCoordinates=function(){},e.getTransformedOptions=function(e,t){var i,a,o,n,r=t.aspectRatio;if(!r)return t;i={};for(a in t)t.hasOwnProperty(a)&&(i[a]=t[a]);return i.crop=!0,o=e.naturalWidth||e.width,n=e.naturalHeight||e.height,o/n>r?(i.maxWidth=n*r,i.maxHeight=n):(i.maxWidth=o,i.maxHeight=o/r),i},e.renderImageToCanvas=function(e,t,i,a,o,n,r,s,l,d){return e.getContext("2d").drawImage(t,i,a,o,n,r,s,l,d),e},e.hasCanvasOption=function(e){return e.canvas||e.crop||!!e.aspectRatio},e.scale=function(t,i,a){function o(){var e=Math.max((l||v)/v,(d||P)/P);e>1&&(v*=e,P*=e)}function n(){var e=Math.min((r||v)/v,(s||P)/P);e<1&&(v*=e,P*=e)}i=i||{};var r,s,l,d,c,u,f,g,h,m,p,S=document.createElement("canvas"),b=t.getContext||e.hasCanvasOption(i)&&S.getContext,y=t.naturalWidth||t.width,x=t.naturalHeight||t.height,v=y,P=x;if(b&&(f=(i=e.getTransformedOptions(t,i,a)).left||0,g=i.top||0,i.sourceWidth?(c=i.sourceWidth,void 0!==i.right&&void 0===i.left&&(f=y-c-i.right)):c=y-f-(i.right||0),i.sourceHeight?(u=i.sourceHeight,void 0!==i.bottom&&void 0===i.top&&(g=x-u-i.bottom)):u=x-g-(i.bottom||0),v=c,P=u),r=i.maxWidth,s=i.maxHeight,l=i.minWidth,d=i.minHeight,b&&r&&s&&i.crop?(v=r,P=s,(p=c/u-r/s)<0?(u=s*c/r,void 0===i.top&&void 0===i.bottom&&(g=(x-u)/2)):p>0&&(c=r*u/s,void 0===i.left&&void 0===i.right&&(f=(y-c)/2))):((i.contain||i.cover)&&(l=r=r||l,d=s=s||d),i.cover?(n(),o()):(o(),n())),b){if((h=i.pixelRatio)>1&&(S.style.width=v+"px",S.style.height=P+"px",v*=h,P*=h,S.getContext("2d").scale(h,h)),(m=i.downsamplingRatio)>0&&m<1&&v<c&&P<u)for(;c*m>v;)S.width=c*m,S.height=u*m,e.renderImageToCanvas(S,t,f,g,c,u,0,0,S.width,S.height),f=0,g=0,c=S.width,u=S.height,(t=document.createElement("canvas")).width=c,t.height=u,e.renderImageToCanvas(t,S,0,0,c,u,0,0,c,u);return S.width=v,S.height=P,e.transformCoordinates(S,i),e.renderImageToCanvas(S,t,f,g,c,u,0,0,v,P)}return t.width=v,t.height=P,t}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image"],e):e("object"==typeof module&&module.exports?require("./load-image"):window.loadImage)}(function(e){"use strict";var t="undefined"!=typeof Blob&&(Blob.prototype.slice||Blob.prototype.webkitSlice||Blob.prototype.mozSlice);e.blobSlice=t&&function(){return(this.slice||this.webkitSlice||this.mozSlice).apply(this,arguments)},e.metaDataParsers={jpeg:{65505:[]}},e.parseMetaData=function(t,i,a,o){a=a||{},o=o||{};var n=this,r=a.maxMetaDataSize||262144;!!("undefined"!=typeof DataView&&t&&t.size>=12&&"image/jpeg"===t.type&&e.blobSlice)&&e.readFile(e.blobSlice.call(t,0,r),function(t){if(t.target.error)return console.log(t.target.error),void i(o);var r,s,l,d,c=t.target.result,u=new DataView(c),f=2,g=u.byteLength-4,h=f;if(65496===u.getUint16(0)){for(;f<g&&((r=u.getUint16(f))>=65504&&r<=65519||65534===r);){if(s=u.getUint16(f+2)+2,f+s>u.byteLength){console.log("Invalid meta data: Invalid segment size.");break}if(l=e.metaDataParsers.jpeg[r])for(d=0;d<l.length;d+=1)l[d].call(n,u,f,s,o,a);h=f+=s}!a.disableImageHead&&h>6&&(c.slice?o.imageHead=c.slice(0,h):o.imageHead=new Uint8Array(c).subarray(0,h))}else console.log("Invalid JPEG file: Missing JPEG marker.");i(o)},"readAsArrayBuffer")||i(o)},e.hasMetaOption=function(e){return e&&e.meta};var i=e.transform;e.transform=function(t,a,o,n,r){e.hasMetaOption(a)?e.parseMetaData(n,function(r){i.call(e,t,a,o,n,r)},a,r):i.apply(e,arguments)}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image","./load-image-meta"],e):"object"==typeof module&&module.exports?e(require("./load-image"),require("./load-image-meta")):e(window.loadImage)}(function(e){"use strict";"undefined"!=typeof fetch&&"undefined"!=typeof Request&&(e.fetchBlob=function(t,i,a){if(e.hasMetaOption(a))return fetch(new Request(t,a)).then(function(e){return e.blob()}).then(i).catch(function(e){console.log(e),i()});i()})}),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image","./load-image-meta"],e):"object"==typeof module&&module.exports?e(require("./load-image"),require("./load-image-meta")):e(window.loadImage)}(function(e){"use strict";e.ExifMap=function(){return this},e.ExifMap.prototype.map={Orientation:274},e.ExifMap.prototype.get=function(e){return this[e]||this[this.map[e]]},e.getExifThumbnail=function(t,i,a){if(a&&!(i+a>t.byteLength))return e.createObjectURL(new Blob([t.buffer.slice(i,i+a)]));console.log("Invalid Exif data: Invalid thumbnail data.")},e.exifTagTypes={1:{getValue:function(e,t){return e.getUint8(t)},size:1},2:{getValue:function(e,t){return String.fromCharCode(e.getUint8(t))},size:1,ascii:!0},3:{getValue:function(e,t,i){return e.getUint16(t,i)},size:2},4:{getValue:function(e,t,i){return e.getUint32(t,i)},size:4},5:{getValue:function(e,t,i){return e.getUint32(t,i)/e.getUint32(t+4,i)},size:8},9:{getValue:function(e,t,i){return e.getInt32(t,i)},size:4},10:{getValue:function(e,t,i){return e.getInt32(t,i)/e.getInt32(t+4,i)},size:8}},e.exifTagTypes[7]=e.exifTagTypes[1],e.getExifValue=function(t,i,a,o,n,r){var s,l,d,c,u,f,g=e.exifTagTypes[o];if(g){if(s=g.size*n,!((l=s>4?i+t.getUint32(a+8,r):a+8)+s>t.byteLength)){if(1===n)return g.getValue(t,l,r);for(d=[],c=0;c<n;c+=1)d[c]=g.getValue(t,l+c*g.size,r);if(g.ascii){for(u="",c=0;c<d.length&&"\0"!==(f=d[c]);c+=1)u+=f;return u}return d}console.log("Invalid Exif data: Invalid data offset.")}else console.log("Invalid Exif data: Invalid tag type.")},e.parseExifTag=function(t,i,a,o,n){var r=t.getUint16(a,o);n.exif[r]=e.getExifValue(t,i,a,t.getUint16(a+2,o),t.getUint32(a+4,o),o)},e.parseExifTags=function(e,t,i,a,o){var n,r,s;if(i+6>e.byteLength)console.log("Invalid Exif data: Invalid directory offset.");else{if(n=e.getUint16(i,a),!((r=i+2+12*n)+4>e.byteLength)){for(s=0;s<n;s+=1)this.parseExifTag(e,t,i+2+12*s,a,o);return e.getUint32(r,a)}console.log("Invalid Exif data: Invalid directory size.")}},e.parseExifData=function(t,i,a,o,n){if(!n.disableExif){var r,s,l,d=i+10;if(1165519206===t.getUint32(i+4))if(d+8>t.byteLength)console.log("Invalid Exif data: Invalid segment size.");else if(0===t.getUint16(i+8)){switch(t.getUint16(d)){case 18761:r=!0;break;case 19789:r=!1;break;default:return void console.log("Invalid Exif data: Invalid byte alignment marker.")}42===t.getUint16(d+2,r)?(s=t.getUint32(d+4,r),o.exif=new e.ExifMap,(s=e.parseExifTags(t,d,d+s,r,o))&&!n.disableExifThumbnail&&(l={exif:{}},s=e.parseExifTags(t,d,d+s,r,l),l.exif[513]&&(o.exif.Thumbnail=e.getExifThumbnail(t,d+l.exif[513],l.exif[514]))),o.exif[34665]&&!n.disableExifSub&&e.parseExifTags(t,d,d+o.exif[34665],r,o),o.exif[34853]&&!n.disableExifGps&&e.parseExifTags(t,d,d+o.exif[34853],r,o)):console.log("Invalid Exif data: Missing TIFF marker.")}else console.log("Invalid Exif data: Missing byte alignment offset.")}},e.metaDataParsers.jpeg[65505].push(e.parseExifData)}),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image","./load-image-exif"],e):"object"==typeof module&&module.exports?e(require("./load-image"),require("./load-image-exif")):e(window.loadImage)}(function(e){"use strict";e.ExifMap.prototype.tags={256:"ImageWidth",257:"ImageHeight",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",274:"Orientation",277:"SamplesPerPixel",284:"PlanarConfiguration",530:"YCbCrSubSampling",531:"YCbCrPositioning",282:"XResolution",283:"YResolution",296:"ResolutionUnit",273:"StripOffsets",278:"RowsPerStrip",279:"StripByteCounts",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",301:"TransferFunction",318:"WhitePoint",319:"PrimaryChromaticities",529:"YCbCrCoefficients",532:"ReferenceBlackWhite",306:"DateTime",270:"ImageDescription",271:"Make",272:"Model",305:"Software",315:"Artist",33432:"Copyright",36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",42240:"Gamma",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37500:"MakerNote",37510:"UserComment",40964:"RelatedSoundFile",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37520:"SubSecTime",37521:"SubSecTimeOriginal",37522:"SubSecTimeDigitized",33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"PhotographicSensitivity",34856:"OECF",34864:"SensitivityType",34865:"StandardOutputSensitivity",34866:"RecommendedExposureIndex",34867:"ISOSpeed",34868:"ISOSpeedLatitudeyyy",34869:"ISOSpeedLatitudezzz",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBias",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37396:"SubjectArea",37386:"FocalLength",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRatio",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",42016:"ImageUniqueID",42032:"CameraOwnerName",42033:"BodySerialNumber",42034:"LensSpecification",42035:"LensMake",42036:"LensModel",42037:"LensSerialNumber",0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential",31:"GPSHPositioningError"},e.ExifMap.prototype.stringValues={ExposureProgram:{0:"Undefined",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:"Undefined",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"},ComponentsConfiguration:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"},Orientation:{1:"top-left",2:"top-right",3:"bottom-right",4:"bottom-left",5:"left-top",6:"right-top",7:"right-bottom",8:"left-bottom"}},e.ExifMap.prototype.getText=function(e){var t=this.get(e);switch(e){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"Orientation":return this.stringValues[e][t];case"ExifVersion":case"FlashpixVersion":if(!t)return;return String.fromCharCode(t[0],t[1],t[2],t[3]);case"ComponentsConfiguration":if(!t)return;return this.stringValues[e][t[0]]+this.stringValues[e][t[1]]+this.stringValues[e][t[2]]+this.stringValues[e][t[3]];case"GPSVersionID":if(!t)return;return t[0]+"."+t[1]+"."+t[2]+"."+t[3]}return String(t)},function(e){var t,i=e.tags,a=e.map;for(t in i)i.hasOwnProperty(t)&&(a[i[t]]=t)}(e.ExifMap.prototype),e.ExifMap.prototype.getAll=function(){var e,t,i={};for(e in this)this.hasOwnProperty(e)&&(t=this.tags[e])&&(i[t]=this.getText(t));return i}}),function(e){"use strict";"function"==typeof define&&define.amd?define(["./load-image","./load-image-scale","./load-image-meta"],e):"object"==typeof module&&module.exports?e(require("./load-image"),require("./load-image-scale"),require("./load-image-meta")):e(window.loadImage)}(function(e){"use strict";var t=e.hasCanvasOption,i=e.hasMetaOption,a=e.transformCoordinates,o=e.getTransformedOptions;e.hasCanvasOption=function(i){return!!i.orientation||t.call(e,i)},e.hasMetaOption=function(t){return t&&!0===t.orientation||i.call(e,t)},e.transformCoordinates=function(t,i){a.call(e,t,i);var o=t.getContext("2d"),n=t.width,r=t.height,s=t.style.width,l=t.style.height,d=i.orientation;if(d&&!(d>8))switch(d>4&&(t.width=r,t.height=n,t.style.width=l,t.style.height=s),d){case 2:o.translate(n,0),o.scale(-1,1);break;case 3:o.translate(n,r),o.rotate(Math.PI);break;case 4:o.translate(0,r),o.scale(1,-1);break;case 5:o.rotate(.5*Math.PI),o.scale(1,-1);break;case 6:o.rotate(.5*Math.PI),o.translate(0,-r);break;case 7:o.rotate(.5*Math.PI),o.translate(n,-r),o.scale(-1,1);break;case 8:o.rotate(-.5*Math.PI),o.translate(-n,0)}},e.getTransformedOptions=function(t,i,a){var n,r,s=o.call(e,t,i),l=s.orientation;if(!0===l&&a&&a.exif&&(l=a.exif.get("Orientation")),!l||l>8||1===l)return s;n={};for(r in s)s.hasOwnProperty(r)&&(n[r]=s[r]);switch(n.orientation=l,l){case 2:n.left=s.right,n.right=s.left;break;case 3:n.left=s.right,n.top=s.bottom,n.right=s.left,n.bottom=s.top;break;case 4:n.top=s.bottom,n.bottom=s.top;break;case 5:n.left=s.top,n.top=s.left,n.right=s.bottom,n.bottom=s.right;break;case 6:n.left=s.top,n.top=s.right,n.right=s.bottom,n.bottom=s.left;break;case 7:n.left=s.bottom,n.top=s.right,n.right=s.top,n.bottom=s.left;break;case 8:n.left=s.bottom,n.top=s.left,n.right=s.top,n.bottom=s.right}return n.orientation>4&&(n.maxWidth=s.maxHeight,n.maxHeight=s.maxWidth,n.minWidth=s.minHeight,n.minHeight=s.minWidth,n.sourceWidth=s.sourceHeight,n.sourceHeight=s.sourceWidth),n}}); |
|
| 2 | //# sourceMappingURL=load-image.all.min.js.map |
|