Coder Social home page Coder Social logo

Comments (3)

grasdk avatar grasdk commented on June 12, 2024

Did some further testing. Saved more person-metadata to the using "Tag That Photo". This makes the display correct in PiGallery.

2023-08-27-120000-example-ttp

Once the data is rewritten by exiftool, PiGallery displays it wrongly. This goes for both exiftool Windows executable and the ubuntu version under WSL

WSL (ubuntu)

$ cp 2023-08-27-120000-example-ttp.jpg 2023-08-27-120000-example-ttp-exifcopy.jpg
$ exiftool -all= -tagsfromfile @ -all:all -IPTC:All -XMP:All -ColorSpaceTags -F -codedcharacterset=utf8 2023-08-27-120000-example-ttp-exifcopy.jpg

2023-08-27-120000-example-ttp-exifcopy

cmd.exe (windows 10)

>copy 2023-08-27-120000-example-ttp.jpg 2023-08-27-120000-example-ttp-exifwincopy.jpg
>exiftool -all= -tagsfromfile @ -all:all -IPTC:All -XMP:All -ColorSpaceTags -F -codedcharacterset=utf8 2023-08-27-120000-example-ttp-exifwincopy.jpg

2023-08-27-120000-example-ttp-exifwincopy

When sorting and comparing the exif data as displayed by exiftool, there are no differences.

This is confusing, because I think "Tag That Photo" uses exiftool under the hood

from pigallery2.

grasdk avatar grasdk commented on June 12, 2024

I had the chance to play around a bit.

Converting variable "name" in line 487 of MetaDataLoader.ts from Ascii to utf-8 at least seems to fix the problem when viewed in the log. Without this conversion the same wrong characters show up in the log, as show up in the UI
https://github.com/bpatrik/pigallery2/blob/3489f1d55ad4b7a5e83149887c665f7a5beddef0/src/backend/model/fileaccess/MetadataLoader.ts#L487C18-L487C18

				Logger.info(LOG_TAG, 'name:                                     ' + name);
				Logger.info(LOG_TAG, 'name converted from ascii to utf-8:       ' + Buffer.from(name, 'ascii').toString('utf-8'));
				Logger.info(LOG_TAG, 'name converted from ascii to utf-8 twice: ' + Buffer.from(Buffer.from(name, 'ascii').toString('utf-8'), 'ascii').toString('utf-8'));

the output is:
image

So it could be that the library that reads the metadata assumes that it is ascii-encoded, which is why the conversion works. According to https://exiftool.org/TagNames/MWG.html, the MWG group recommends ASCII, but exiftool uses UTF-8. This may be the cause of the assumed ASCII format.

Contrary to the EXIF specification, the MWG recommends that EXIF "ASCII" string values be stored as UTF-8. To honour this, the exiftool application sets the default internal EXIF string encoding to "UTF8" when the MWG module is loaded, but via the API this must be done manually by setting the CharsetEXIF option.

I'm not yet comfortable enough with the code to suggest a solution and create pull request with a correction, but wanted to share my findings.

from pigallery2.

grasdk avatar grasdk commented on June 12, 2024

Fixed with #826

from pigallery2.

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.