Convert JPG to PCX

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Frank.Liu
Posts: 1
Joined: 2019-08-29T20:35:02-07:00
Authentication code: 1152

Convert JPG to PCX

Post by Frank.Liu »

Hi guys,
I want to convert a jpg file to pcx format, I use bellow command line with Magick

Code: Select all

convert D:\mytest\A.jpg  -colors 2 -depth 1  D:\mytest\a.pcx
the file header :
010h:FF FF FF 00 00 00 ........
How I do can make the 010h update to 00 00 00 FF FF FF 00
Thanks .
Jason S
Posts: 103
Joined: 2010-12-14T19:42:12-07:00
Authentication code: 8675308

Re: Convert JPG to PCX

Post by Jason S »

I'm not sure I understand your question.

But I see that, in some cases, depending on the JPEG, IM (7.0.8) will write a 1-bit PCX file that has [ff ff ff 00 00 00] in the palette area at offset 0x10. And that seems... bad.

To the best of my knowledge, there is no portable way for a 1-bit PCX to be anything other than 0=black, 1=white. If you put anything other than [00 00 00 ff ff ff] or [00 00 00 00 00 00] in the first 6 bytes of the palette area, you're asking for trouble.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert JPG to PCX

Post by snibgo »

Is someone saying IM has a bug? If so, we will move this to the bugs forum.

Please also supply a link to something that says what those bytes should be.
snibgo's IM pages: im.snibgo.com
Jason S
Posts: 103
Joined: 2010-12-14T19:42:12-07:00
Authentication code: 8675308

Re: Convert JPG to PCX

Post by Jason S »

I think it's bug-like enough to move there.

The issue I'm talking about is that some of the 1-bit PCX files created by IM are not as portable as they could be. I believe the cause is the combination of the PaletteType field set to 1, and a white-then-black palette (FF FF FF 00 00 00) at offset 0x10.

Steps to reproduce:

Code: Select all

magick logo: -colors 2 -depth 1 test.pcx
My results: White wizard on black when interpreted by XnView or pcxtoppm. Black wizard on white when interpreted by Irfanview or ImageMagick.

Expected results: Black wizard always.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Convert JPG to PCX

Post by magick »

Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ https://www.imagemagick.org/download/beta/ by sometime tomorrow.
Post Reply