-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse Frameright app generated region metafields #16
Conversation
Include FramerightIdc:RegionDefinitionId and FramerightIdc:RegionName node values into the parsed ImageRegion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @klaari. This looks perfect. Just one nitpick
$expectedRegion->regionDefinitionId = 'definition-7a54f275-6872-435e-befc-b52d97653a28'; | ||
$expectedRegion->regionName = '4:3 Horizontal'; | ||
$expectedRegion->id = 'crop-e789b6b8-ee15-45c0-a0c5-3ad38858db14'; | ||
$expectedRegion->names = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ilu I'm surprised the IDC names bag is empty, instead of containing the same value as what we put in FramerightIdc:RegionName
. Is this a bug in https://frameright.app ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test image I created with the https://frameright.app had the region name only in the FramerightIdc:RegionName
This is the full xmpmeta from the test file:
<x:xmpmeta
xmlns:x="adobe:ns:meta/" x:xmptk="Frameright XMP Toolkit 2.0.0">
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<rdf:Description
xmlns:Iptc4xmpExt="http://iptc.org/std/Iptc4xmpExt/2008-02-29/"
xmlns:FramerightIdc="http://ns.frameright.io/idc/1.0/">
<Iptc4xmpExt:ImageRegion
xmlns:Iptc4xmpExt="http://iptc.org/std/Iptc4xmpExt/2008-02-29/">
<rdf:Bag>
<rdf:li rdf:parseType="Resource">
<Iptc4xmpExt:RegionBoundary rdf:parseType="Resource">
<Iptc4xmpExt:rbShape>rectangle</Iptc4xmpExt:rbShape>
<Iptc4xmpExt:rbUnit>relative</Iptc4xmpExt:rbUnit>
<Iptc4xmpExt:rbW>0.8890625</Iptc4xmpExt:rbW>
<Iptc4xmpExt:rbH>1</Iptc4xmpExt:rbH>
<Iptc4xmpExt:rbX>0.0375</Iptc4xmpExt:rbX>
<Iptc4xmpExt:rbY>0</Iptc4xmpExt:rbY>
</Iptc4xmpExt:RegionBoundary>
<Iptc4xmpExt:rId>crop-e789b6b8-ee15-45c0-a0c5-3ad38858db14</Iptc4xmpExt:rId>
<Iptc4xmpExt:rRole rdf:parseType="Resource">
<rdf:Bag>
<rdf:li rdf:parseType="Resource">
<xmp:Identifier
xmlns:xmp="http://ns.adobe.com/xap/1.0/">
<rdf:Bag>
<rdf:li>http://cv.iptc.org/newscodes/imageregionrole/cropping</rdf:li>
</rdf:Bag>
</xmp:Identifier>
</rdf:li>
</rdf:Bag>
</Iptc4xmpExt:rRole>
<FramerightIdc:RegionDefinitionId
xmlns:FramerightIdc="http://ns.frameright.io/idc/1.0/">definition-7a54f275-6872-435e-befc-b52d97653a28
</FramerightIdc:RegionDefinitionId>
<FramerightIdc:RegionName
xmlns:FramerightIdc="http://ns.frameright.io/idc/1.0/">4:3 Horizontal
</FramerightIdc:RegionName>
</rdf:li>
</rdf:Bag>
</Iptc4xmpExt:ImageRegion>
<MetadataDate
xmlns="http://ns.adobe.com/xap/1.0/">2023-10-08T06:53:22.336Z
</MetadataDate>
<ModifyDate
xmlns="http://ns.adobe.com/xap/1.0/">2023-10-08T06:53:22.336Z
</ModifyDate>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AurelienLourot It's more of an unimplemented feature. The FramerightIdc fields are intended for use with Frameright.app, so they have a bit different semantics than the Iptc4xmpExt:Name field. For example Iptc4xmpExt:Name needs to be unique and can have translations, both of which we would have to handle somehow on Frameright.app.
But yes, we should enable writing that field and some other fields as well in Frameright.app, but we need to figure out how to handle the ones that have conflicting semantics.
If the region has an existing Iptc4xmpExt:Name field (or any other fields), we leave them intact, and we only update the x, y, width, height, unit etc. fields and the FramerightIdc fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok thanks for clarifying. @klaari this doesn't have any impact on this PR I was just curious
|
||
'regionDefinitionId' => $region->regionDefinitionId, | ||
'regionName' => $region->regionName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, works fine with me. I can do the update if we all agree?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me @AurelienLourot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@klaari yes you can do the update, thanks a lot
Perfect, thanks a lot @klaari. Releasing v1.1.0 ... |
done ✔️ |
Include FramerightIdc:RegionDefinitionId and FramerightIdc:RegionName node values into the parsed ImageRegion
I have a use case where I wan't to be able to specify which region to use precisely.
For that I will need the regionDefinitionId and/or regionName genereated by the Frameright app.