Giter VIP home page Giter VIP logo

Comments (6)

mdrx-io avatar mdrx-io commented on June 19, 2024 2

@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.

hMatoba avatar hMatoba commented on June 19, 2024

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.

klaussa avatar klaussa commented on June 19, 2024

@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 ?

screen shot 2017-05-24 at 10 12 39

The Code looks like:

screen shot 2017-05-24 at 10 17 15

from piexifjs.

hMatoba avatar hMatoba commented on June 19, 2024

It need to encode and decode as UCS2. Read the specification.
http://www.exiv2.org/tags.html

from piexifjs.

SyedShehzadGillani avatar SyedShehzadGillani commented on June 19, 2024

its saying uncaught pack error, when i used [...Buffer.from('Your XPTitle', 'ucs2')] using vue 3 js

from piexifjs.

krydos avatar krydos commented on June 19, 2024

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)

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.