[File] [PATCH] of Magdir/images for OS/2 2.x bitmap variant ( *.bmp)
Jörg Jenderek
joerg.jen.der.ek at gmx.net
Sat Jun 29 23:46:49 UTC 2019
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
some days ago i handle some OS/2 2.x bitmap variant with file name
extension "bmp". When i run file command version 5.37 for these
examples i get an output like
JUR_OS2.BMP: PC bitmap, OS/2 2.x format, 640 x 0
pal1huff.bmp: PC bitmap, OS/2 2.x format, 127 x 0
pal8os2v2-sz.bmp: PC bitmap, OS/2 2.x format, 127 x 0
pal8os2v2.bmp: PC bitmap, OS/2 2.x format, 127 x 0
TEAMcol-64.bmp: PC bitmap, OS/2 2.x format, 518 x 0
TOWERBMP.BMP: PC bitmap, OS/2 2.x format, 58 x 0
Obviously the shown size for height with value 0 is
wrong.Furthermore with -i option deprecated mime type
"image/x-ms-bmp" isshown. With --apple option UNKNUNKN is displayed.
With --extesion option ??? is displayed.
So i add/change lines in Magdir/images. The information about this
variants is found on Wikipedia page about BMP format already
mentioned in magic file.
According to Wikipedia the DIB header use a format named
OS22XBITMAPHEADER. This OS/2 BMP format stores stores 64 bytes in the
DIB header. This variant was recognized by lines starting with
0 string BM
>14 leshort 64 PC bitmap, OS/2 2.x format
Now afterwards show file name extension, apple id and new mime type
for BMP bitmaps by lines
!:mime image/bmp
!:apple ????BMPp
!:ext bmp
The image dimensions were shown by lines like
>>18 leshort x \b, %d x
>>20 leshort x %d
The width and height are stored as short variable only for OS/2 1.x
variant, whereas for OS/2 2.x variant dimension values are stored as 4
byte values.
For OS/2 image width and height fields are unsigned integers whereas
for Microsoft Windows variants signed integers are used.
Values for number of bits per pixel (color depth) found are 1 4 8. So
show this values only if not one.
>>18 ulelong x \b, %u x
>>22 ulelong x %u
>>28 uleshort >1 x %u
The stored x, y coordinates of the hot spot are often null, but not
for example TOWERBMP.BMP. So show these values if not null by lines
>>6 uleshort >0 \b, hotspot %ux
>>>8 uleshort x \b%u
The variable cbSize now contains sometimes the size of the whole file
and sometimes the size of the headers. So show this value by line
>>2 ulelong x \b, cbSize %u
After applying the above mentioned modifications by patch
file-5.37-images-bmp_os2v2.diff then OS/2 2.x bitmap
variants are now described with correct height like
JUR_OS2.BMP: PC bitmap, OS/2 2.x format, 640 x 400 x 4,
cbSize 78, bits offset 94
pal1huff.bmp: PC bitmap, OS/2 2.x format, 127 x 64,
cbSize 78, bits offset 86
pal8os2v2-sz.bmp: PC bitmap, OS/2 2.x format, 127 x 64 x 8,
cbSize 78, bits offset 1086
pal8os2v2.bmp: PC bitmap, OS/2 2.x format, 127 x 64 x 8,
cbSize 9278, bits offset 1086
TEAMcol-64.bmp: PC bitmap, OS/2 2.x format, 518 x 412 x 4,
cbSize 107194, bits offset 201326686
TOWERBMP.BMP: PC bitmap, OS/2 2.x format, 58 x 79 x 4,
hotspot 29x39,
cbSize 78, bits offset 142
I hope my diff file can be applied in future version of file utility.
With best wishes
Jörg Jenderek
- --
Jörg Jenderek
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
iF0EARECAB0WIQS5/qNWKD4ASGOJGL+v8rHJQhrU1gUCXRf4YAAKCRCv8rHJQhrU
1uoIAJ429YMqskM1TYIAl0VAHHgYe1rrogCgtnppk37aoUPBqpqnnGvyngc5MIQ=
=ogR2
-----END PGP SIGNATURE-----
-------------- next part --------------
--- file-5.37/magic/Magdir/images.old 2019-04-19 00:42:27 +0000
+++ file-5.37/magic/Magdir/images 2019-06-28 23:56:19 +0000
@@ -580,5 +580,21 @@
>14 leshort 64 PC bitmap, OS/2 2.x format
-!:mime image/x-ms-bmp
->>18 leshort x \b, %d x
->>20 leshort x %d
+!:mime image/bmp
+!:apple ????BMPp
+!:ext bmp
+# image width and height fields are unsigned integers for OS/2
+>>18 ulelong x \b, %u x
+>>22 ulelong x %u
+# number of bits per pixel (color depth); found 1 4 8
+>>28 uleshort >1 x %u
+# x, y coordinates of the hotspot
+>>6 uleshort >0 \b, hotspot %ux
+>>>8 uleshort x \b%u
+>>26 uleshort >1 \b, %u color planes
+# cbSize; size of file or headers
+>>2 ulelong x \b, cbSize %u
+#>>2 ulelong x \b, cbSize 0x%x
+# offBits; offset to bitmap data like 56h 5Eh 8Eh 43Eh
+>>10 ulelong x \b, bits offset %u
+#>>10 ulelong x \b, bits offset 0x%x
+#>>(10.l) ubequad !0 \b, bits 0x%16.16llx
>14 leshort 40 PC bitmap, Windows 3.x format
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-5.37-images-bmp_os2v2.diff.sig
Type: application/octet-stream
Size: 95 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20190630/4ec689ab/attachment.obj>
More information about the File
mailing list