PCX file manipulation

PCX file manipulation

Post by Doug Kel » Sun, 06 Jan 1991 01:05:40



Hello, I need to manipulate an image file created by a color scanner.  I
read the commonly asked questions file here, and downloaded the infor for
pcx, and tiff file formats.  The tiff is toooooo complicated for my task, so
i decided to use pcx.  I have one quick question concerning the compression
technique involved... As i understand it, the compression is like so:

read X
if X and 192 then
        read Y  
        duplicate Y (X and 63) times
else
        duplicate X one time
end if

Well this is fine but i have one problem, my scanner is 24 bit color, ie
8 bits in RGB.  So, how do i know if the X i read is really a duplicate coding
or just a real singular value of X?

Thanks for any help on this, and sorry if it's a stupid question...

Doug Kelly

 
 
 

PCX file manipulation

Post by Patrick R. Go » Sun, 06 Jan 1991 02:14:31


Excuse me if this is a commonly asked question, but I just signed up
to this group very recently (I did see the monthly posting).
I need a program to convert formats (PICT to GIF) but I don't
have a C compiler, or access to one.
Is there someplace where those nice sounding picture tools are compiled
is a format compatable with MSDOS?
I have not yet been able to FTP to all of the sites listed (I get some
"Connections timed out" messages), but all those I have seen have only
the source code.
Could someone point me in the right direction?

Thanks.
Patrick Gold

--
Any resemblance between the opinions expressed above and the opinions of any
person, group of persons, corporate entities, alien life forms, sentient
computers, etc. are purely coincidental. :-)

 
 
 

PCX file manipulation

Post by josef Moelle » Wed, 09 Jan 1991 18:34:51



Quote:>Hello, I need to manipulate an image file created by a color scanner.  I
>read the commonly asked questions file here, and downloaded the infor for
>pcx, and tiff file formats.  The tiff is toooooo complicated for my task, so
>i decided to use pcx.  I have one quick question concerning the compression
>technique involved... As i understand it, the compression is like so:
>read X
>if X and 192 then
>    read Y  
>    duplicate Y (X and 63) times
>else
>    duplicate X one time
>end if
>Well this is fine but i have one problem, my scanner is 24 bit color, ie
>8 bits in RGB.  So, how do i know if the X i read is really a duplicate coding
>or just a real singular value of X?
>Thanks for any help on this, and sorry if it's a stupid question...

There are no stupid questions, only stupid answers (I sincerely hope
this is no stupid answer B-{)!

The decoding is as follows (I use C-notation):

X = nextbyte();
if ((X & 0xc0) == 0xc0)     /* NOTE: 2 MSBs must both be 1! */
{
        Y = nextbyte();
        for (i = 0; i < (X & 0x3f); i++) /* sub-optimal */
                putbyte(Y);

Quote:}

else
        putbyte(X);

Now, when encoding, You must take care that You do not generate the
"repeat" code by mistake, so

X = nextbyte();
if ((X & 0xc0) == 0xc0)
        putbyte(0xc1);  /* repeat next byte 1 times */
putbyte(X);

The main idea is that whenever a repeat code is seen during decoding,
the next byte is repeated no matter what it's code, i.e. You cannot have
nested repeats! If You want more than 63 repeats, You'll have to do two
or more repeats, e.g.
                0xff 0x00 0xff 0x00
will repeat 0x00 126 times.

Hope this helps!
--
| Josef Moellers                | c/o Siemens Nixdorf Informationssysteme AG |


| Phone: (+49) 5251 104662      | D-4790 Paderborn                           |

 
 
 

1. EXAMPLES WANTED : .PCX manipulation

Hey,

I am looking for some (good) source code (c preferably) that
will show show me how to manipulate (e.g. noise removal) .PCX
files (monochrome images preferred). If you have and want to
share or know where I could find such a thing, please let me
know. Simple or complicated examples are ok.

Thanks
------
--
=====================================================
| Mike Zeitzew                                      |

|-------------- TELEPHONE : (213) 651-5191 ---------|

2. convex decomposition of 3D polyhedra

3. Combining two .pcx files into 1 .pcx

4. SDL--->Wire

5. Anyway to convert a PAT file to a CPT file?

6. Figuring out file size of pcx files

7. Anyone using 1600x1200 on a 21" monitor?

8. DOS command line program to print Tiff group 4 file or convert to .pcx file

9. program to convert IBM PC's TIFF, PCX, BMP graphics file to Amiga IFF files

10. PCX files to Animation file