Click here to Skip to main content
15,887,267 members
Home / Discussions / C#
   

C#

 
GeneralRe: Getdirectories performance problems Pin
Anders Hedén22-Jan-12 10:25
Anders Hedén22-Jan-12 10:25 
AnswerRe: Getdirectories performance problems Pin
Luc Pattyn22-Jan-12 10:43
sitebuilderLuc Pattyn22-Jan-12 10:43 
AnswerRe: Getdirectories performance problems Pin
Shameel20-Jan-12 2:18
professionalShameel20-Jan-12 2:18 
GeneralRe: Getdirectories performance problems Pin
Anders Hedén20-Jan-12 4:05
Anders Hedén20-Jan-12 4:05 
AnswerRe: Getdirectories performance problems Pin
Shameel20-Jan-12 4:56
professionalShameel20-Jan-12 4:56 
AnswerRe: Getdirectories performance problems Pin
BobJanova20-Jan-12 2:32
BobJanova20-Jan-12 2:32 
AnswerRe: Getdirectories performance problems Pin
Pete O'Hanlon20-Jan-12 2:49
mvePete O'Hanlon20-Jan-12 2:49 
QuestionProblem Copying Raw RGB Data to Bitmap Pin
Jaffer Mumtaz19-Jan-12 23:20
Jaffer Mumtaz19-Jan-12 23:20 
Hi All,

I am using the following function to copy RAW RGB byte array to Bitmap object. The problem I am facing is when I copy the byte array content through SetPixel method, Image construction is OK and color are proper on the Bitmap. But when I try to use the following function it some how swaps the Red and Blue bytes in the Bitmap causing wrong colors on the Image.

C#
static int WriteBitmapFile(string filename, int width, int height, byte[] imageData)
{
using (Bitmap bmp = new Bitmap(width, height, PixelFormat.Format24bppRgb))
{
  BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0,bmp.Width,bmp.Height),ImageLockMode.WriteOnly,bmp.PixelFormat);
  Marshal.Copy(imageData, 0, bmpData.Scan0, imageData.Length);
  bmp.UnlockBits(bmpData);
  bmp.Save(filename);
}
  return 1;
}


It seems though when I am copying the byte array in one go it swaps the Red and Blue bytes. SetPixel works fine but is too slow.

Any help in this regard is highly appreciated.

Regards,
AnswerRe: Problem Copying Raw RGB Data to Bitmap Pin
Luc Pattyn19-Jan-12 23:50
sitebuilderLuc Pattyn19-Jan-12 23:50 
GeneralRe: Problem Copying Raw RGB Data to Bitmap Pin
Jaffer Mumtaz19-Jan-12 23:55
Jaffer Mumtaz19-Jan-12 23:55 
AnswerRe: Problem Copying Raw RGB Data to Bitmap Pin
BobJanova20-Jan-12 2:17
BobJanova20-Jan-12 2:17 
GeneralRe: Problem Copying Raw RGB Data to Bitmap Pin
Jaffer Mumtaz21-Jan-12 7:31
Jaffer Mumtaz21-Jan-12 7:31 
GeneralRe: Problem Copying Raw RGB Data to Bitmap Pin
BobJanova21-Jan-12 10:59
BobJanova21-Jan-12 10:59 
QuestionTime taken to load a contrl Pin
Subin Mavunkal19-Jan-12 19:15
Subin Mavunkal19-Jan-12 19:15 
AnswerRe: Time taken to load a contrl Pin
BillWoodruff19-Jan-12 20:15
professionalBillWoodruff19-Jan-12 20:15 
AnswerRe: Time taken to load a contrl Pin
V.19-Jan-12 20:27
professionalV.19-Jan-12 20:27 
AnswerRe: Time taken to load a contrl Pin
Luc Pattyn19-Jan-12 21:51
sitebuilderLuc Pattyn19-Jan-12 21:51 
AnswerRe: Time taken to load a contrl Pin
BobJanova19-Jan-12 22:13
BobJanova19-Jan-12 22:13 
Questionis object part of CollectionBase Pin
Hanzaplast19-Jan-12 5:26
Hanzaplast19-Jan-12 5:26 
AnswerRe: is object part of CollectionBase Pin
BobJanova19-Jan-12 6:41
BobJanova19-Jan-12 6:41 
AnswerRe: is object part of CollectionBase Pin
Luc Pattyn19-Jan-12 7:24
sitebuilderLuc Pattyn19-Jan-12 7:24 
GeneralRe: is object part of CollectionBase Pin
Dave Kreskowiak19-Jan-12 7:30
mveDave Kreskowiak19-Jan-12 7:30 
GeneralRe: is object part of CollectionBase Pin
Luc Pattyn19-Jan-12 8:01
sitebuilderLuc Pattyn19-Jan-12 8:01 
GeneralRe: is object part of CollectionBase Pin
BillWoodruff19-Jan-12 20:24
professionalBillWoodruff19-Jan-12 20:24 
Questionusing variables in SSIS script task: c# code Pin
bigphish19-Jan-12 1:33
bigphish19-Jan-12 1:33 

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.