Page 1 of 1

Stripes?

Posted: Fri Oct 23, 2009 12:00 am
by tailormade
I have a 1-bit TIFF file that I need to save as an 8-bit greyscale TIFF. I have tried two ways:

1) Define a second greyscale bitmap and use gflBitblt to copy of one to another. Causes an Unknown format error
2) Define a second greyscale bitmap and go through pixel by pixel and use gflGetColorAt/gflSetColorAt to copy the pixels one by one.

Unfortunately the second one ends up creating a bitmap with 8 vertical strips. Each vertical strip appears to be a squished version of the original page

Here is the code I used:

Code: Select all

tBitmap = gflAllockBitmap(GFL_GREY, wid, hgt, 4, NULL);
for (ix = 0; ix < wid; ix++)
	for (iy = 0; iy < hgt; iy++)
		{
		GFL_COLOR color;
		error = gflGetColorAt(bitmap, ix, iy, &color);
		if (error)
			DisplayGflError("", error);
		error = gflSetColorAt(tBitmap, ix, iy, &color);
		if (error)
			DisplayGflError("", error);
		}

Re: Stripes?

Posted: Fri Oct 23, 2009 3:45 pm
by xnview
tailormade wrote: 2) Define a second greyscale bitmap and go through pixel by pixel and use gflGetColorAt/gflSetColorAt to copy the pixels one by one.
Ok, right there is a little bug.
Why you don't use gflChangeColorDepth?

Re: Stripes?

Posted: Fri Oct 23, 2009 9:52 pm
by tailormade
Because I need to go from 1-bit to 8-bit grey. At least according to the documentation gflChangeColorDepth only allows you to reduce the number of colors, not increase it.

Re: Stripes?

Posted: Sat Oct 24, 2009 12:25 pm
by xnview
tailormade wrote:Because I need to go from 1-bit to 8-bit grey. At least according to the documentation gflChangeColorDepth only allows you to reduce the number of colors, not increase it.
No, you can increase too

Re: Stripes?

Posted: Wed Oct 28, 2009 10:53 pm
by tailormade
What parameter do you use to go from 1-bit to 8-bit greyscale?

Re: Stripes?

Posted: Thu Oct 29, 2009 8:12 am
by xnview
tailormade wrote:What parameter do you use to go from 1-bit to 8-bit greyscale?
GFL_MODE_TO_RGB