I built an exiftool implementation that runs totally in the web browser

Started by lucasgelfond, February 24, 2025, 01:01:04 AM

Previous topic - Next topic

lucasgelfond

Have seen the Exiftool GUI on here, but I'm a Mac user and also a big "run-it-in-the-browser" enthusiast. Figured this would be a fun weekend project and got it shipped!

Found someone online who got Perl to run in the browser (called zeroperl) and figured this was possible. You can try the demo here https://exiftool.lucasgelfond.online/ or view the full source here https://github.com/lucasgelfond/exiftool-web


For now, can only view metadata (vs. change files) but if there's appetite for it it wouldn't be too tricky to add modification in.

Curious what people think/if you have feedback!

416073226-9b8694ea-28a5-4da3-997d-87eb22096a60.gif

greybeard

Well done - I looked for something similar around 5 years ago when I built my web site but couldn't find any way of running Perl in the browser at the time.

I ended up writing the code from scratch in Javascript - but it only supports images from FujiFilm cameras. This approach is very lightweight and probably more efficient but isn't able to support as many file types as Exiftool.

I'm also a Mac user and prefer native applications running locally but this makes a good cross platform approach.

FixEUser

Great idea @lucasgelfond.

I would like to run it on my own webserver, locally.
Without any internet connection.
Without sharing my metadata ;)

Would it be possible to achieve the same in something like XAMPP?

wywh

Very nice option for those who can not use the Terminal.

- macOS Sequoia Safari (Intel, no add-ons or ad-blockers) is quite sluggish to update info (about 30 seconds for an image if ever) and uses 100% CPU with that page open.

With Firefox the page is OK.

- Maybe something like "exiftool -a -G1 -s image.jpg" as the command so it is possible to better read the output with seemingly duplicate tags. Copied text has Return after each tag:

DateTimeOriginal
2024:05:28 17:01:29
DateTimeOriginal (1)
2024:05:28 17:01:29

- High-ASCII characters are not properly displayed in XMP and IPTC:

Description
<rdf
li xml:lang="x-default">Description åäöÃ
��</rdf:li>
Subject
Keyword åäöÃ
��

lucasgelfond

Quote from: greybeard on February 24, 2025, 03:26:58 AMWell done - I looked for something similar around 5 years ago when I built my web site but couldn't find any way of running Perl in the browser at the time.

I ended up writing the code from scratch in Javascript - but it only supports images from FujiFilm cameras. This approach is very lightweight and probably more efficient but isn't able to support as many file types as Exiftool.

I'm also a Mac user and prefer native applications running locally but this makes a good cross platform approach.

Yeah!! I think the Perl thing was nearly impossible until about two weeks ago - I found this great blog post / repo where someone figured out the execution in WASM (https://github.com/uswriting/zeroperl and https://andrews.substack.com/p/zeroperl-sandboxed-perl-with-webassembly) and then it was just finding a WASI shim for the browser and building the GUI.

I was actually thinking of making a native app bundle based on this, it's quite easy to get from webapp to native app with something like Tauri or Electron, I started yesterday but figured better to share first and get feedback. If you'd use it, I think I can get you a bundle, probably sometime next weekend! Thanks for looking.

(Also, curious if anyone knows how to get this listed on the frontpage?)

lucasgelfond

Quote from: FixEUser on February 24, 2025, 04:25:42 AMGreat idea @lucasgelfond.

I would like to run it on my own webserver, locally.
Without any internet connection.
Without sharing my metadata ;)

Would it be possible to achieve the same in something like XAMPP?


I haven't used XAMPP but it's probably possible!

You totally can run this on your own web-server — this, right now, is just a Node.js server with Svelte on top. Basically: just install pnpm, clone https://github.com/lucasgelfond/exiftool-web, and pnpm dev from within the frontend directory should do it!

Also, no metadata is shared, that was the tricky part! This is using newish browser stuff so that all execution occurs on the client. I'm told it's also fairly trivial to get this to work offline (something to do with service workers and browser manifest — but I have gotten stuck, and need to ask around a bit), also just haven't bothered yet! An easy fix if people are interested though, and can post again here when I make the change.

lucasgelfond

Quote from: wywh on February 24, 2025, 08:34:59 AMVery nice option for those who can not use the Terminal.

- macOS Sequoia Safari (Intel, no add-ons or ad-blockers) is quite sluggish to update info (about 30 seconds for an image if ever) and uses 100% CPU with that page open.

With Firefox the page is OK.

- Maybe something like "exiftool -a -G1 -s image.jpg" as the command so it is possible to better read the output with seemingly duplicate tags. Copied text has Return after each tag:

DateTimeOriginal
2024:05:28 17:01:29
DateTimeOriginal (1)
2024:05:28 17:01:29

- High-ASCII characters are not properly displayed in XMP and IPTC:

Description
<rdf
li xml:lang="x-default">Description åäöÃ
��</rdf:li>
Subject
Keyword åäöÃ
��

Thank you for this!! I'm not sure why CPU is so high, I can look around. I'm getting about 50% utilization (on a 2023 Macbook, using Sonoma) and it's fast though, so tricky to figure out.

Changing the internal command is a good idea, will experiment around a bit, probably this weekend.

Any ideas of how to deal with XML characters? I'll look into this too!

Phil Harvey

The ExifTool -E option may be used to escape special characters for html.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

lucasgelfond

Quote from: Phil Harvey on February 24, 2025, 11:50:22 AMThe ExifTool -E option may be used to escape special characters for html.

- Phil

DIdn't know about this, just made a change to escape these! https://github.com/lucasgelfond/exiftool-web/commit/f629ab336713aabfbea69a2d758c6d1f060c55e2

Also, Phil, do you mind adding this to the front page as an online related utility? Probably link the repo (https://github.com/lucasgelfond/exiftool-web), Thanks so much again for building this!


Phil Harvey

This is indeed very impressive.  I have added it to the home page.  (It didn't really fit into any of the existing categories, so I had to add a new one.  Let me know if you have a better description.)

One note:  In your documentation you state the GUI's are Windows only and many years old.  Neither is true.  FrankB has produced an updated version of the Windows GUI that he is currently maintaining, and there are (probably not-so-up-to-date) GUI versions for Java and Python.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

Quote from: Phil Harvey on February 25, 2025, 09:49:11 AMand there are (probably not-so-up-to-date) GUI versions for Java and Python.

Both pyExifToolGUI and jExifToolGUI were created by hvdwolf, and they are no longer updating them.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Phil Harvey

OK, so it is true then that the GUI's are either Windows-only or many years old.  Just change the and to or and all is good.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

Thinking further, DigiKam is cross-platform and can be set to use exiftool to write with, so technically, it's an up-to-date GUI for exiftool :D
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

FixEUser

Quote from: lucasgelfond on February 24, 2025, 09:55:04 AMAlso, no metadata is shared, that was the tricky part! This is using newish browser stuff so that all execution occurs on the client.
I think this should be mentioned explicitly on your Github page, as this is probably crucial for some users.