ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: anagar on January 07, 2013, 12:09:17 PM

Title: How to embed metadata from XML file in the JPEG2000 image file?
Post by: anagar on January 07, 2013, 12:09:17 PM
Hi There,

Can somebody please help me finding how to embed the data from XML file to .jp2 image.

Thanks.
regards,
Anil
Title: Re: How to embed metadata from XML file in the JPEG2000 image file?
Post by: Phil Harvey on January 07, 2013, 01:26:53 PM
Hi Anil,

I am afraid you need to be more specific.  I can think of many ways to do this.

It depends on the exact format of your XML file, and exactly where you want the information written.

- Phil
Title: Re: How to embed metadata from XML file in the JPEG2000 image file?
Post by: anagar on January 07, 2013, 03:32:03 PM
Hi Phil,

Thanks for your quick response.  Basically the scenario is as follows :-

Step 1 ) We scan the images using any production scanners.
Step 2 ) This file need to indexed against some meta data, like image id, dept name, and chapter no. etc.
Step 3)  Export the image as uncompressed tiff file
Step 4)  Export the metadata for each tif file in the form of .XML file. For Eg:-  Image0001.xml will contain following xml data :-
             <?XML ................................. ?>
             <Data>
                   <ImageID>12345-1231-2342332</ImageID>
                   <Department>DEPT01</Department>
                   <ChapterNo>12345-1231-2342332</ChapterNo>
             </Data>


Step 5)  Compress the outputted .TIF file to JPEG 2000 standard and create a .JP2 image file (for eq. Image0001.JP2)

Now I want the Exiftool to help me here to attach the .XML data which was generated in STEP 4 (Image00001.xml) within the XML tag of Image0001.jp2 .

Please suggest me how can I do the same.

Thanks.
Anil
Title: Re: How to embed metadata from XML file in the JPEG2000 image file?
Post by: Phil Harvey on January 07, 2013, 04:23:36 PM
Hi Anil,

Thanks.  Unfortunately ExifTool can't currently write the XML tag in JP2 images.

I will look into adding this ability.

- Phil
Title: Re: How to embed metadata from XML file in the JPEG2000 image file?
Post by: anagar on January 08, 2013, 04:24:14 AM
Thank you very much Phil, you are a Star  :)
It will be a great help for us.

Also, this will make the ExifTool more efficient as lots of organisations need to store the data in XML format along with their .jp2 archive images. Currently there are some tools like j2k metadata editor that does this, but I suppose they are lacking in providing a command line version.

Thanks Again.
Regards,
Anil
Title: Re: How to embed metadata from XML file in the JPEG2000 image file?
Post by: anagar on February 01, 2013, 07:07:00 AM
Hi Phil,

I just checke the lastest developments you have done and found that you have added the functionality to read/write Jpeg2000 XML tag as a block in the version v9.14. I must say a big thanks to you for this.

Can you please let me know how can I use this version to run on the my windows machine as a command line app.

Thank you very much again for all your support.
Regards,
Anil
Title: Re: How to embed metadata from XML file in the JPEG2000 image file?
Post by: Phil Harvey on February 01, 2013, 07:43:39 AM
Hi Anil,

What exactly are you having a problem with?  Just running ExifTool, or figuring the the command line to write the XML?

- Phil
Title: Re: How to embed metadata from XML file in the JPEG2000 image file?
Post by: anagar on February 01, 2013, 07:48:51 AM
Hi Phil,

I mean since this version is not realeased for production henc only a perl version is availablem but I need to build the executable for running on windows. I saw some instruction for using the .tar.gz file and will try them now. I have downloaded the active perl on my system.

Also, can you please let me know what option (tags/sequence of commands) I need to use to attach the xml block to the .jp2 file. (i couldn't find any documentation for this, may be you will publish this with the production release).

Thank u phil
Regards,
Anil
Title: Re: How to embed metadata from XML file in the JPEG2000 image file?
Post by: anagar on February 01, 2013, 11:38:47 AM
Hello Phil,

I have got it working now using th following the following command.

C:\test>exiftool.pl c:\test\testJp2.jp2 -xml+="<?xml version="1.0" encoding="utf-8"?><File xmlns="xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><UUID>c23fc84a-ee47-47ee-842c-2339a9ac5131</UUID> <Copyright>&#169; Crown copyright: I-digital Ltd UK</Copyright></File>"

The only thing I wanted to know if it is possible to supply the xml from some externalfile like 'data.xml' raher then typing the whole xml in the cmmand line?

Thanks
Regards,
Anil
Title: Re: How to embed metadata from XML file in the JPEG2000 image file?
Post by: Phil Harvey on February 01, 2013, 12:12:05 PM
I'm confused.  The windows binary version is available.  The development releases include versions for all platforms.

Use the "-TAG<=DATFILE" syntax to set the value of a tag from a file.  (this and much more is explained in the application documentation (https://exiftool.org/exiftool_pod.html).

- Phil
Title: Re: How to embed metadata from XML file in the JPEG2000 image file?
Post by: anagar on February 18, 2013, 12:45:43 PM
Thank you very much Phil. I got it all working now.

I used the following command it works like a charm...

exiftool.exe testexif-orig.jp2 "-xml+<=medata.xml"

You are a real hero.. :)
Thanks again.
Anil
Title: Re: How to embed metadata from XML file in the JPEG2000 image file?
Post by: bharat_restorescan on March 13, 2013, 07:51:18 AM
Hi Phil
Hi Phil


I am embedding xml into a JPEG2000 image, using ExifTool V9.17, using the command

exiftool -xml+="<?xml version.... " image.jp2

The xml is in memory and validated against an xml schema not read in from a file. Also the xml I am write is converted to a string.

When I use jpylyzer, a tool to validate the jp2 image, it fails with xml is not well formed.

Am I missing something in my command? Any help will be appreciated.

Regards
Bharat
Title: Re: How to embed metadata from XML file in the JPEG2000 image file?
Post by: Phil Harvey on March 13, 2013, 07:56:29 AM
Hi Bharat,

Your command looks good.  Do you have any JP2 images with XML which pass the jpylyzer test?  If so, I suggest recreating them with ExifTool to see if there are any differences.

- Phil
Title: Re: How to embed metadata from XML file in the JPEG2000 image file?
Post by: bharat_restorescan on March 13, 2013, 11:12:56 AM
Phil

I am using the -s switch to read all the tags in both the good and faulty image but i am not able xml tag with the whole xml but I can see the xml tag names as metadata tags. Is it suppose to be like that or is there a switch to let me see the xml that was input?

Bharat
Title: Re: How to embed metadata from XML file in the JPEG2000 image file?
Post by: Phil Harvey on March 13, 2013, 11:52:31 AM
From the Jpeg2000 tags documentation (https://exiftool.org/TagNames/Jpeg2000.html):

XML(by default, the XML data in this tag is parsed using the ExifTool XMP module to to allow individual tags to be accessed when reading, but may be treated as a block instead by specifying the "XML" tag, which is also how this tag is written and copied. This is a List-type tag because multiple XML blocks may exist)

- Phil
Title: Re: How to embed metadata from XML file in the JPEG2000 image file?
Post by: bharat_restorescan on March 14, 2013, 10:27:49 AM
Hi Phil

Thanks for all your help and the problem was in the way my xml was parsed before it was added to the metadata.

Regards

Bharat.