Page 1 of 1

Grayscaling a bitonal image

Posted: Thu Nov 29, 2007 10:07 pm
by gcorgnet
Hi,

I have a set of bitonal images (TIFF). I would like to send them to the browser. For that, I can convert them into GIF (or PNG). I am using ASP.NET / C#.

This works properly with GDI+ (No need for your ActiveX control)

Now, what I would like to achieve is grayscaling those images on-the-fly so the look better in the browser. I know this is possible (a lot of software do it, for example Windows Picture & Fax Viewer)

Do you think this would be possible using GdPicture ?
I tried the SetGrayScale method but obviously this one is to grayscale colored images only ...

Any idea ?

Thanks

Guillaume

Posted: Fri Nov 30, 2007 12:20 pm
by Loïc
Hi Guillaume,

You have many ways to do that with gdpicture.

I give you a simple one:

Code: Select all

Call Imaging1.ConvertTo24BppRGB
Call Imaging1.Imaging1.SetSoftenEffect(100)

Is this good for your need ?

Regards,

Loïc

Thanks Loic

Posted: Fri Nov 30, 2007 12:24 pm
by gcorgnet
I'll test that and let you know how it goes ...

Cheers


Guillaume

Posted: Fri Nov 30, 2007 4:43 pm
by Loïc
Ok thanks.

In the next release i will add a ConvertBitonalToGrayScale() method in order to convert falstly bitonal images to gray scale images.


Loïc

It works

Posted: Sun Dec 02, 2007 8:10 pm
by gcorgnet
Hi Loic,

The solution you gave me works pretty well.

Converting to 24bp didn't give a perfect results (dots appearing on the document), but I tried converting to 8bppAdv and it looks pretty good.

Thanks a lot for that !

Guillaume

Posted: Sun Dec 02, 2007 8:15 pm
by Loïc
Guillaume thanks for your feed back.

Like I said in my previous post, I will add into the next release a new ConvertBitonalToGrayScale() method which will fastly convert a 1bpp image to high quality grayscaled 8bpp image.

Regards,

Loïc

Thanks

Posted: Sun Dec 02, 2007 8:34 pm
by gcorgnet
I look forward to that ...

Guillaume


PS: Any reason why we can't save an image as an array while converting it to pdf (accepted values are only "bmp", "gif", "png", ...) ?