Skip to main content
KerdosMedia
Known Participant
January 15, 2025
Question

Assert Failed Packed when trying to copy metadata in lua script

  • January 15, 2025
  • 2 replies
  • 232 views

I'm trying to write a lightroom classic plugin. One of the steps is to copy metadata from one photo to another.

I'm using :

newPhoto:setRawMetadata("keywords", oldPhoto:getRawMetadata("keywords"))

but it throws the error.

Also "title" is an unrecognized metadata key even though it apears in the sdk docs.

2 replies

johnrellis
Legend
January 15, 2025

[This post contains formatting and embedded images that don't appear in email. View the post in your Web browser.]

 

""title" is an unrecognized metadata key even though it apears in the sdk docs."

 

Use photo:getFormattedMetadata() rather than getRawMetadata():

 

 

 

 

KerdosMedia
Known Participant
January 17, 2025

There is no setFormattedMetadata, how do I set title? I couldn't just move the photos so I'm copying, reimporting and copying metadata. Title is one of the important fields for me.

johnrellis
Legend
January 17, 2025

Some fields you retrieve with getFormattedMetadata(), some with getRawMetadata(). But you set all fields using setRawMetadata().

johnrellis
Legend
January 15, 2025

"but it throws the error."

 

What's the error?

KerdosMedia
Known Participant
January 15, 2025
It's in the title a assert failed packed
johnrellis
Legend
January 15, 2025

[This post contains formatting and embedded images that don't appear in email. View the post in your Web browser.]

 

According to the API docs, photo:setRawMetadata() doesn't support the key "keywords":

 

 

Instead, use photo:addKeyword() and removeKeyword().