Comments (6)
@klaussa finding the answer not straightforward, but this was my solution (using Node.js v12 and the new spread syntax):
exif[piexifjs.ImageIFD.XPTitle]: [...Buffer.from('Your XPTitle', 'ucs2')]
For more information, see:
https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings
https://nodejs.org/api/buffer.html#buffer_buffers_and_typedarrays
Other background info:
https://www.npmjs.com/package/punycode
https://mathiasbynens.be/notes/javascript-encoding
from piexifjs.
Which value do you want to add?
Example:
var s = "foo";
var bytes = [];
for (var i=0; i<s.length; i++) {
bytes.push(s.charCodeAt(i));
}
bytes -> [102, 111, 111]
from piexifjs.
@hMatoba
I want to add a piece of text to those fields.
// XPTitle: // XPComment: // XPAuthor: // XPKeywords: // XPSubject
The example you provided doesn't output foo but outputs a chinese character :(
I use this to check: http://metapicz.com/#landing ( + also I do windows -> properties -> details tab to check ).
Any advice ?
The Code looks like:
from piexifjs.
It need to encode and decode as UCS2. Read the specification.
http://www.exiv2.org/tags.html
from piexifjs.
its saying uncaught pack error, when i used [...Buffer.from('Your XPTitle', 'ucs2')] using vue 3 js
from piexifjs.
In my case this issue happened due to big number in exifObj['GPS'][piexif.GPSIFD.GPSTimeStamp]
.
But it definitely depends. It can be related to any EXIF field. Not only GPS related.
from piexifjs.
Related Issues (20)
- Ios exif is null but work on android with same jpg file HOT 1
- Latest npm publish missing files HOT 2
- TypeError: Cannot use 'in' operator to search for '0th' in data:image... HOT 2
- Problem importing 2.0 beta HOT 5
- Problem when running inside cordova HOT 3
- Set latest tag to v1.x on npm HOT 1
- Problem when reading or writing in Chinese HOT 1
- Update piexif version string in v1.0.5
- problem setting 0x9286 EXIF UserComment HOT 1
- Lost / modified fields setting GPS to {}
- Not writing offset of next IFD HOT 1
- Line 55 miss the colon. ; in file LoadSample.html
- 'constants' and 'Tags' missing in npm package
- Is v2.0 still to be released? HOT 3
- 我清除Exif信息 图片怎么还是旋转的 怎么可以不旋转图片
- JPEG QUALITY BY DEFAULT AT 1.0
- Dead HOT 6
- Document how to set GPSHPositioningError
- Supported file formats HOT 3
- Pack Error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from piexifjs.