Page 1 of 1

adding user data to a DPX header

Posted: 2010-05-11T09:22:58-07:00
by check227
Can ImageMagick be used to set the value for the user-defined data field in a DPX header as documented in the DPX specifications: http://www.fileformat.info/format/dpx/egff.htm?

Re: adding user data to a DPX header

Posted: 2010-05-11T11:09:01-07:00
by magick
See http://www.imagemagick.org/script/motion-picture.php. It explains out to set DPX values. If there is a specific field you would like to set that is not currently available, let us know and we'll add support.

Re: adding user data to a DPX header

Posted: 2010-05-21T15:09:52-07:00
by check227
Sorry for the long delay on a response. I'm noticing in the source code in dpx.c there is a struct that is part of the header definition:

Code: Select all

typedef struct _DPXUserInfo
{
  char
    id[32];
} DPXUserInfo;
But the corresponding struct in the DPX specifications at http://www.fileformat.info/format/dpx/e ... PX-DMYID.2 includes a field for generic user data:

Code: Select all

typedef struct _UserDefinedData
{
	char  UserId[32];    /* User-defined identification string */
	BYTE *Data;          /* User-defined data */
} USERDEFINEDDATA;
I'd appreciate support for this field in the next release very much.

Re: adding user data to a DPX header

Posted: 2010-05-21T19:18:26-07:00
by magick
Support for user data is already built-in for the API but not the command line. Look for ImageMagick 6.6.2-0 Beta tomorrow and use this command:
  • convert image.dpx -set profile dpx:userdata.txt new.dpx

Re: adding user data to a DPX header

Posted: 2010-05-24T14:18:09-07:00
by check227
Cool thanks a lot. The user.data field is working well now, however I did come across one issue. I noticed that when I wrote certain lengths of data to the user.data field the data would be truncated when I read it back in. For example any output 8161 to 8192 characters in length would get truncated to 8160 characters. In the following block where the user data block is read in from dpx.c I noticed that the size of user data is having the size of dpx.user.id subtracted away.

Code: Select all

if ((dpx.file.user_size != ~0U) && ((size_t) dpx.file.user_size > sizeof(dpx.user.id)))
{
	StringInfo *profile;
	profile = AcquireStringInfo(dpx.file.user_size - sizeof(dpx.user.id));
	offset += ReadBlob(image, GetStringInfoLength(profile), GetStringInfoDatum(profile));
	(void) SetImageProfile(image, "dpx", profile);
	profile = DestroyStringInfo(profile);
}
This subtraction didn't seem correct to me since the size of dpx.user.id was not being added on during the write process. I removed this subtraction - as seen below - and it seems to fix the problem:

Code: Select all

if (dpx.file.user_size != ~0U)
{
	StringInfo *profile;
	profile = AcquireStringInfo(dpx.file.user_size);
	offset += ReadBlob(image, GetStringInfoLength(profile), GetStringInfoDatum(profile));
	(void) SetImageProfile(image, "dpx", profile);
	profile = DestroyStringInfo(profile);
}

Re: adding user data to a DPX header

Posted: 2010-05-24T15:43:22-07:00
by magick
Thanks for the problem report and patch. We'll get it into ImageMagick 6.6.2-1 Beta by sometime tomorrow.

Re: adding user data to a DPX header

Posted: 2012-10-22T23:48:45-07:00
by digobh
Hi Guys

I am not able to set any value for the user.data option.

When I run the following lines. I get an empty result to retrive the value I just set.

Code: Select all

$convert des-098-289_comp_v04.0006.dpx -define dpx:user.data="SLATE_FLAG" des-098-289_comp_v04.0006.dpx
$identify -format "%[dpx:user.data]"$ des-098-289_comp_v04.0006.dpx
$
I've tried as suggested too the -set profile and I get a complaint for a input file:

Code: Select all

$ convert des-098-289_comp_v04.0006.dpx -set profile dpx:user.data="SLATE_FLAG" des-098-289_comp_v04.0006.dpx
convert: unable to open file `user.data=SLATE_FLAG':  @ error/blob.c/FileToBlob/925.
Im on Linux using:
Version: ImageMagick 6.6.9-7 2012-08-17 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP

Can someone help me to get the right syntax where I could retrieve the value from the metadata afterwards?
I need to be able to add a comment in the metadata and retrive it later.

Thank you very much for your attention

Rodrigo Guimaraes

Re: adding user data to a DPX header

Posted: 2012-10-23T10:30:39-07:00
by fmw42
I do not know much about DPX data, but try

-set dpx:user.data "SLATE_FLAG"

not sure about the periods and colon, though.

see

http://www.imagemagick.org/Usage/basics/#set

Re: adding user data to a DPX header

Posted: 2012-10-23T16:06:29-07:00
by digobh
Hi Fred,

Thanks for your reply.
Your command seems to do something but still, I can't get the value back.
When I run the command below, to list all properties. user.data is not even there. Seems we need to add it first?
I had a look at the link you gave me but I couldn't find anything related.

$ identify -format %[*] des-098-289_comp_v04.0002.dpx
date:create=2012-10-24T10:00:33+11:00
date:modify=2012-10-24T10:00:33+11:00
dpx:file.creator=ImageMagick 6.6.9-7 2012-08-17 Q16 http://www.imagemagick.org
dpx:file.ditto.key=1
dpx:file.timestamp=2012-10-24T10:00:33+11:
dpx:file.version=V2.0
dpx:film.frame_position=0
dpx:film.held_count=0
dpx:film.sequence_extent=0
dpx:image.orientation=0
dpx:orientation.aspect_ratio=0x0
dpx:orientation.border=0x0+0+0
dpx:orientation.x_offset=0
dpx:orientation.x_size=0
dpx:orientation.y_offset=0
dpx:orientation.y_size=0
dpx:television.time.code=00:00:00:00
dpx:television.user.bits=00:00:00:00
software=ImageMagick 6.6.9-7 2012-08-17 Q16 http://www.imagemagick.org

Cheers

Rodrigo Guimaraes

Re: adding user data to a DPX header

Posted: 2012-10-23T19:31:21-07:00
by fmw42
The link and my comments were about setting the information into your file.