Deark demonstration

Note: Deark is not intended for mission-critical uses. It’s there if you need it, but despite this demo, you really shouldn’t use it to deal with difficult formats like tar or gzip, when a better option is available.

Plug: Deark is self-contained. It’s not a script or something that just runs other programs.

This demo assumes you’re using a Unix-like shell. From a Windows command prompt, you can still run the “deark” commands, but the other commands probably won’t work.

We’ll make a scratch directory, and download an old and possibly-interesting file that I found on the internet. (If this link is broken, do a web search for “fbm-1.2.tgz”.)

$ mkdir dtest
$ cd dtest
~/dtest $ wget 'http://ibiblio.org/pub/linux/apps/graphics/convert/fbm-1.2.tgz'

What sort of file is it? Let’s ask the “file” utility:

~/dtest $ file fbm-1.2.tgz
fbm-1.2.tgz: gzip compressed data ...

It’s a gzipped file. We could use GNU gzip, or another gzip decoder. But we could also use Deark:

~/dtest $ deark fbm-1.2.tgz
Module: gzip
Writing output.000.fbm1.2.tar

We’ve extracted a file that Deark has named “output.000.fbm1.2.tar”. (It’s a bit odd that the “-” symbol in “fbm-1.2” has disappeared, but Deark did not remove it. For unknown reasons, the internal name of the file does not include the “-” symbol.)

What kind of file is it?

~/dtest $ file output.000.fbm1.2.tar
output.000.fbm1.2.tar: tar archive

No surprise; it’s a “tar” archive. We could use GNU tar, or another tar extractor. But we could also use Deark.

First, let’s see what’s in the file. I expect that it might contain lots of files, so I’ll use the -l option, and the “head” utility, to list only the first few files.

~/dtest $ deark output.000.fbm1.2.tar -l | head
Module: tar
output.000.Features
output.001.README
output.002.Makefile
output.003.FTP
output.004.GLOSSARY
output.005.test.clr.Z.uu
output.006.clr2gray.1
output.007.fbcat.1
output.008.fbclean.1

That “005” file looks interesting. Let’s extract it.

~/dtest $ deark output.000.fbm1.2.tar -get 5
Module: tar
Writing output.005.test.clr.Z.uu

What kind of file is it?

~/dtest $ file output.005.test.clr.Z.uu
output.005.test.clr.Z.uu: uuencoded or xxencoded, ASCII text

We could go find a uuencode/xxencode utility. Or we could see what Deark thinks of it:

~/dtest $ deark output.005.test.clr.Z.uu
Module: uuencode
Format: Uuencoded
Writing output.000.test.clr.Z

And now what do we have?

~/dtest $ file output.000.test.clr.Z
output.000.test.clr.Z: compress'd data 16 bits

It’s a “compress'd” file. Whatever that is. What are we going to do now?

(Right. We have to go deeper.)

Here’s an idea. We could use Deark:

~/dtest $ deark output.000.test.clr.Z
Module: compress
Writing output.000.bin

I admit, this is an annoyance. We can see that the original filename was “test.clr”. But Deark doesn’t know that. It really only cares about the contents of files, not their names, and “test.clr” was not in the contents of the “output.000.test.clr.Z” file. (Primitive file formats are primitive.)

Maybe a future version of Deark will have a way to better deal with this. But for now, for clarity, let’s just manually rename it:

~/dtest $ mv output.000.bin test.clr

What kind of a file is test.clr?

~/dtest $ file test.clr
test.clr: Sun raster image data, 320 x 420, 8-bit, RGB colormap

It’s a “Sun raster image” file. Okay.

If you know something about image formats or web searching, you might be able to figure out that we can now use the “rasttopnm” and “pamtopng” utilities from the Netpbm software. But there is another option. We could use Deark. This time, just as an example, let’s also use the -d option, to print detailed information about the file.

~/dtest $ deark -d test.clr
DEBUG: Input file: test.clr
Module: sunras
DEBUG: header at 0
DEBUG:  dimensions: 320x420
DEBUG:  depth: 8
DEBUG:  image type=1, len=134400
DEBUG:  map type=1, len=768
DEBUG: colormap at 32
DEBUG: image data at 800
Writing output.000.png

Finally, Deark has converted the file to a mainstream format that almost anything can deal with: PNG.

test.clr (as output.000.png)

[Back to main Deark page]