Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


timmmay

16372 posts

Uber Geek

Trusted
Subscriber

#255822 2-Sep-2019 08:01
Send private message

In the past I used a program called JAlbum to create static web galleries, which is fine for my use. The jalbum website is down, not sure if it's an isolated failure or if it's gone.

 

Later versions of JAlbum put comments into jpeg image metadata - doesn't seem to do it for mp4 files. When JAlbum was new image description went into a file called comments.properties. I'd like to copy these comments from the text file to the jpeg "ImageDescription" field. Does anyone have any suggestions how to do this? File format is something like.

 

filename1.jpg=Here's a family photo!

 

filename2.jpeg=Little Billy catches a fish

 

 

 

I could write a bit of Java to do it, but that'd take hours as I'd need to find a jpeg library. Any other suggestions how to do this more quickly / easily?


Create new topic
SirHumphreyAppleby
1382 posts

Uber Geek


  #2309222 2-Sep-2019 08:16
Send private message

ExifTool and a simple command line?

 

 

for /f "tokens=1,* delims==" %a in (comments.properties) do ExifTool.exe %a -ImageDescription="%b"

 

 

Replace % with %% if used in a batch file.

 

EDIT: Mixed up file name with property. Fixed now.


timmmay

16372 posts

Uber Geek

Trusted
Subscriber

  #2309240 2-Sep-2019 09:23
Send private message

Thanks @SirHumphreyAppleby that's the kind of thing I was looking for :) Which command line is that - dos / bash / other - looks like dos?


 
 
 
 


SirHumphreyAppleby
1382 posts

Uber Geek


  #2309246 2-Sep-2019 09:28
Send private message

timmmay:

 

Thanks @SirHumphreyAppleby that's the kind of thing I was looking for :) Which command line is that - dos / bash / other - looks like dos?

 

 

Windows Command Prompt.


timmmay

16372 posts

Uber Geek

Trusted
Subscriber

  #2309679 2-Sep-2019 20:54
Send private message

@SirHumphreyAppleby I just got a change to try it - almost perfect thanks! I just had to add one set of speech marks to cope with filenames with a space in them. The command line is

 

 

 

for /f "tokens=1,* delims==" %a in (comments.properties) do ExifTool.exe "%a" -ImageDescription="%b"r:

 

 

 

For bonus points - can this be made recursive and look at the comments.properties file in each folder? I see the for command can be made recursive with "for /R", but it has a whole different set of options that don't seem compatible with "for /f".


Oblivian
4238 posts

Uber Geek


  #2309692 2-Sep-2019 21:15
Send private message

If you want a bit more manual work during processing and use LR, there's a stashed method to sync IPCT in the import tab

 

https://helpx.adobe.com/nz/lightroom-classic/help/metadata-basics-actions.html#add_and_edit_iptc_metadata 

 

 

 

-r is recursive for exiftool, but you would need to mod the initial command a bit

 

https://sno.phy.queensu.ca/~phil/exiftool/mistakes.html 

 

     

  1. The -r option (to recursively process sub-directories) is only effective when a directory name is specified, so it doesn't work when "*.*" is specified (unless the first-level directories have a "." in the name, as mentioned in point b above)

 

Some tips there to do it as a line vs get a batch to do it too.


timmmay

16372 posts

Uber Geek

Trusted
Subscriber

  #2309707 2-Sep-2019 21:51
Send private message

Thanks for the ideas. I don't like / use Lightroom. I've used bridge successfully for many years, tried LR but found the UI and workflow really slow.

SirHumphreyAppleby
1382 posts

Uber Geek


  #2309756 3-Sep-2019 07:16
Send private message

timmmay:

 

For bonus points - can this be made recursive and look at the comments.properties file in each folder? I see the for command can be made recursive with "for /R", but it has a whole different set of options that don't seem compatible with "for /f".

 

 

I'd use a batch file for this. Make sure ExifTool is in your path (or change the command to the full path).

 

 

for /f %%a in ('dir /b /s /ad') do (
 pushd "%%a"
 if exist comments.properties (
  for /f "tokens=1,* delims==" %%b in (comments.properties) do ExifTool.exe "%%b" -ImageDescription="%%c"
 )
 popd
)

 


 
 
 
 


timmmay

16372 posts

Uber Geek

Trusted
Subscriber

  #2309781 3-Sep-2019 09:04
Send private message

Thanks, I'll give that a shot tonight or when I next get time :)


timmmay

16372 posts

Uber Geek

Trusted
Subscriber

  #2311834 6-Sep-2019 15:37
Send private message

I just got to test this. Thanks again @SirHumphreyAppleby it works perfectly, you're some kind of a DOS coding genius!


timmmay

16372 posts

Uber Geek

Trusted
Subscriber

  #2311838 6-Sep-2019 15:43
Send private message

Sign. I then realise that I have another album with a different metadata type. In this one the format is below. Do you think this will work with the batch file you gave me or does it need tweaking?

 

 

 

filename.jpg.description=Description

 

 


SirHumphreyAppleby
1382 posts

Uber Geek


  #2311847 6-Sep-2019 16:08
Send private message

timmmay:

 

Sign. I then realise that I have another album with a different metadata type. In this one the format is below. Do you think this will work with the batch file you gave me or does it need tweaking?

 

filename.jpg.description=Description

 

 

Let's try that again. Had to enter a capcha to post and my reply didn't show up (@freitasm).

 

The script won't quite work as is as it treats everything before the = as the file name. It is necessary to remove .description from the file name. Something like the following (untested, sorry), should do the job...

 

 

setlocal enabledelayedexpansion
for /f %%a in ('dir /b /s /ad') do (
 pushd "%%a"
 if exist comments.properties (
  for /f "tokens=1,* delims==" %%b in (comments.properties) do (
   set fname=%%b
   ExifTool.exe "!fname:.description=!" -ImageDescription="%%c"
  )
 )
 popd
)

 


timmmay

16372 posts

Uber Geek

Trusted
Subscriber

  #2311984 6-Sep-2019 21:13
Send private message

The console said "error" a lot, but a spot check suggests it's worked as well. Thanks again! I'll have a better look at the errors later and post if it's not quite worked.

 

If we meet at a Geekzone event remind me I owe you a couple of beers :)


SirHumphreyAppleby
1382 posts

Uber Geek


  #2312497 7-Sep-2019 20:16
Send private message

timmmay:

 

The console said "error" a lot, but a spot check suggests it's worked as well. Thanks again! I'll have a better look at the errors later and post if it's not quite worked.

 

If we meet at a Geekzone event remind me I owe you a couple of beers :)

 

 

I gave the script a quick test this evening and the basic parsing appears to be correct. It should work with both file formats.

 

At a guess, I would say the errors are most likely from ExifTool. If ExifTool weren't in the path, you'd see errors, but it would obviously not work. The script checks for the file before trying to use it, and only tries to pushd in to directories. Everything is just built-in commands that will work with the default Windows cmd.exe configuration.

 

Happy to look at the errors and assist were I can. Beer won't be necessary.


timmmay

16372 posts

Uber Geek

Trusted
Subscriber

  #2312533 7-Sep-2019 21:09
Send private message

Thanks for that, I appreciate it. I'll have a proper go when I have a bit of free time - a rare thing with a toddler.


Create new topic




News »

Countdown unveils contactless shopping with new Scan&Go tech
Posted 21-Sep-2020 09:48


HP unveils new innovations for businesses adapting to rapidly evolving workstyles and workforces
Posted 17-Sep-2020 15:36


GoPro launches new HERO9 Black camera
Posted 17-Sep-2020 09:45


Telecommunications industry launches new 5G Facts website
Posted 17-Sep-2020 07:56


New Zealand ranks 3rd in world in GSMA index
Posted 15-Sep-2020 10:13


Trend Micro Security Suite adds web monitoring to prevent identity theft
Posted 14-Sep-2020 15:37


NVIDIA to acquire Arm for US$ 40 billion
Posted 14-Sep-2020 12:27


Epson launches its next gen A3+ colour EcoTank multi-function printer
Posted 10-Sep-2020 16:08


Sony launches three new native 4K SXRD home cinema projectors
Posted 9-Sep-2020 18:00


Catalyst Cloud brings Kubernetes-based open-source web hosting solution to market
Posted 9-Sep-2020 17:54


Verizon Connect eyes further growth in New Zealand
Posted 8-Sep-2020 09:26


PNY launches XLR8 gaming NVIDIA GeForce RTX 30 series powered by the all-new NVIDIA Ampere architecture
Posted 3-Sep-2020 16:39


NVIDIA delivers greatest-ever generational leap with GeForce RTX 30 Series GPUs
Posted 3-Sep-2020 16:17


Weta Digital advances visual effects and animation in the cloud with AWS
Posted 2-Sep-2020 17:09


Kiwrious lab-in-the-pocket kit designed for schoolchildren
Posted 28-Aug-2020 09:03



Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.


Support Geekzone »

Our community of supporters help make Geekzone possible. Click the button below to join them.

Support Geezone on PressPatron



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.