<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.temlib.org/AtariForumWiki/index.php?action=history&amp;feed=atom&amp;title=GEM_Bit_Image_file_format</id>
	<title>GEM Bit Image file format - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.temlib.org/AtariForumWiki/index.php?action=history&amp;feed=atom&amp;title=GEM_Bit_Image_file_format"/>
	<link rel="alternate" type="text/html" href="https://www.temlib.org/AtariForumWiki/index.php?title=GEM_Bit_Image_file_format&amp;action=history"/>
	<updated>2026-07-26T17:08:39Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.2</generator>
	<entry>
		<id>https://www.temlib.org/AtariForumWiki/index.php?title=GEM_Bit_Image_file_format&amp;diff=13461&amp;oldid=prev</id>
		<title>&gt;Lp: New page</title>
		<link rel="alternate" type="text/html" href="https://www.temlib.org/AtariForumWiki/index.php?title=GEM_Bit_Image_file_format&amp;diff=13461&amp;oldid=prev"/>
		<updated>2017-01-03T00:14:41Z</updated>

		<summary type="html">&lt;p&gt;New page&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
GEM Bit Image   *.IMG&lt;br /&gt;
 &lt;br /&gt;
1 word          version number of image file [1]&lt;br /&gt;
1 word          length of header in words [usually 8]&lt;br /&gt;
1 word          number of color planes [1 for monochrome]&lt;br /&gt;
1 word          pattern length in bytes [1-8, usually 2 for screen images]&lt;br /&gt;
1 word          pixel width in microns (1/1000 mm, 25400 microns per inch)&lt;br /&gt;
1 word          pixel height in microns&lt;br /&gt;
1 word          line width in pixels&lt;br /&gt;
1 word          number of lines&lt;br /&gt;
-------&lt;br /&gt;
? words         header length defined in 2nd word of header&lt;br /&gt;
 &lt;br /&gt;
? bytes         data&lt;br /&gt;
 &lt;br /&gt;
NOTES:  If the image is a color image (planes &amp;gt; 1), the planes are stored&lt;br /&gt;
separately starting with plane 0.  There is, however, no standard way of&lt;br /&gt;
storing the color palette.  Some programs may save the palette in separate&lt;br /&gt;
files, some may extend the header.  For this reason, you should never&lt;br /&gt;
assume the header is 8 words long, always get the header length from the&lt;br /&gt;
2nd word of the header.  Also, the line width in the 7th word is the number&lt;br /&gt;
of pixels in a line.  Since the data is encoded in byte-wide packets, the&lt;br /&gt;
actual unpacked line width is always a multiple of 8, and may be 1-7 pixels&lt;br /&gt;
longer than the length specified in the header.&lt;br /&gt;
&lt;br /&gt;
For each byte x in the data section,&lt;br /&gt;
 &lt;br /&gt;
        x = 0           Pattern/scanline run.&lt;br /&gt;
                        Read the next byte, n (unsigned).&lt;br /&gt;
 &lt;br /&gt;
                        If n &amp;gt; 0 then:&lt;br /&gt;
                                Read a number of bytes equal to the &amp;quot;pattern&lt;br /&gt;
                                length&amp;quot; word in the header.  Repeat this&lt;br /&gt;
                                pattern n times.&lt;br /&gt;
 &lt;br /&gt;
                        If n = 0 then:&lt;br /&gt;
                                Scanline run.  Data for the next scanline&lt;br /&gt;
                                is to be used multiple times.  Read the&lt;br /&gt;
                                following record:&lt;br /&gt;
 &lt;br /&gt;
                                1 byte          flag byte [$FF]&lt;br /&gt;
                                1 byte          number of times to use&lt;br /&gt;
                                                next scanline data&lt;br /&gt;
 &lt;br /&gt;
                                The data for the next scanline follows,&lt;br /&gt;
                                compressed normally.&lt;br /&gt;
 &lt;br /&gt;
        x = 80 (hex)    Uncompressed bit string.  The next byte&lt;br /&gt;
                        determines the number of bytes to use&lt;br /&gt;
                        literally.  The literal data bytes follow.&lt;br /&gt;
 &lt;br /&gt;
        otherwise       Solid run.  The value of x determines&lt;br /&gt;
                        what to draw.  The high bit specifies whether&lt;br /&gt;
                        the pixels are set or cleared.  A 1 indicates&lt;br /&gt;
                        a byte-run using $FF, a 0 indicates a byte-run&lt;br /&gt;
                        using $00.  The low 7 bits, taken as an unsigned&lt;br /&gt;
                        quantity, specify the length of the run in bytes.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Back to [[ST Picture Formats]]&lt;/div&gt;</summary>
		<author><name>&gt;Lp</name></author>
	</entry>
</feed>