Calamus Raster Graphic

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
(Software)
m (Change telparia.com samples link to template)
 
(6 intermediate revisions by 3 users not shown)
Line 10: Line 10:
 
== Identification ==
 
== Identification ==
 
CRG files apparently begin with the ASCII signature "{{magic|CALAMUSCRG}}".
 
CRG files apparently begin with the ASCII signature "{{magic|CALAMUSCRG}}".
 +
 +
== Format details ==
 +
''[Partial decoding, based on analysis of a small number of CRG files. This may be incorrect.]''
 +
 +
Multi-byte integers are big-endian.
 +
 +
{| class="wikitable"
 +
! Offset !! Length !! Field !! Observed values !! Details
 +
|-
 +
|0 || 10 || signature || "<code>CALAMUSCRG</code>" ||
 +
|-
 +
|10 || 2 || || <code>03 e8</code> || Unknown. By analogy to [[Calamus Vector Graphic|CVG]], maybe a code for the format version.
 +
|-
 +
|12 || 2 || || <code>00 02</code> || Unknown. By analogy to CVG, maybe a code for the page size.
 +
|-
 +
|14 || 4 || || (file size, minus 24) ||
 +
|-
 +
|18 || 2 || || <code>00 80</code> || Unknown
 +
|-
 +
|20 || 4 || width || || Image width in pixels
 +
|-
 +
|24 || 4 || height || || Image height in pixels
 +
|-
 +
|28 || 4 || || (various) || Unknown
 +
|-
 +
|32 || 1 || || <code>01</code> || Unknown
 +
|-
 +
|33 || 1 || || <code>00</code> || Unknown
 +
|-
 +
|34 || 4 || || <code>ff ff ff ff</code> || Unknown
 +
|-
 +
|38 || 4 || cmpr_size || || Size of compressed image data, in bytes
 +
|-
 +
|42 || cmpr_size || cmpr_image_data || || Compressed image data (see below)
 +
|}
 +
 +
=== RLE compression ===
 +
The compressed data consists of a code byte, followed by one or more data bytes, followed by another code byte, and so on. To decompress:
 +
{| class="wikitable"
 +
! Code byte (N) !! Instructions
 +
|-
 +
|N ≤ 127 || Emit the next N 1 bytes literally.
 +
|-
 +
|N ≥ 128 || Emit the next byte N−127 times.
 +
|}
 +
 +
(This is essentially the same algorithm as in [[TGA]], but byte-oriented instead of pixel-oriented.)
 +
 +
After decompression, pixels are in left-to-right, top-to-bottom order. The format is 8 pixels per byte, most significant bit first, white is 0. Rows are padded to the next byte boundary.
  
 
== Software ==
 
== Software ==
 +
* [[Konvertor]]
 
* [[XnView]] (Does not seem to work perfectly.)
 
* [[XnView]] (Does not seem to work perfectly.)
 
* {{Deark}} supports some CRG files
 
* {{Deark}} supports some CRG files
 +
* [[RECOIL]]
  
 
== Sample files ==
 
== Sample files ==
 
* http://cd.textfiles.com/suzybatari2/new_file/extras/dtp/calamus/cal_pics/
 
* http://cd.textfiles.com/suzybatari2/new_file/extras/dtp/calamus/cal_pics/
 +
* {{DexvertSamples|image/crg}}

Latest revision as of 02:57, 28 December 2023

File Format
Name Calamus Raster Graphic
Ontology
Extension(s) .crg

Calamus Raster Graphic (CRG) is a graphics format associated with the Calamus desktop publishing software by invers Software. At least some CRG images are compressed using a simple run-length encoding scheme.

Refer to Calamus for more information about the software, and related formats.

Contents

[edit] Identification

CRG files apparently begin with the ASCII signature "CALAMUSCRG".

[edit] Format details

[Partial decoding, based on analysis of a small number of CRG files. This may be incorrect.]

Multi-byte integers are big-endian.

Offset Length Field Observed values Details
0 10 signature "CALAMUSCRG"
10 2 03 e8 Unknown. By analogy to CVG, maybe a code for the format version.
12 2 00 02 Unknown. By analogy to CVG, maybe a code for the page size.
14 4 (file size, minus 24)
18 2 00 80 Unknown
20 4 width Image width in pixels
24 4 height Image height in pixels
28 4 (various) Unknown
32 1 01 Unknown
33 1 00 Unknown
34 4 ff ff ff ff Unknown
38 4 cmpr_size Size of compressed image data, in bytes
42 cmpr_size cmpr_image_data Compressed image data (see below)

[edit] RLE compression

The compressed data consists of a code byte, followed by one or more data bytes, followed by another code byte, and so on. To decompress:

Code byte (N) Instructions
N ≤ 127 Emit the next N 1 bytes literally.
N ≥ 128 Emit the next byte N−127 times.

(This is essentially the same algorithm as in TGA, but byte-oriented instead of pixel-oriented.)

After decompression, pixels are in left-to-right, top-to-bottom order. The format is 8 pixels per byte, most significant bit first, white is 0. Rows are padded to the next byte boundary.

[edit] Software

[edit] Sample files

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox