Hello,
Can anyone please tell me how can I save Jpeg that is color 24bit into
Black/White 1bit PNG ?
I saw it is possible with PhotoELF .....
I tried with :
EncoderParameters encoderParams = new EncoderParameters();
encoderParams.Param[0] =
new EncoderParameter(
System.Drawing.Imaging.Encoder.ColorDepth,(long) 1L);
ImageCodecInfo codecInfo = thumb_getEncoderInfo("image/png");
m_Bitmap.Save(saveFileDialog.FileName, codecInfo, encoderParams);
but the image is still saved as 24bit .... what do I have to do to save it
to 1bit ?
Thank You.
Kris
Michael Phillips, Jr. - 12 Mar 2008 15:30 GMT
> but the image is still saved as 24bit .... what do I have to do to save
> it to 1bit ?
Use Net 3.0 System.Windows.Media.Imaging.PngBitmapEncoder.
Add a reference to PresentationCore.dll in your project.
> Hello,
>
[quoted text clipped - 21 lines]
>
> Kris
Michael C - 13 Mar 2008 00:31 GMT
> Hello,
>
[quoted text clipped - 17 lines]
> but the image is still saved as 24bit .... what do I have to do to save
> it to 1bit ?
Most likely you will need to convert the image to 1 bit before you save it.
You will have to look into the LockBits function to do this. It's not 100%
straight forward but isn't super difficult and is a good tool to learn.
Michael
Bob Powell [MVP] - 15 Mar 2008 12:40 GMT
There is an article with code in the GDI+ FAQ.

Signature
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
> Hello,
>
[quoted text clipped - 21 lines]
>
> Kris