Click here to Skip to main content
15,891,004 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
Generalactive-x objects as images Pin
Anonymous15-Jul-05 1:05
Anonymous15-Jul-05 1:05 
GeneralVolume Levels in C++.Net Pin
MeIsANerd14-Jul-05 9:15
MeIsANerd14-Jul-05 9:15 
GeneralNeed .Net WebServices benchmark tool Pin
KeepSmilin14-Jul-05 0:19
KeepSmilin14-Jul-05 0:19 
GeneralRe: Need .Net WebServices benchmark tool Pin
Dave Kreskowiak14-Jul-05 4:37
mveDave Kreskowiak14-Jul-05 4:37 
GeneralRe: Need .Net WebServices benchmark tool Pin
Anonymous14-Jul-05 13:53
Anonymous14-Jul-05 13:53 
GeneralViewing TIFF files Pin
LasVegasGuy13-Jul-05 13:22
LasVegasGuy13-Jul-05 13:22 
GeneralRe: Viewing TIFF files Pin
sarabjs15-Jul-05 4:03
sarabjs15-Jul-05 4:03 
GeneralImage Binarization Pin
sarabjs13-Jul-05 7:07
sarabjs13-Jul-05 7:07 
I load an image, convert it to bitmapData using the 24bppRGB pixel format, binarize it using a simple routine (shown below) and save it using the Image.Save() method. The image saved however is still 24bppRGB - although all colours have the same value, either 0 or 255 - and shows up as an RGB image in Photoshop.

Any ideas on how I can change it to binary, ie a 1bpp format?

Code:
------

Bitmap bMap=new Bitmap (iMage);
BitmapData bData = bMap.LockBits(new Rectangle(0, 0, bMap.Width, bMap.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
System.IntPtr Scan0 = bData.Scan0;
int iStride=bData.Stride;
int iht=bMap.Height;
int iwd=bMap.Width;
int iPix=new int[iht][];
unsafe
{
byte *p = (byte*)(void*)Scan0;
int nOffset = iStride-iwd*3;
for(int y=0;y<iht;++y)
{
iPix[y]=new int[iwd];
for(int x=0;x<iwd;++x)
{
if (conditionA) p[0]=p[1]=p[2]=0;
else p[0]=p[1]=p[2]=255;
p += 3;
}
p += nOffset;
}
}
bMap.UnlockBits(bData);

bMap.Save(fileName);
GeneralRe: Image Binarization Pin
Christian Graus13-Jul-05 12:41
protectorChristian Graus13-Jul-05 12:41 
GeneralRe: Image Binarization - Solution found Pin
sarabjs14-Jul-05 3:55
sarabjs14-Jul-05 3:55 
GeneralRe: Image Binarization - Solution found Pin
Christian Graus14-Jul-05 11:11
protectorChristian Graus14-Jul-05 11:11 
GeneralRe: Image Binarization - Solution found Pin
sarabjs15-Jul-05 3:58
sarabjs15-Jul-05 3:58 
GeneralRe: Image Binarization - Solution found Pin
Christian Graus17-Jul-05 12:58
protectorChristian Graus17-Jul-05 12:58 
GeneralRe: Image Binarization - Solution found Pin
sarabjs20-Jul-05 5:07
sarabjs20-Jul-05 5:07 
GeneralCopying Object Types Pin
SamM13-Jul-05 6:14
SamM13-Jul-05 6:14 
GeneralRe: Copying Object Types Pin
S. Senthil Kumar13-Jul-05 6:43
S. Senthil Kumar13-Jul-05 6:43 
GeneralRe: Copying Object Types Pin
SamM13-Jul-05 22:30
SamM13-Jul-05 22:30 
QuestionHow to change the SourcePath in a Microsoft Installer project? Pin
bondguru12-Jul-05 20:18
bondguru12-Jul-05 20:18 
AnswerRe: How to change the SourcePath in a Microsoft Installer project? Pin
rwestgraham13-Jul-05 15:22
rwestgraham13-Jul-05 15:22 
GeneralMysterious application crash Pin
RajeshGuptha12-Jul-05 5:33
RajeshGuptha12-Jul-05 5:33 
GeneralRe: Mysterious application crash Pin
Christian Graus12-Jul-05 13:34
protectorChristian Graus12-Jul-05 13:34 
GeneralRe: Mysterious application crash Pin
Ray Cassick12-Jul-05 18:33
Ray Cassick12-Jul-05 18:33 
GeneralRe: Mysterious application crash Pin
RajeshGuptha12-Jul-05 22:31
RajeshGuptha12-Jul-05 22:31 
GeneralRe: Mysterious application crash Pin
Robert Rohde13-Jul-05 4:35
Robert Rohde13-Jul-05 4:35 
GeneralRe: Mysterious application crash Pin
Daniel Turini14-Jul-05 9:45
Daniel Turini14-Jul-05 9:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.