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

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
dvir
Posts: 13
Joined: 2014-12-17T07:07:30-07:00
Authentication code: 6789

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

Post 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!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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.
dvir
Posts: 13
Joined: 2014-12-17T07:07:30-07:00
Authentication code: 6789

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

Post 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!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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.
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

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

Post 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.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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?
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

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

Post by dlemstra »

Undefined is an actual value, 0 means Undefined. An unknown/unrecognized/invalid value is currently shown as "undefined"
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post by magick »

> An unknown/unrecognized/invalid value is currently shown as "undefined"

ImageMagick 6.9.0-1 Beta returns "Unrecognized" (as of tomorrow).
dvir
Posts: 13
Joined: 2014-12-17T07:07:30-07:00
Authentication code: 6789

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

Post 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!
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

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

Post by dlemstra »

If it is a missing disposal type the value will most likely be zero. And zero translates to "Undefined".
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
dvir
Posts: 13
Joined: 2014-12-17T07:07:30-07:00
Authentication code: 6789

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

Post by dvir »

Cool, thanks.

Any idea on what software is using these unrecognized values (5 for this)?
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

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

Post by dlemstra »

The comment of your invalid file says PhotoScape, maybe that program created it?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
dvir
Posts: 13
Joined: 2014-12-17T07:07:30-07:00
Authentication code: 6789

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

Post 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.
Post Reply