Page 1 of 1

Identify -format %D returns 'undefined' (as opposed to Undefined)

Posted: 2014-12-17T07:11:45-07:00
by dvir
Hey guys.

I have a few animated GIFs I'm running 'identify -format %D' on, and they are returning 'undefined' (while others are returning Undefined, Background, None, etc.).
Is there a difference between 'undefined' and 'Undefined'?
Should I treat them the same as Undefined?
What would cause it to return 'undefined'?

Thanks a lot!

Re: Identify -format %D returns 'undefined' (as opposed to Undefined)

Posted: 2014-12-17T10:54:49-07:00
by fmw42
I cannot answer that, but perhaps it would help if you provide your version of IM and platform and an example GIF that returns undefined and one that returns Undefined.

Re: Identify -format %D returns 'undefined' (as opposed to Undefined)

Posted: 2014-12-18T11:20:37-07:00
by dvir
hey fmw42!

I've encountered this on IM 6 and now on a recent 6.8.6-8 build on a linux machine.

Here is an example of a broken GIF: http://media.giphy.com/media/fz0KNGp3zw0ko/giphy.gif
Command and output: 'identify -format %D giphy.gif[0]' returns 'undefined'

Here is an example of a GIF that returns Undefined: http://i.giphy.com/TlK63EQNdeuEqCrjPyw.gif
Command and output: 'identify -format %D TlK63EQNdeuEqCrjPyw.gif[0]' returns 'Undefined'

Thanks!

Re: Identify -format %D returns 'undefined' (as opposed to Undefined)

Posted: 2014-12-18T12:04:30-07:00
by fmw42
I get your same results. I don't know why the spelling should be different, but I suspect they both mean the same thing.

One of the IM developers can now take a look at this and get back about it.

Re: Identify -format %D returns 'undefined' (as opposed to Undefined)

Posted: 2014-12-18T13:01:50-07:00
by dlemstra
They don't mean the same thing. The first image has a Dispose value that is 5. Valid values are 0-3 (http://www.w3.org/Graphics/GIF/spec-gif89a.txt). This is an unknown value and our code that translates this value returns "undefined" instead of "Undefined". The next version of ImageMagick will return "Unrecognized" when a value is found that we don't know.

Re: Identify -format %D returns 'undefined' (as opposed to Undefined)

Posted: 2014-12-18T14:00:48-07:00
by fmw42
dlemstra wrote:They don't mean the same thing. The first image has a Dispose value that is 5. Valid values are 0-3 (http://www.w3.org/Graphics/GIF/spec-gif89a.txt). This is an unknown value and our code that translates this value returns "undefined" instead of "Undefined". The next version of ImageMagick will return "Unrecognized" when a value is found that we don't know.
What is the explanation for the other image?

Can you clarify how IM defines Undefined vs undefined?

Re: Identify -format %D returns 'undefined' (as opposed to Undefined)

Posted: 2014-12-18T15:42:12-07:00
by dlemstra
Undefined is an actual value, 0 means Undefined. An unknown/unrecognized/invalid value is currently shown as "undefined"

Re: Identify -format %D returns 'undefined' (as opposed to Undefined)

Posted: 2014-12-18T15:51:28-07:00
by fmw42
dlemstra wrote:Undefined is an actual value, 0 means Undefined. An unknown/unrecognized/invalid value is currently shown as "undefined"
Thanks for the clarification

Re: Identify -format %D returns 'undefined' (as opposed to Undefined)

Posted: 2014-12-18T16:26:19-07:00
by magick
> An unknown/unrecognized/invalid value is currently shown as "undefined"

ImageMagick 6.9.0-1 Beta returns "Unrecognized" (as of tomorrow).

Re: Identify -format %D returns 'undefined' (as opposed to Undefined)

Posted: 2014-12-18T17:30:22-07:00
by dvir
Thanks guys! This is a bit awkward, as if there is a value (even 0) returning Undefined makes me think it's null or just totally missing.

So what will be shown for a missing disposal type? Also Unrecognized?

Either ways, it is cool that I now have an explanation of what was going on. I was confused about Undefined and undefined. Thanks!

Re: Identify -format %D returns 'undefined' (as opposed to Undefined)

Posted: 2014-12-19T02:00:11-07:00
by dlemstra
If it is a missing disposal type the value will most likely be zero. And zero translates to "Undefined".

Re: Identify -format %D returns 'undefined' (as opposed to Undefined)

Posted: 2014-12-19T03:24:55-07:00
by dvir
Cool, thanks.

Any idea on what software is using these unrecognized values (5 for this)?

Re: Identify -format %D returns 'undefined' (as opposed to Undefined)

Posted: 2014-12-19T05:07:55-07:00
by dlemstra
The comment of your invalid file says PhotoScape, maybe that program created it?

Re: Identify -format %D returns 'undefined' (as opposed to Undefined)

Posted: 2014-12-19T05:12:51-07:00
by dvir
dlemstra wrote:The comment of your invalid file says PhotoScape, maybe that program created it?
Ah, yeah, might be. I'll try creating a GIF using it and see if it produces the faulty values.