Skip to content
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

Support for XMP metadata #858

Open
mbaumanndev opened this issue Mar 22, 2019 · 19 comments · Fixed by #1918
Open

Support for XMP metadata #858

mbaumanndev opened this issue Mar 22, 2019 · 19 comments · Fixed by #1918

Comments

@mbaumanndev
Copy link

As discussed on Gitter, ImageSharp doesn't support XMP at the moment, it would be interesting to have support for it

@JimBobSquarePants
Copy link
Member

If anyone wants to take this on specification information can be found here.

https://www.adobe.com/devnet/xmp.html

@IldarKhayrutdinov
Copy link
Contributor

IldarKhayrutdinov commented Aug 6, 2019

@JimBobSquarePants I'm interested in implementing support for XMP metadata. I think the feature is useful.
Please assign the task to me.

@antonfirsov
Copy link
Member

Hey, @IldarKhayrutdinov thanks for your interest! Feel free to pick up, and feel free to discuss the topic and ask any question either here or on gitter.

@IldarKhayrutdinov
Copy link
Contributor

@antonfirsov thanks! Yes, I will need to discuss API.

@IldarKhayrutdinov
Copy link
Contributor

@antonfirsov Пардон, вы по русски не говорите?)

@antonfirsov
Copy link
Member

Говорю, ну я с детства в Венгрии живу, поэтому девелоперский диалект совсем пропустил. Последнее времья стараюсь его в Ютубе изучать. Заговорить на нём мне пока не просто ))

Ну я не обойдусь, скоро в Прагу переселяюсь, много русских коллег будут.

@IldarKhayrutdinov
Copy link
Contributor

IldarKhayrutdinov commented Aug 9, 2019

@antonfirsov Я очень рад) Пишете, по крайней мере, очень грамотно, а у меня с английским не так хорошо, как хотелось бы...
Тут можно по русски обсуждать вопросы проекта?

@antonfirsov
Copy link
Member

antonfirsov commented Aug 10, 2019

А можем в гиттере? Там просто более просше обсуждать код, чем в майле, и не будем спамить других сдесь.

ПМ меня - есле ОК. Есле нет, напишу майл.

@IldarKhayrutdinov
Copy link
Contributor

Ага, гиттер удобнее, написал там.

@IldarKhayrutdinov IldarKhayrutdinov removed their assignment Sep 5, 2019
@IldarKhayrutdinov
Copy link
Contributor

I haven't enough time :( enjoy who want to take this task!

@JimBobSquarePants
Copy link
Member

@dlemstra You've touched on this before haven't you. Do you have any info you can share that someone can start with?

@dlemstra
Copy link
Member

dlemstra commented Sep 6, 2019

My Magick.NET project contains a very simple XMP profile class (https://github.com/dlemstra/Magick.NET/blob/master/src/Magick.NET/Shared/Profiles/XmpProfile.cs). This just a very simple wrapper to make it easier to access to xml. And to detect it you will need to check the JPEG metadata similar to the exif profile and check if it starts with http://ns.adobe.com/xap/1.0/ .

@JimBobSquarePants
Copy link
Member

Interesting thanks! I'll have to have a look at the spec to see what else we'd need to do to add more user friendly editing

@rickbrew
Copy link

rickbrew commented Oct 12, 2020

@JimBobSquarePants I recently spent a lot of time implementing XMP support for Paint.NET earlier this year. Happy to consult and provide sample code. This stuff is a beast, it took me a full month to get it all figured out, coded, and refined. You can also reflector/ilspy/dnSpy over the app's binaries. Look for XmpPacket in PDN.Core.dll as a starting point.

@ynse01
Copy link
Contributor

ynse01 commented Dec 20, 2021

First step of XMP support is, I guess, is to load and store XMP packets as raw XML. According to the XMP Specifications, the metadata can be embedded in the following image types:

I'm willing to take up the work of exposing this in a proper Profile class and connecting that up to the Encoders and Decoders. As a first step, just with the content of the XMP packets as XML.
That means at least ImageSharp will have some level of support for XMP. I think this aligns with the level that Magick.NET offers, but doesn't reach what Paint.NET can do.

To reach the level of user friendly editing is more design work though. Not sure I'm up for that.

Do you guys agree the basic level of support adds value already?

@rickbrew
Copy link

In Paint.NET, I only bubble up XMP as the raw XML. If a plugin wants to handle XMP they have to parse the XML themselves. The main -- frankly only -- goal of adding XMP support to the app was to preserve it across file open/save actions. Creating an object model against XMP is IMO not worth the effort unless you find strong need for it.

The really hard part of XMP support was reading and writing it from the EXIF chunks in JPEG files. It was pretty tricky, and you need to have a bunch of sample images to work with, especially ones that have a large amount of XMP data (>64K, IIRC), which has to be encoded across multiple chunks.

Here's one such example image, which contains megabytes of ridiculous Photoshop history data encoded into the XMP:
BLOATED_1580380752x15221my1003glhdp1001t3extyellowrear.zip If you can preserve that across open/save, you are making great progress.

@antonfirsov
Copy link
Member

antonfirsov commented Dec 21, 2021

Personally, I would be fine exposing the raw XML in some read-only form (maybe as string). We don't want to make it editable if we cannot validate the contents.

BTW isn't there an XSD schema for the whole thing? That would enable to auto-generate the classes and ship them in an external experimental library.

@ynse01 ynse01 mentioned this issue Jan 2, 2022
4 tasks
@JimBobSquarePants
Copy link
Member

There's actually projects out there that can handle the data.
https://github.com/drewnoakes/xmp-core-dotnet

@JimBobSquarePants
Copy link
Member

I'm reopening this as I'd like to, at some point, add full read/write capability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants