[File] [PATCH] Magdir/images PCX ; mime type and extension

Christos Zoulas christos at zoulas.com
Sun Dec 10 16:12:41 UTC 2023


Committed, thanks!

christos

> On Dec 3, 2023, at 10:32 AM, Jörg Jenderek (GMX) <joerg.jen.der.ek at gmx.net> wrote:
> 
> 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
> <nconvert-pcx.txt.gz><identify-pcx.txt.gz><trid-v-pcx.txt.gz><droid-pcx.csv.gz><file-5_45-images-pcx_diff_sig.DEFANGED-0><file-5_45-images-pcx_diff.DEFANGED-1>-- 
> File mailing list
> File at astron.com
> https://mailman.astron.com/mailman/listinfo/file
> <sanitizer.log>



More information about the File mailing list