Improper image header

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?".
jeffATwork
Posts: 30
Joined: 2009-01-02T14:14:45-07:00
Location: Minneapolis, MN

Improper image header

Post by jeffATwork »

When attempting to convert a pct created by Quicktime 7 Pro, I get

$ convert frame1.pct frame1.jpg
convert: Improper image header `/var/folders/rJ/rJLQE-4XEXqyGP5Q9Q4Mg++++TM/-Tmp-/magick-c9ZU3eZU' @ pict.c/ReadPICTImage/871.

Running Snow Leopard on a MacBook Pro.

I can open the pct file in Photoshop and in 32 bit mode in Preview.

Any ideas?

Thanks!!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Improper image header

Post by anthony »

That type of error is caused by a failure of the 'delegate' program IM used to convert the image.

More than likely the delegate program ran, but produced a empty or 'unrecognised' output file
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Improper image header

Post by magick »

Post a URL to your image here. We need to download it and reproduce the problem before we can offer a solution.
jeffATwork
Posts: 30
Joined: 2009-01-02T14:14:45-07:00
Location: Minneapolis, MN

Re: Improper image header

Post by jeffATwork »

magick wrote:Post a URL to your image here. We need to download it and reproduce the problem before we can offer a solution.
http://clients.clockwork.net/imagemagick/frame1.pct

Thanks!
jeffATwork
Posts: 30
Joined: 2009-01-02T14:14:45-07:00
Location: Minneapolis, MN

Re: Improper image header

Post by jeffATwork »

jeffATwork wrote:
magick wrote:Post a URL to your image here. We need to download it and reproduce the problem before we can offer a solution.
http://clients.clockwork.net/imagemagick/frame1.pct

Thanks!
Accessing the image seems to be a problem. I'll repost when I figure out what's wrong with the URL.
jeffATwork
Posts: 30
Joined: 2009-01-02T14:14:45-07:00
Location: Minneapolis, MN

Re: Improper image header

Post by jeffATwork »

jeffATwork wrote:
jeffATwork wrote:
magick wrote:Post a URL to your image here. We need to download it and reproduce the problem before we can offer a solution.
http://clients.clockwork.net/imagemagick/frame1.pct

Thanks!
Accessing the image seems to be a problem. I'll repost when I figure out what's wrong with the URL.
The file's there. I was testing accessibility with Safari which got upset about server certification and couldn't download. Use wget or something.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Improper image header

Post by magick »

We downed loaded the file. There is no readily apparent reason why ImageMagick cannot read the image. It will take some serious debugging to fix the problem. We currently do not have an ETA on when you can expect a patch.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Improper image header

Post by fmw42 »

I don't know if this will be helpful or not. I am on Mac OSX Tiger. I used GraphicConverter to create a pict image in QT format and had no problem using IM to convert it to jpg. Sorry I don't have QT Pro to test.

However, using Preview v3.09 to save to PICT and then using IM to convert to jpg, I get the following error

convert zelda4.pict zelda4_pict.jpg
convert: Improper image header `/var/tmp/magick-OtLYrHQr' @ pict.c/ReadPICTImage/871.


convert -version
Version: ImageMagick 6.5.7-4 2009-11-03 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC

Here are 3 files, first two from GraphicConverter, convert fine with IM. Last one from Preview, does not convert with IM

http://www.fmwconcepts.com/misc_tests/z ... _noweb.pct
http://www.fmwconcepts.com/misc_tests/z ... qt_web.pct
http://www.fmwconcepts.com/misc_tests/z ... review.pct
jeffATwork
Posts: 30
Joined: 2009-01-02T14:14:45-07:00
Location: Minneapolis, MN

Re: Improper image header

Post by jeffATwork »

magick wrote:We downed loaded the file. There is no readily apparent reason why ImageMagick cannot read the image. It will take some serious debugging to fix the problem. We currently do not have an ETA on when you can expect a patch.
OK.

I just verified that GraphicConverter is able to handle the PICT. So I'll go that route.

Thanks for trying it out.
jeffATwork
Posts: 30
Joined: 2009-01-02T14:14:45-07:00
Location: Minneapolis, MN

Re: Improper image header

Post by jeffATwork »

fmw42 wrote:I don't know if this will be helpful or not. I am on Mac OSX Tiger. I used GraphicConverter to create a pict image in QT format and had no problem using IM to convert it to jpg. Sorry I don't have QT Pro to test.

However, using Preview v3.09 to save to PICT and then using IM to convert to jpg, I get the following error

convert zelda4.pict zelda4_pict.jpg
convert: Improper image header `/var/tmp/magick-OtLYrHQr' @ pict.c/ReadPICTImage/871.


convert -version
Version: ImageMagick 6.5.7-4 2009-11-03 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC

Here are 3 files, first two from GraphicConverter, convert fine with IM. Last one from Preview, does not convert with IM

http://www.fmwconcepts.com/misc_tests/z ... _noweb.pct
http://www.fmwconcepts.com/misc_tests/z ... qt_web.pct
http://www.fmwconcepts.com/misc_tests/z ... review.pct
Yep. That looks like the Tiger version of my problem on Snow Leopard. So, it's been around for a while.

Thanks for giving it a shot!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Improper image header

Post by fmw42 »

Apple must have changed something in the QT format for PICT at some point as GraphicConverter works fine to produce a PICT that IM can convert.
jefftrull

Re: Improper image header

Post by jefftrull »

I spent some time today debugging a problem of this type. I downloaded and compiled the ImageMagick code so I could add some debug prints to the PICT converter. It looks like my file contained an embedded image, opcode 0x8200. According to coders/pict.c this is an "embedded JPEG", but according to the Apple docs it is "Compressed QuickTime":

http://developer.apple.com/legacy/mac/l ... w-458.html

I then reviewed the QuickTime Image File doc, available here:

http://developer.apple.com/mac/library/ ... -TPXREF101

From that information and some binary dumps I was able to discover that the QuickTime was encapsulating a TIFF image. So this is 1) a TIFF, inside 2) a QuickTime Image, inside 3) a PICT file.

The existing code in pict.c for handling opcode 0x8200 seems to be hardcoded to expect an embedded JPEG, but judging from the Apple docs it can be much more general.
jefftrull

Re: Improper image header

Post by jefftrull »

Of the three .pct files posted by fmw42, the first two are embedded JPEGs, which explains why ImageMagick can read them OK. The third one seems to be gone, so I can't check it...
HanClinto
Posts: 2
Joined: 2011-11-17T13:03:51-07:00
Authentication code: 8675308

Re: Improper image header

Post by HanClinto »

I'm having similar issues with ImageMagick v. 6.7.3-1 Q17 on OS/X Lion.

Here are three files that Preview reads correctly, but ImageMagick dies on with the aforementioned error:

http://dl.dropbox.com/u/2737199/bugs/Im ... k/xdd.pict
http://dl.dropbox.com/u/2737199/bugs/Im ... k/xad.pict
http://dl.dropbox.com/u/2737199/bugs/Im ... k/xdc.pict

Code: Select all

lappy-i7:ImageMagick clint$ ls
xad.pict	xdc.pict	xdd.pict
lappy-i7:ImageMagick clint$ mogrify -format png *.pict
mogrify: improper image header `xad.pict' @ error/pict.c/ReadPICTImage/871.
mogrify: improper image header `xdc.pict' @ error/pict.c/ReadPICTImage/868.
mogrify: improper image header `xdd.pict' @ error/pict.c/ReadPICTImage/868.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Improper image header

Post by fmw42 »

For what it is worth. I am on IM 6.7.3.6 Q16 Mac OSX Tiger. I get the following from IM

identify xdd.pict
identify: improper image header `xdd.pict' @ error/pict.c/ReadPICTImage/868.

Preview gives an error message saying it is corrupt.

BUT GraphicConverter opens it fine! If I resave it from GraphicConverter as PICT, then Preview can open it and IM can handle it fine.

So I would say that your image was not created according to Apple's pict standards in some way or the format has changed over time.
Post Reply