Click here to Skip to main content
15,905,004 members
Home / Discussions / C#
   

C#

 
QuestionHow do I crop / convert an Image that has Indexed Pixel Format Pin
saberbladez4-Nov-08 22:26
saberbladez4-Nov-08 22:26 
I current can crop certain part of the colour image using
Rectangle rect = new Rectangle(btmX, btmY, rectWidth, rectHeight);
//reading image to graphics
Graphics g = Graphics.FromImage(selectedImg);
//drawing with red pen width 1
Pen pen = new Pen(Color.Red, 1);
//e.Graphics.DrawRectangle(pen, rect);
//drawing the rectangle here
g.DrawRectangle(pen, rect);
picBoxOpen.Image = selectedImg;
//g.Dispose();

but once i crop a grayscaled Image it gave me this problem

+ $exception {"A Graphics object cannot be created from an image that has an indexed pixel format."} System.Exception


I'm kind of new in this image processing area can any kind souls help me out with this please :P thanks
GeneralRe: How do I crop / convert an Image that has Indexed Pixel Format Pin
cyber-drugs5-Nov-08 0:26
cyber-drugs5-Nov-08 0:26 
GeneralRe: How do I crop / convert an Image that has Indexed Pixel Format Pin
saberbladez5-Nov-08 14:32
saberbladez5-Nov-08 14:32 
QuestionTrimEnd? Pin
dec824-Nov-08 22:21
dec824-Nov-08 22:21 
AnswerRe: TrimEnd? Pin
Ashfield4-Nov-08 22:25
Ashfield4-Nov-08 22:25 
GeneralRe: TrimEnd? Pin
dec824-Nov-08 22:47
dec824-Nov-08 22:47 
AnswerRe: TrimEnd? Pin
Guffa5-Nov-08 2:53
Guffa5-Nov-08 2:53 
GeneralRe: TrimEnd? Pin
Guffa5-Nov-08 3:22
Guffa5-Nov-08 3:22 
AnswerRe: TrimEnd? Pin
Pedram Behroozi4-Nov-08 23:43
Pedram Behroozi4-Nov-08 23:43 
AnswerRe: TrimEnd? [modified] Pin
Guffa5-Nov-08 3:21
Guffa5-Nov-08 3:21 
Questiondatagridview checkbox [modified] Pin
arkiboys4-Nov-08 20:57
arkiboys4-Nov-08 20:57 
AnswerRe: datagridview checkbox Pin
cocoonwls4-Nov-08 23:25
cocoonwls4-Nov-08 23:25 
AnswerRe: datagridview checkbox Pin
dan!sh 5-Nov-08 0:24
professional dan!sh 5-Nov-08 0:24 
QuestionCreating a number of buttons with different onclick commands Pin
Matjaz-xyz4-Nov-08 19:39
Matjaz-xyz4-Nov-08 19:39 
AnswerRe: Creating a number of buttons with different onclick commands Pin
cocoonwls4-Nov-08 20:30
cocoonwls4-Nov-08 20:30 
AnswerRe: Creating a number of buttons with different onclick commands Pin
Pedram Behroozi4-Nov-08 22:32
Pedram Behroozi4-Nov-08 22:32 
GeneralRe: Creating a number of buttons with different onclick commands Pin
cocoonwls4-Nov-08 23:15
cocoonwls4-Nov-08 23:15 
GeneralRe: Creating a number of buttons with different onclick commands Pin
Pedram Behroozi5-Nov-08 0:21
Pedram Behroozi5-Nov-08 0:21 
GeneralRe: Creating a number of buttons with different onclick commands Pin
Matjaz-xyz5-Nov-08 5:02
Matjaz-xyz5-Nov-08 5:02 
QuestionHow to detect arrows key in key press event handler? Pin
cocoonwls4-Nov-08 19:12
cocoonwls4-Nov-08 19:12 
AnswerRe: How to detect arrows key in key press event handler? Pin
Pedram Behroozi4-Nov-08 19:33
Pedram Behroozi4-Nov-08 19:33 
AnswerRe: How to detect arrows key in key press event handler? [modified] Pin
Matjaz-xyz4-Nov-08 19:34
Matjaz-xyz4-Nov-08 19:34 
AnswerRe: How to detect arrows key in key press event handler? [modified] Pin
cocoonwls4-Nov-08 20:10
cocoonwls4-Nov-08 20:10 
GeneralRe: How to detect arrows key in key press event handler? Pin
Pedram Behroozi4-Nov-08 22:35
Pedram Behroozi4-Nov-08 22:35 
GeneralRe: How to detect arrows key in key press event handler? Pin
cocoonwls4-Nov-08 23:12
cocoonwls4-Nov-08 23:12 

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.