[comp.graphics] shrinking a bitmap by 3

DeadHead@cup.portal.com (Bruce M Ong) (07/26/90)

I am writing a program that would shrink a bi-level bitmap by three.
The original image is 1728 pixels wide (fax) and has 2050 scanlines. Does
anybody know a quick algorithm to do this? My original approach is to 
take 3 bits at a time and if there are two black bits, then the resultant
bit will be set, otherwise the resultant bit is a white bit. The image is
not shrunk vertically.  However, this is tooo slow...

any pointers, text books, etc., would be much appreciated...
 
thanks -

bruce
deadhead@cup.portal.com

scott@tekcrl.LABS.TEK.COM (Scott Huddleston) (07/26/90)

In article <32071@cup.portal.com> DeadHead@cup.portal.com (Bruce M Ong) writes:
.>I am writing a program that would shrink a bi-level bitmap by three.
.>... My original approach is to 
.>take 3 bits at a time and if there are two black bits, then the resultant
.>bit will be set, otherwise the resultant bit is a white bit. The image is
.>not shrunk vertically.  However, this is tooo slow...

Sounds like you want table lookup.  Grab 12 bits at a time and index into
a table giving the 4 shrunk bits.  Precompute your table for all possible
12-bit combinations.
-- 
Scott Huddleston
scott@crl.labs.tek.com