Skip to main content
KerdosMedia
Known Participant
Jan 15, 2025 8:38 PM UTC
Question

Assert Failed Packed when trying to copy metadata in lua script

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.

7 replies

johnrellis
Legend
Jan 15, 2025 11:59 PM UTC

[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():

 

 

 

 

Translate
KerdosMedia
Known Participant
Jan 17, 2025 1:26 AM UTC

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.

Translate
johnrellis
Legend
Jan 17, 2025 1:31 AM UTC

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

Translate
johnrellis
Legend
Jan 15, 2025 10:01 PM UTC

"but it throws the error."

 

What's the error?

Translate
KerdosMedia
Known Participant
Jan 15, 2025 10:46 PM UTC
It's in the title a assert failed packed
Translate
johnrellis
Legend
Jan 15, 2025 11:24 PM UTC

[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().

 

Translate