comp.graphics.algorithms
Subject: Re: 8bit to 1 bit
Rahul wrote:
> That does not work, it results in 8 pixel spaces between two black
> pixels. I think I need a way to pack 24 * 8 bits into 3 * 8 bits ?
Eh? Yes, after you reduce the 8 bit pixel to 1 bit (Thresholding, error
diffusion), you store that 1 bit value, not a whole byte. I don't know
what language that you're using, but in Pascal (Untested):
var x,destx,subx:integer;
source:array[0..79] of byte;
dest:array[0..9] of byte;
subx:=7;
destx:=0;
for x:=0 to 79 do begin
if source[x]>128 then
dest[destx]:=dest[destx] or (1 shl subx)
else
dest[destx]:=dest[destx] and not (1 shl subx)
subx:=subx-1;
if subx<0 then begin
subx:=7;
destx:=destx+1;
end;
end;
Cheers,
Nicholas Sherlock
--
http://www.sherlocksoftware.org
Reply
View All Messages in comp.graphics.algorithms
path:
8bit to 1 bit =>Re: 8bit to 1 bit =>Re: 8bit to 1 bit =>
Replies:
Copyright © 2006 WatermarkFactory.com. All Rights Reserved.


