Giter Site home page Giter Site logo

exif-js's Introduction

Exif.js

A JavaScript library for reading EXIF meta data from image files.

You can use it on images in the browser, either from an image or a file input element. Both EXIF and IPTC metadata are retrieved. This package can also be used in AMD or CommonJS environments.

Note: The EXIF standard applies only to .jpg and .tiff images. EXIF logic in this package is based on the EXIF standard v2.2 (JEITA CP-3451, included in this repo).

Install

Install exif-js through NPM:

npm install exif-js --save    

Or Bower:

bower install exif-js --save

Then add a script tag in your an HTML in the best position referencing your local file.

<script src="vendors/exif-js/exif-js"></script>

You can also use a minified version hosted on jsDelivr

<script src="https://cdn.jsdelivr.net/npm/exif-js"></script>

Usage

The package adds a global EXIF variable (or AMD or CommonJS equivalent).

Start with calling the EXIF.getData function. You pass it an image as a parameter:

  • either an image from a <img src="image.jpg">
  • OR a user selected image in a <input type="file"> element on your page.

As a second parameter you specify a callback function. In the callback function you should use this to access the image with the aforementioned metadata you can then use as you want. That image now has an extra exifdata property which is a Javascript object with the EXIF metadata. You can access it's properties to get data like the image caption, the date a photo was taken or it's orientation.

You can get all tages with EXIF.getTag. Or get a single tag with EXIF.getTag, where you specify the tag as the second parameter. The tag names to use are listed in EXIF.Tags in exif.js.

Important: Note that you have to wait for the image to be completely loaded, before calling getData or any other function. It will silently fail otherwise. You can implement this wait, by running your exif-extracting logic on the window.onLoad function. Or on an image's own onLoad function. For jQuery users please note that you can NOT (reliably) use jQuery's ready event for this. Because it fires before images are loaded. You could use $(window).load() instead of $(document.ready() (please note that `exif-js has NO dependency on jQuery or any other external library).

JavaScript:

window.onload=getExif;

function getExif() {
    var img1 = document.getElementById("img1");
    EXIF.getData(img1, function() {
        var make = EXIF.getTag(this, "Make");
        var model = EXIF.getTag(this, "Model");
        var makeAndModel = document.getElementById("makeAndModel");
        makeAndModel.innerHTML = `${make} ${model}`;
    });

    var img2 = document.getElementById("img2");
    EXIF.getData(img2, function() {
        var allMetaData = EXIF.getAllTags(this);
        var allMetaDataSpan = document.getElementById("allMetaDataSpan");
        allMetaDataSpan.innerHTML = JSON.stringify(allMetaData, null, "\t");
    });
}

HTML:

<img src="image1.jpg" id="img1" />
<pre>Make and model: <span id="makeAndModel"></span></pre>
<br/>
<img src="image2.jpg" id="img2" />
<pre id="allMetaDataSpan"></pre>
<br/>

Note there are also alternate tags, such the EXIF.TiffTags. See the source code for the full definition and use. You can also get back a string with all the EXIF information in the image pretty printed by using EXIF.pretty. Check the included index.html.

XMP Since issue #53 was merged also extracting of XMP data is supported. To not slow down this is optional, and you need to call EXIF.enableXmp(); before using EXIF.getData().

Please refer to the source code for more advanced usages such as getting image data from a File/Blob object (EXIF.readFromBinaryFile).

Contributions

This is an open source project. Please contribute by forking this repo and issueing a pull request. The project has had notable contributions already, like reading ITPC data.

You can also contribute by filing bugs or new features please issue. Or improve the documentation. Please update this README when you do a pull request of proposed changes in base functionality.

exif-js's People

Contributors

atotic avatar bartvanderwal avatar bokub avatar chrisbolin avatar danielbarela avatar dmarkow avatar freidemokrat avatar hiroyky avatar joeblynch avatar joeweiss avatar jseidelin avatar keathley avatar pankus avatar pducks32 avatar pugwonk avatar tian-zhihui avatar tinymins avatar townxelliot avatar weepy avatar xerc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

exif-js's Issues

IPTC Methods

Saw the recent inclusion of IPTC methods in December. Wondering when the next official release will be to get these included?

Caching of EXIF

Given an image in the dom where we switch the src dynamically, it looks like EXIF will cache the tags and not reload it.

PNG support

While PNG does not support EXIF as-is, it seems that some tools including ImageMagick and ExifTool store EXIF with 'Raw profile type APP1' or 'Raw profile type exif' tag IDs. Can we support this?

update bower repo

latest version is way behind, and current published version was recently damaged by some kind of code deploy without version bump, and now contains the bug where getData fails to return.

Missing lens tags

Hi,
My camera makes extensive use of the lens fields (0xa432, 0xa433, 0xa434, 0xa435), as described here : http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html

In my code, I simply added the following entries to the ExifTags object:

// lens tags
0xA432 : "LensSpecification",       // 4 rational values giving focal and aperture ranges
0xA433 : "LensMake",
0xA434 : "LensModel",
0xA435 : "LensSerialNumber",

image transferred twice on fetching image exif data from external url

Hi, in the document, you said must wait till the img tag loaded then get data, but actually, when I do this, I found after img tag loaded, the getData function downloads the image again, with an xhr request. So when using a onLoad() function after img tag loaded, this getData function will download the image again to fetch the exif data, either this should not happen or the documentation should be changed now.

I found the code, clearly this implies the img can be an object with a attribute src containing the url,

if (img.src) {
            if (/^data\:/i.test(img.src)) { // Data URI
                var arrayBuffer = base64ToArrayBuffer(img.src);
                handleBinaryFile(arrayBuffer);

            } else if (/^blob\:/i.test(img.src)) { // Object URL
                var fileReader = new FileReader();
                fileReader.onload = function(e) {
                    handleBinaryFile(e.target.result);
                };
                objectURLToBlob(img.src, function (blob) {
                    fileReader.readAsArrayBuffer(blob);
                });
            } else {
                var http = new XMLHttpRequest();
                http.onload = function() {
                    if (this.status == 200 || this.status === 0) {
                        handleBinaryFile(http.response);
                    } else {
                        throw "Could not load image";
                    }
                    http = null;
                };
                http.open("GET", img.src, true);
                http.responseType = "arraybuffer";
                http.send(null);
            }

...

Reading the makernote values

Hello.

My final goal is to find out the serial number of the camera used to take a picture.
It's either in the main exif datas :
0xc62f 50735 Image Exif.Image.CameraSerialNumber Ascii
0xa431 42033 Photo Exif.Photo.BodySerialNumber Ascii

or in the makernote value.
0x001d 29 Nikon3 Exif.Nikon3.SerialNumber Ascii Serial Number

I tried to add the 2 first to the list of tags, without success.
I tried also to read the makernote value, but it's an array with thousands of values, where I can't find my serial number(I know it's inside, I find it out with other tools).

Any idea on how to get the value ?

Best regards,
Pierre

Remove exif data?

Hi @jseidelin , I wonder if you know how to strip off EXIF data from file using JS?

I'm building a client-side cropping solution. It reads file content from the FileReader API. And I base64 encode the file content to insert it as a src in an img tag. Than I'm using canvas to crop the image and it is here everything goes wrong. I can't crop with canvas, because canvas don't know what EXIF data is.

I've searched the whole Internet didn't find anything on how-to do it using Javascript

your demo not work in localhost chrome

Base64 Test

<script>
document.getElementById("base64test").onclick = function() {
var image = new Image();
image.onload = function() {
EXIF.getData(image, function() {
alert(EXIF.pretty(this));
});
};
image.src = "data:image/jpeg;base64,/9j/......"
}
</script>

GPS Date/Time support

I am trying to get timezone for the time when the image was taken.

Date/Time Original doesn't contain any timezone information
GPS Date/Time contains timezone information

However, exif-js doesn't seem to read GPS Date/Time.

Is there a reason why?

Feature request: add react-native support

This library looks great, but is obviously designed to work in browsers.

Could you add support to load an image from an uri (including a file uris crucially) for use in react-native that bypasses any code that invokes in-browser classes (like Image and HTMLImageElement)?

readEXIFData parameter count

Line 420
// three parameters
return readEXIFData(dataView, offset + 4, dataView.getUint16(offset + 2) - 2);

function declaration:

// two parameters
function readEXIFData(file, start)

Now why this? Is there something missing in the function which is "still to come"?

Using exif.js returns different results on different servers

I am using the exif.js script to get exif data from images. When I load the same image on my development server, the data returned is different than when I load it on my production server. Below is the returned data:

Production Server:

{"FILE":{"FileName":"phpGiolhf","FileDateTime":1489687579,"FileSize":5572566,"FileType":2,"MimeType":"image/jpeg","SectionsFound":"ANY_TAG, IFD0, EXIF"},"COMPUTED":{"html":"width=\"5312\" height=\"2988\"","Height":2988,"Width":5312,"IsColor":1,"ByteOrderMotorola":0,"ApertureFNumber":"f/1.9"},"IFD0":{"ImageWidth":5312,"ImageLength":2988,"Make":"samsung","Model":"SAMSUNG-SM-G920A","Orientation":6,"XResolution":"72/1","YResolution":"72/1","ResolutionUnit":2,"Software":"G920AUCS5DPK5","DateTime":"2017:03:15 21:40:20","YCbCrPositioning":1},"EXIF":{"ExposureTime":"1/17","FNumber":"19/10","ExposureProgram":2,"ISOSpeedRatings":1250,"ExifVersion":"0220","DateTimeOriginal":"2017:03:15 21:40:20","DateTimeDigitized":"2017:03:15 21:40:20","ShutterSpeedValue":"410/100","ApertureValue":"185/100","BrightnessValue":"-256/100","ExposureBiasValue":"0/10","MaxApertureValue":"185/100","MeteringMode":2,"Flash":0,"FocalLength":"430/100"}}

Development:

{"FILE":{"FileName":"phpEVKnpq","FileDateTime":1489687140,"FileSize":5572566,"FileType":2,"MimeType":"image/jpeg","SectionsFound":"ANY_TAG, IFD0, THUMBNAIL, EXIF, GPS"},"COMPUTED":{"html":"width=\"5312\" height=\"2988\"","Height":2988,"Width":5312,"IsColor":1,"ByteOrderMotorola":0,"ApertureFNumber":"f/1.9","UserComment":null,"UserCommentEncoding":"UNDEFINED","Thumbnail.FileType":2,"Thumbnail.MimeType":"image/jpeg","Thumbnail.Height":288,"Thumbnail.Width":512},"IFD0":{"ImageWidth":5312,"ImageLength":2988,"Make":"samsung","Model":"SAMSUNG-SM-G920A","Orientation":6,"XResolution":"72/1","YResolution":"72/1","ResolutionUnit":2,"Software":"G920AUCS5DPK5","DateTime":"2017:03:15 21:40:20","YCbCrPositioning":1,"Exif_IFD_Pointer":246,"GPS_IFD_Pointer":818},"THUMBNAIL":{"ImageWidth":512,"ImageLength":288,"Compression":6,"Orientation":6,"XResolution":"72/1","YResolution":"72/1","ResolutionUnit":2,"JPEGInterchangeFormat":1154,"JPEGInterchangeFormatLength":7398},"EXIF":{"ExposureTime":"1/17","FNumber":"19/10","ExposureProgram":2,"ISOSpeedRatings":1250,"ExifVersion":"0220","DateTimeOriginal":"2017:03:15 21:40:20","DateTimeDigitized":"2017:03:15 21:40:20","ShutterSpeedValue":"410/100","ApertureValue":"185/100","BrightnessValue":"-256/100","ExposureBiasValue":"0/10","MaxApertureValue":"185/100","MeteringMode":2,"Flash":0,"FocalLength":"430/100","MakerNote":"\u0007","UserComment":"\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000","FlashPixVersion":"0100","ColorSpace":1,"ExifImageWidth":5312,"ExifImageLength":2988,"ExposureMode":0,"WhiteBalance":0,"FocalLengthIn35mmFilm":28,"SceneCaptureType":0,"ImageUniqueID":"A16LSIA00VM A16LSJG01SM\n"},"GPS":{"GPSVersion":"\u0002\u0002\u0000\u0000","GPSLatitudeRef":"N","GPSLatitude":["32/1","14/1","43/1"],"GPSLongitudeRef":"W","GPSLongitude":["89/1","57/1","33/1"],"GPSAltitudeRef":"\u0001","GPSAltitude":"0/1","GPSTimeStamp":["2/1","40/1","16/1"],"GPSDateStamp":"2017:03:16"}}

What does "Orientation: 8" mean? what are the other possible values?

Hi,
thanks for your useful library!

I've some photos with "Orientation: 8". By looking at them I get that i must "rotate 90° counterclockwise", but I'd love a reference with all the other possible values. Is it available somewhere?

Plus: I'd like to avoid if(orientation == 8) in my client. Is there a constant so that I can use something among the lines of if(orientation == EXIF.ORIENTATION_90_CCW)?

[BUG] new version of exif.js doesn't work / getData() returns always false

Hello,

The new version of exif.js doesn't work, because EXIF.getData() returns always FALSE.

In EXIF.getData() the line

  if ((img instanceof Image || img instanceof HTMLImageElement) && !img.complete) return false;

was replace with this

    if ((self.Image && img instanceof self.Image)
        || (self.HTMLImageElement && img instanceof self.HTMLImageElement)
        && !img.complete)
        return false;

I think brackets are missing

you wrote:

 A or B and C

but I think it should be

 ( A or B ) and C

Thank
CachingFoX

Callback of getData function doesn't work

Since the last commit, getData function doesn't return any result.
It seems it's the first condition which isn't good.

Before
((img instanceof Image || img instanceof HTMLImageElement) && !img.complete)

Now
((self.Image && img instanceof self.Image) || (self.HTMLImageElement && img instanceof self.HTMLImageElement) && !img.complete)

A parenthesis problem with the img.complete boolean I think.

This condition may be :
(((self.Image && img instanceof self.Image) || (self.HTMLImageElement && img instanceof self.HTMLImageElement)) && !img.complete)

?

Support for keyword tag

I am using a tool called phoshare to export iphoto images. It puts metadata in the keywords exif tag, which doesn't seem to be supported by exif-js. How do I add support for this one?

No declared license

Hello,

would you be able to explicitly state a license for this software?

Cheers

use strict 模式下,代码异常

exif.js文件
问题:严格模式下,代码抛异常。
引起异常的方法:
function getStringFromDB(buffer, start, length) {
var outstr = "";
for (n = start; n < start+length; n++) {
outstr += String.fromCharCode(buffer.getUint8(n));
}
return outstr;
}
此方法中变量n未定义,直接使用,打包构建时,在严格模式下会抛出异常。导致拍照上传工能无法使用。

修改建议:将n预先定义,如下:
function getStringFromDB(buffer, start, length) {
var outstr = "",n;
for (n = start; n < start+length; n++) {
outstr += String.fromCharCode(buffer.getUint8(n));
}
return outstr;
}

current version bower.json at bower repository doesn't have version define.

bower info exif-js

bower exif-js#* not-cached git://github.com/jseidelin/exif-js.git#*
bower exif-js#* resolve git://github.com/jseidelin/exif-js.git#*
bower exif-js#* checkout master
bower exif-js#* resolved git://github.com/jseidelin/exif-js.git#fdf760cf40

{
name: 'exif-js',
homepage: 'https://github.com/jseidelin/exif-js',
authors: [
'Jacob Seidelin'
],
description: 'JavaScript library for reading EXIF image metadata',
main: 'exif.js',
keywords: [
'exif'
],
license: 'MIT',
ignore: [
'*/.',
'node_modules',
'bower_components',
'test',
'tests',
'spec',
'example'
]
}

getting incorrect Orientation values

http://s3.amazonaws.com/grassrootsmapping/warpables/236383/RIMG0352.JPG and http://s3.amazonaws.com/grassrootsmapping/warpables/236381/RIMG0342.JPG have Orientation values of 3 and 8, respectively, which exif and exifprobe on Ubuntu correctly display:

$:~/Desktop/gps$ exifprobe RIMG0352.JPG | grep Orientation
@0x000003a=58      :        <0x0112=  274> Orientation                 [3 =SHORT         1]  = 3 = '0,0 is bottom right'
$:~/Desktop/gps$ exifprobe RIMG0342.JPG | grep Orientation
@0x000003a=58      :        <0x0112=  274> Orientation                 [3 =SHORT         1]  = 8 = '0,0 is left bottom'

But exif-js returns "1" for each. Is this an error in parsing hex data, or something?

exif.getData throws an error in node runtime.

I'm trying to run the following :

var exif = require('exif-js');
var fs = require('fs');
var imageBuffer = fs.readFileSync('hatching_orig.jpg');
exif.getData(imageBuffer, function() {
  console.log(exif.pretty(imageBuffer));
});

in node v4.4.7 and getting the following error:

 if ((img instanceof Image || img instanceof HTMLImageElement) && !img.complete) return false;
                            ^
ReferenceError: Image is not defined

I'm setting IPCT values with PHP, can read with other programs, but not yours

Below, I show my PHP code. You notice that I am setting IPCT values, but cannot read them back from your javascript. If your program not looking for those identifiers? How could I fix this?

`<?php

// iptc_make_tag() function by Thies C. Arntzen
function iptc_make_tag($rec, $data, $value)
{
$length = strlen($value);
$retval = chr(0x1C) . chr($rec) . chr($data);

if($length < 0x8000)
{
    $retval .= chr($length >> 8) .  chr($length & 0xFF);
}
else
{
    $retval .= chr(0x80) . 
               chr(0x04) . 
               chr(($length >> 24) & 0xFF) . 
               chr(($length >> 16) & 0xFF) . 
               chr(($length >> 8) & 0xFF) . 
               chr($length & 0xFF);
}

return $retval . $value;

}

// Path to jpeg file
$path = './phplogo.jpg';

// Set the IPTC tags
$iptc = array(
'2#120' => 'Test image',
'2#116' => 'Copyright 2008-2009, The PHP Group'
);

// Convert the IPTC tags into binary code
$data = '';

foreach($iptc as $tag => $string)
{
$tag = substr($tag, 2);
$data .= iptc_make_tag(2, $tag, $string);
}

// Embed the IPTC data
$content = iptcembed($data, $path);

// Write the new image data out to the file.
$fp = fopen($path, "wb");
fwrite($fp, $content);
fclose($fp);
?>`

Dealing with Exif fields that don't start at 0x00000008

The library assumes that if the first offset listed is not 0x00000008, then it's not valid Exif data:

    if (file.getUint32(tiffOffset+4, !bigEnd) != 0x00000008) {
        if (debug) console.log("Not valid TIFF data! (First offset not 8)", file.getUint16(tiffOffset+4, !bigEnd));
        return false;
    }

    tags = readTags(file, tiffOffset, tiffOffset+8, TiffTags, bigEnd);

I have a file with "valid" Exif data (exiftool returns all the info properly), but Exif.js is deciding it doesn't contain valid data. This file is straight off a Fuji FinePix XP10

For the file in question, the resulting offset is 0x00000D4C (3404) instead of 0x00000008, and examining the JPEG file in a Hex editor, the Exif data does indeed start at an offset of 3404.

If I change the code as follows (basically removing the check and just using whatever the file says the first offset is), my Exif data is properly read:

    firstOffset = file.getUint32(tiffOffset+4, !bigEnd)
    tags = readTags(file, tiffOffset, firstOffset, TiffTags, bigEnd);

I'm not familiar enough with the Exif protocol to know if it would be harmful to just blindly use the offset provided by the file instead of a forced requirement for the 0x00000008 offset?

Read exif data synchronously

Is is somehow possible to read exif data synchronously?

EXIF.getData(origImage, function() {
    Orientation = EXIF.getTag(this, "Orientation");
});

switch (Orientation)
.... 

uncaught exception: Could not load image

The demo gives this error every time I click on a demo image. I am assuming the demo should show the exif on clicking the demo images. Not so likely to use this if the demo does not even function. Any ideas why?

Issue in IE 11

Getting a syntax error in line 883

findXMPinJPEG(file)

var domDocument = dom.parseFromString( xmpString, 'text/xml' );

exif.js - version 2.2.1

error

Binaryajax.js error in IE9

I'd like to use the library for an enterprise project I am working on but I am getting the following error in BinaryAjax.js in IE9 (in IE9 browser/document modes).

SCRIPT258: Could not complete the operation due to error 80020102.
binaryajax.js?130612120748, line 42 character 7

xml2json is undefined

Hi all,
After solving the bug of getData (returns always false due to a wrong boolean expression) as described in another issue, I got xml2json is undefined. Indeed xml2json is used in the xml2Object (line 910 and 918) and is not defined anywhere else.

I suspect that the developers depend on something installed on their computers but not provided in the release. Anyway, given the name of the function, I assume that it converts XML data to JSON data (yes, I know, this is a quite clever deduction 😉), so I implemented a new one:

function xml2json(xml) {
  var json = {};

  if (xml.nodeType == 1) { // element node
    if (xml.attributes.length > 0) {
      json['@attributes'] = {};
      for (var j = 0; j < xml.attributes.length; j++) {
        var attribute = xml.attributes.item(j);
        json['@attributes'][attribute.nodeName] = attribute.nodeValue;
      }
    }
  } else if (xml.nodeType == 3) { // text node
    return xml.nodeValue;
  }

  // deal with children
  if (xml.hasChildNodes()) {
    for(var i = 0; i < xml.childNodes.length; i++) {
      var child = xml.childNodes.item(i);
      var nodeName = child.nodeName;
      if (json[nodeName] == null) {
        json[nodeName] = xml2json(child);
      } else {
        if (json[nodeName].push == null) {
          var old = json[nodeName];
          json[nodeName] = [];
          json[nodeName].push(old);
        }
        json[nodeName].push(xml2json(child));
      }
    }
  }
  
  return json;
}

Of course, you are free to use it at your convenience.

It would be nice to have some documentation, README.md, docs

It could be my limited intelligence.

But I actually think there would be a lot of people who would prefer to have a little documentation, like some samples in the README.md to get them going more quickly using this library.

Now you have to get it all from the code itself, which just takes more time.

iOS / Android

I have tried to use exif-js with Cordova, however, the only tags I get from an image taken with an iPhone by calling EXIF.getAllTags(img) are:

{Orientation: 6, ExifIFDPointer: 38, ColorSpace: 1, PixelXDimension: 3264, PixelYDimension: 2448}

Is there no support for mobile?

Add support for reading local files in devices like phones (using file reader)

Hi,
I came working with your code and I would like to make a recomendation for add support to read files from devices like phones where a XMLHttpRequest to read files will fail (application restrictions). Mostly is read images files that are locally and the URL starts with file:///

Here is the code (sorry I am new at GIT )

ADD to function (getImageData) this condition

else if (/^file:/i.test(img.src)) { // Object URL
var fileReader = new FileReader();
fileReader.onload = function(e) {
handleBinaryFile(e.target.result);
};
fileURLToBlob(img.src, function (File) {
fileReader.readAsArrayBuffer(File);
});

define the function fileURLToBlob

function fileURLToBlob(url, callback){

    window.requestFileSystem(window.PERSISTENT, 99999, function(fs) {
          var fileLocation = url.replace('file:/', '');
          console.log(fileLocation);
          fs.root.getFile(fileLocation, {create: false}, function(fileEntry) {
            console.log(fileEntry);

            var FileObject;
            fileEntry.file(
                function(fileObject){
                    console.log(fileObject);
                    callback(fileObject);
                },
                function(e){
                    console.log('Error getting the file object');
                    console.log(e);
                }
            );

          }, 
          function(e){
            console.log('Error getting the file');
            utils.errorHandlerFileSystem(e);
          }
          );
        }, 
        function(e){
            console.log('Error request file system');
            utils.errorHandlerFileSystem(e);
        }
    );

}

Thanks

JPEG JFIF formated

For the JPEG JFIF formeted images, their are troubles while using EXIF.getData()

The issue is situated in readTags() during its second call (after checked tags.ExifIFDPointer).
It seams the ExifIFDPointer is broken. (may be because of Paint Shop Pro Photo 11.11 edit).

Here is the tested file :
image1fullbug

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.