Skip to content

Commit

Permalink
1 bit invert bug out
Browse files Browse the repository at this point in the history
  • Loading branch information
MalcolmMcLean committed May 16, 2018
1 parent e1a1d8e commit 4e00732
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions loadtiff.c
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,7 @@ static int planetochannel(unsigned char *out, int width, int height, unsigned ch
{
val = getbits(bs, header->bitspersample[sample_index]);
val = (val * 255) / ((1 << header->bitspersample[sample_index]) - 1);

*out++ = val;
}
synchtobyte(bs);
Expand Down Expand Up @@ -1458,6 +1459,8 @@ static int greytogrey(unsigned char *grey, int width, int height, unsigned char
{
int val = getbits(bs, header->bitspersample[0]);
grey[0] = (val * 255) / ((1 << (header->bitspersample[0])) -1);
if(header->photometricinterpretation == PI_WhiteIsZero)
grey[0] = 255 - grey[0];
if(insamples == 2 && header->samplesperpixel > 1 )
{
val = getbits(bs, header->bitspersample[1]);
Expand Down

0 comments on commit 4e00732

Please sign in to comment.