[File] [PATCH] of Magdir/images ImageLab bitmap *.b_w *.b&w

Jörg Jenderek joerg.jen.der.ek at gmx.net
Tue Apr 27 15:27:16 UTC 2021

some days ago my system with Windows 10 updates itself. When checking
the system with ccleaner many file name associations are now broken.
So i look for the reported filename extension.

One file name extension is B_W. So i run file command version 5.40 on
such examples and related files. The examples are only described as

For comparison reason i run the file format identification utility
TrID ( See https://mark0.net/soft-trid-e.html). This describes these
examples as "ImageLab bitmap" by definition bitmap-b_w.trid.xml (See
appended b_w_trid-v.txt.gz ). It also displays used file name
extensions "B_W".

Some information about this bitmap file format can be found on file
formats archive team web site. This is now expressed by additional
remark line after Atari section inside Magdir/images like:
  # URL:	http://fileformats.archiveteam.org/wiki/ImageLab/PrintTechnic

According to documentation such bitmaps start with ASCII like
"B.W256". So the examples are identified by magic line like:
  0	string		B&W256	ImageLab bitmap

The mentioned file name extensions are expressed by line like
  !:ext	b_w/b&w
Unfortunately this gives an error message like:
  Magdir\images, 1090: Warning:
  EXTENSION type `        b_w/b&w' has bad char '&'
So i add ampersand char "&" inside parse_ext in src/apprentice.c.
I hope that this is sufficient.

Instead of generic mime type "application/octet-stream" i display a
user defined one. That is done by line like:
  !:mime	image/x-ilab

On the documentation site some download links for more examples are
mentioned. Furthermore there software like XnView is mentioned that
can handle such images. With the help of the command line tool i was
able to verify information by shell line like:
	nconvert -fullinfo "MAEDCHEN.B&W"
This reports also the Width and the Height of the images. So i see
that the image dimension are stored after the starting magic. So i
show that information by lines like:
  >6	ubeshort	x	\b, %u
  >8	ubeshort	x	x %u

After applying the above mentioned modifications by patch
file-5.40-images-b_w.diff and file-5.40_apprentice-ampersand.diff
then such images are now described like:

abydos.b_w:   ImageLab bitmap, 640 x 480
LEGS.B_W:     ImageLab bitmap, 204 x 295
MAEDCHEN.B&W: ImageLab bitmap, 256 x 320

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 --------------
--- file-5.40/magic/Magdir/images.old	2021-02-22 23:49:24 +0000
+++ file-5.40/magic/Magdir/images	2021-04-27 15:19:00 +0000
@@ -1079,6 +1079,22 @@
 # https://www.atarimax.com/jindroush.atari.org/afmtatr.html
 0	leshort	0x0296		Atari ATR image
+# From:		Joerg Jenderek
+# URL:		http://fileformats.archiveteam.org/wiki/ImageLab/PrintTechnic
+# Reference:	http://mark0.net/download/triddefs_xml.7z/defs/b/bitmap-b_w.trid.xml
+# Note:		called "ImageLab bitmap" by TrID
+#		verfied by XnView `nconvert -fullinfo "MAEDCHEN.B&W"`
+0	string		B&W256	ImageLab bitmap
+!:mime	image/x-ilab
+#	https://www.xnview.com/de/image_formats/
+# GRR: add char & inside parse_ext in ../../src/apprentice.c to avoid in file version 5.40 error like:
+# Magdir\images, 1090: Warning: EXTENSION type `        b_w/b&w' has bad char '&'
+!:ext	b_w/b&w
+# Width
+>6	ubeshort	x	\b, %u
+# Height
+>8	ubeshort	x	x %u
 # XXX:
 # This is bad magic 0x5249 == 'RI' conflicts with RIFF and other
 # magic.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: file-5.40-images-b_w.diff.sig
Type: application/octet-stream
Size: 95 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20210427/d3fadab2/attachment.obj>
-------------- next part --------------
--- file-5.40/src/apprentice.c.old	2021-02-23 01:51:11.000000000 +0100
+++ file-5.40/src/apprentice.c	2021-04-27 15:02:37.160594792 +0200
@@ -2412,7 +2412,7 @@
 	return parse_extra(ms, me, line, len,
 	    CAST(off_t, offsetof(struct magic, ext)),
-	    sizeof(m->ext), "EXTENSION", ",!+-/@?_$", 0);
+	    sizeof(m->ext), "EXTENSION", ",!+-/@?_$&", 0); /* & for b&w */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: b_w_trid-v.txt.gz
Type: application/x-gzip
Size: 487 bytes
Desc: not available
URL: <https://mailman.astron.com/pipermail/file/attachments/20210427/d3fadab2/attachment.bin>

More information about the File mailing list