[File] [PATCH] Magdir/images PCX ; mime type and extension
Jörg Jenderek (GMX)
joerg.jen.der.ek at gmx.net
Sun Dec 3 15:32:33 UTC 2023
Hello,
some days ago i must handles some old software samples. One file name
extension is PCX.
So i look on my systems for such files. When running file command
version 5.43 on such graphic images and related files i get an
output like:
128x64bw.pcx: PCX for Windows image data
bounding box [0, 0] - [127, 63]
, 8-bit colour, 300 x 300 dpi
, RLE compressed
32x64-v0.pcx: PCX ver. 2.5 image data
bounding box [0, 0] - [31, 63]
, 3 planes each of 8-bit colour, 72 x 72 dpi
, uncompressed
60x20-v4-graytext.pcx: PCX for Windows image data
bounding box [0, 0] - [59, 19]
, 3 planes each of 8-bit colour, 72 x 72 dpi
, uncompressed
FAXCOVER.PCX: PCX ver. 2.8 image data, without palette
bounding box [0, 0] - [1727, 575]
, 1-bit 640 x 480 dpi
, RLE compressed
fmt-86-signature-id-65.pcx: PCX ver. 2.5 image data
bounding box [0, 0] - [0, 0]
, 1-bit colour
, RLE compressed
fmt-87-signature-id-64.pcx: PCX ver. 2.8 image data, with palette
bounding box [0, 0] - [0, 0]
, 1-bit colour, RLE compressed
fmt-88-signature-id-63.pcx: PCX ver. 2.8 image data, without palette
bounding box [0, 0] - [0, 0]
, 1-bit colour
, RLE compressed
fmt-89-signature-id-62.pcx: PCX for Windows image data
bounding box [0, 0] - [0, 0]
, 1-bit colour
, RLE compressed
fmt-90-signature-id-61.pcx: PCX ver. 3.0 image data
bounding box [0, 0] - [0, 0]
, 1-bit RLE compressed
With option --extension only 3 byte sequence ??? is shown and with -i
option only old image/x-pcx is shown.
For comparison reason i run the file format identification utility
TrID ( See https://mark0.net/soft-trid-e.html). All samples are
"recognized". Samples with version byte value 0 (like
32x64-v0.pcx fmt-87-signature-id-64.pcx) are described as "PCX bitmap
(v2.5)" via definition bitmap-pcx.trid.xml. Samples (like
fmt-87-signature-id-64.pcx) with value 2 are described as "PCX bitmap
(v2.8, palette)" by via bitmap-pcx-v28p.trid.xml. Samples (like
fmt-89-signature-id-62.pcx) with value 3 are described as "PCX bitmap
(v2.8)" via bitmap-pcx-v28.trid.xml. Samples (like
fmt-89-signature-id-62.pcx 128x64bw.pcx) with value 4 are described as
"PCX bitmap (Win)" by TrID via bitmap-pcx-win.trid.xml. Samples (like
fmt-90-signature-id-61.pcx) with value 5 are described as "PCX bitmap
(v3.0)" via bitmap-pcx-v30.trid.xml. Here file name suffix PCX is listed
and official registered mime type image/vnd.zbrush.pcx is shown (See
appended trid-v-pcx.txt.gz).
The five samples fmt-*-signature-id-*.pcx are not real graphics. These
contain just 128 starting bytes of PCX graphics and are used by DROID to
identify PCX graphics.
For comparison reason i also run the file format identification
utility DROID ( See https://sourceforge.net/projects/droid/). This
identifies all examples as "PCX" and with file name suffix pcx. There
version byte value is shown as field version. The 5 used variants are
described by PUID starting with fmt/86 and ending with fmt/90. Here also
suffix is pcx and mime type image/vnd.zbrush.pcx is displayed. Some
samples (like 32x64-v0.pcx 60x20-v4-graytext.pcx) are not described as
PCX (See appended droid-pcx.csv.gz).
The DROID samples are neither recognized nor displayed by other
graphical viewers. I verified information by XnView command line tool by
line like:
nconvert -in pcx -fullinfo *.pcx
Here also some samples (like 60x20-v4-graytext.pcx 128x64bw.pcx) are not
recognized but the other are described with name "pcx" and Format "Zsoft
Paintbrush" (See appended nconvert-pcx.txt.gz)
I also tried ImageMagick version 7.1.1-21. Here all non DROID samples
are recognized (See appended identify-pcx.txt.gz) by command line like:
identify *.pcx
I also tried IrfanView graphic viewer and LibreOffice Draw. These
display some samples and some not.
Luckily with information given by the other tools i also found a
page about PCX on file formats archive team web site. There also links
for samples and references are listed. That information is expressed by
comment line inside Magdir/images like:
# URL: http://fileformats.archiveteam.org/wiki/PCX
On that site download links for examples and graphic tools are
mentioned.
The image dimensions are shown by lines inside Magdir/images like:
>>>>4 uleshort x bounding box [%d,
>>>>6 uleshort x %d] -
>>>>8 uleshort x [%d,
>>>>10 uleshort x %d],
For real examples the first point has usually coordinate (0,0) and for
the second i get positive values. For the DROID samples we got here all
nil values. So the DROID samples are skipped by additional test after
version tests for not nil of second coordinate point.
So the beginning of identification lines starts now like:
0 ubelong&0xffF8fe00 0x0a000000
>3 ubyte >0
>>1 ubyte <6
>>>1 ubyte !1
>>>>8 long !0 PCX
!:mime image/vnd.zbrush.pcx
!:ext pcx/pcc
Instead of deprecated image/x-pcx now show officially registered mime
type from IANA organization. The standard file name suffix is pcx. On
reference site also pcc is mentioned and i myself found 4 samples (like
abydos.st E-DIODE.ST MUSIC-13.ST ROSE.ST). So at thee moment i display
the first 2 suffix.
After applying the above mentioned modifications by patch
file-5.45-images-pcx.diff then all my inspected PCX graphics are
still described but now non graphic samples are skipped. This then looks
like:
128x64bw.pcx: PCX for Windows image data
bounding box [0, 0] - [127, 63]
, 8-bit colour, 300 x 300 dpi
, RLE compressed
32x64-v0.pcx: PCX ver. 2.5 image data
bounding box [0, 0] - [31, 63]
, 3 planes each of 8-bit colour, 72 x 72 dpi
, uncompressed
60x20-v4-graytext.pcx: PCX for Windows image data
bounding box [0, 0] - [59, 19]
, 3 planes each of 8-bit colour, 72 x 72 dpi
, uncompressed
FAXCOVER.PCX: PCX ver. 2.8 image data, without palette
bounding box [0, 0] - [1727, 575]
, 1-bit 640 x 480 dpi, RLE compressed
fmt-86-signature-id-65.pcx: data
fmt-87-signature-id-64.pcx: data
fmt-88-signature-id-63.pcx: data
fmt-89-signature-id-62.pcx: data
fmt-90-signature-id-61.pcx: data
I hope my diff file can be applied in future version of file
utility.
With best wishes,
Jörg Jenderek
--
Jörg Jenderek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nconvert-pcx.txt.gz
Type: application/x-gzip
Size: 614 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20231203/2894e58d/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: identify-pcx.txt.gz
Type: application/x-gzip
Size: 293 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20231203/2894e58d/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: trid-v-pcx.txt.gz
Type: application/x-gzip
Size: 640 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20231203/2894e58d/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: droid-pcx.csv.gz
Type: application/x-gzip
Size: 503 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20231203/2894e58d/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-5.45-images-pcx.diff.sig
Type: application/octet-stream
Size: 1360 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20231203/2894e58d/attachment.obj>
-------------- next part --------------
--- file-5.45/magic/Magdir/images.old 2023-07-27 20:04:45.000000000 +0200
+++ file-5.45/magic/Magdir/images 2023-12-03 16:16:35.823108300 +0100
@@ -1765,4 +1765,8 @@
# From: Dan Fandrich <dan at coneharvesters.com>
-# updated by Joerg Jenderek at Feb 2013 by https://de.wikipedia.org/wiki/PCX
+# updated by Joerg Jenderek at Feb 2013, Nov 2023 by https://en.wikipedia.org/wiki/PCX
# https://web.archive.org/web/20100206055706/http://www.qzx.com/pc-gpe/pcx.txt
+# URL: http://fileformats.archiveteam.org/wiki/PCX
+# Note: called "PCX image" with acronym "PiCture eXchange" by shared MIME-info database from freedesktop.org
+# verfied partly as pcx "Zsoft Paintbrush" format by XnView `nconvert -in pcx -fullinfo *.pcx` and
+# by ImageMagick version 7.1.1-21 command `identify *.pcx`
# GRR: original test was still too general as it catches xbase examples T5.DBT,T6.DBT with 0xa000000
@@ -1774,24 +1778,35 @@
>>1 ubyte <6
->>>1 ubyte !1 PCX
-!:mime image/x-pcx
-#!:mime image/pcx
->>>>1 ubyte 0 ver. 2.5 image data
->>>>1 ubyte 2 ver. 2.8 image data, with palette
->>>>1 ubyte 3 ver. 2.8 image data, without palette
->>>>1 ubyte 4 for Windows image data
->>>>1 ubyte 5 ver. 3.0 image data
->>>>4 uleshort x bounding box [%d,
->>>>6 uleshort x %d] -
->>>>8 uleshort x [%d,
->>>>10 uleshort x %d],
->>>>65 ubyte >1 %d planes each of
->>>>3 ubyte x %d-bit
->>>>68 ubyte 1 colour,
->>>>68 ubyte 2 grayscale,
+>>>1 ubyte !1
+# skip DROID fmt-89-signature-id-62.pcx fmt-88-signature-id-63.pcx fmt-87-signature-id-64.pcx fmt-86-signature-id-65.pcx with invalid dimensions
+>>>>8 long !0 PCX
+!:mime image/vnd.zbrush.pcx
+# deprecated
+#!:mime image/x-pcx
+!:ext pcx/pcc
+# also examples like: abydos.st E-DIODE.ST MUSIC-13.ST ROSE.ST
+#!:ext pcx/pcc/st
+# Note: called as "PCX bitmap (v2.5)" by TrID via bitmap-pcx.trid.xml and "PCX" version 0 by DROID via PUID fmt/86
+>>>>>1 ubyte 0 ver. 2.5 image data
+# Note: called as "PCX bitmap (v2.8, palette)" by TrID via bitmap-pcx-v28p.trid.xml and "PCX" version 2 by DROID via PUID fmt/87
+>>>>>1 ubyte 2 ver. 2.8 image data, with palette
+# Note: called as "PCX bitmap (v2.8)" by TrID via bitmap-pcx-v28.trid.xml and "PCX" version 3 by DROID via PUID fmt/88
+>>>>>1 ubyte 3 ver. 2.8 image data, without palette
+# Note: called as "PCX bitmap (Win)" by TrID via bitmap-pcx-win.trid.xml and "PCX" version 4 by DROID via PUID fmt/89
+>>>>>1 ubyte 4 for Windows image data
+# Note: called as "PCX bitmap (v3.0) by TrID via bitmap-pcx-v30.trid.xml and "PCX" version 5 by DROID via PUID fmt/90
+>>>>>1 ubyte 5 ver. 3.0 image data
+>>>>>4 uleshort x bounding box [%d,
+>>>>>6 uleshort x %d] -
+>>>>>8 uleshort x [%d,
+>>>>>10 uleshort x %d],
+>>>>>65 ubyte >1 %d planes each of
+>>>>>3 ubyte x %d-bit
+>>>>>68 ubyte 1 colour,
+>>>>>68 ubyte 2 grayscale,
# this should not happen
->>>>68 default x image,
->>>>12 uleshort >0 %d x
->>>>>14 uleshort x %d dpi,
->>>>2 ubyte 0 uncompressed
->>>>2 ubyte 1 RLE compressed
+>>>>>68 default x image,
+>>>>>12 uleshort >0 %d x
+>>>>>>14 uleshort x %d dpi,
+>>>>>2 ubyte 0 uncompressed
+>>>>>2 ubyte 1 RLE compressed
More information about the File
mailing list