hMatoba / piexifjs

Read and modify exif in client-side or server-side JavaScript.
MIT License
572 stars 119 forks source link

Pack Error #83

Open tnsivanagarajan opened 2 years ago

tnsivanagarajan commented 2 years ago

Hi Everyone, I'm getting pack error when I use negative coordinates in my GPS option. Please refer the code and the error.

      var gps = {};
      var lat = 41.14916109;
      var lng = -109.85291821;
      gps[piexif.GPSIFD.GPSLatitudeRef] = lat < 0 ? "S" : "N";
      gps[piexif.GPSIFD.GPSLatitude] = piexif.GPSHelper.degToDmsRational(lat);
      gps[piexif.GPSIFD.GPSLongitudeRef] = lng < 0 ? "W" : "E";
      gps[piexif.GPSIFD.GPSLongitude] = piexif.GPSHelper.degToDmsRational(lng);

      exifObj.GPS = gps;

      var exifStr = piexif.dump(exifObj);

It returns pack error for the valid coordinates. Check below

/nodeapp/node_modules/piexifjs/piexif.js:775
                    throw ("'pack' error.");
                    ^
'pack' error.
(Use `node --trace-uncaught ...` to show where the exception was thrown)
chriskhongqarma commented 1 year ago

Anyone looking into this issue? I am having the same error message on Redmi K50. The error looks like below message: 'pack' error., name: Error, stack: Error: 'pack' error. at pack (https://qarmainspect.com.ngrok.io/1.bundle.js:26319:25) at _packShort (https://qarmainspect.com.ngrok.io/1.bundle.js:26470:14) at _toShort (https://qarmainspect.com.ngrok.io/1.bundle.js:26586:29) at _valueToBytes (https://qarmainspect.com.ngrok.io/1.bundle.js:26497:23) at dictToBytes (https://qarmainspect.com.ngrok.io/1.bundle.js:26739:19) at Object.dump (https://qarmainspect.com.ngrok.io/1.bundle.js:27197:23) at https://qarmainspect.com.ngrok.io/bundle.js:12354:38 at $Q (https://qarmainspect.com.ngrok.io/lib/angular.js:18317:13) at Object.embedExifGPSData (https://qarmainspect.com.ngrok.io/bundle.js:12329:12) at https://qarmainspect.com.ngrok.io/bundle.js:11803:44 at processQueue (https://qarmainspect.com.ngrok.io/lib/angular.js:18016:53) at https://qarmainspect.com.ngrok.io/lib/angular.js:18064:36 at Scope.$digest (https://qarmainspect.com.ngrok.io/lib/angular.js:19183:37) at https://qarmainspect.com.ngrok.io/lib/angular.js:19503:48 at TaskTracker.completeTask (https://qarmainspect.com.ngrok.io/lib/angular.js:21304:17) at https://qarmainspect.com.ngrok.io/lib/angular.js:6880:29