ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Grayscale Question

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
pierrotsc Posted - Feb 09 2012 : 13:17:58
How can I find out if an image i load is a 256 grayscale image? If it is not, how can I convert it to one?
Thanks.
P
2   L A T E S T    R E P L I E S    (Newest First)
pierrotsc Posted - Feb 10 2012 : 14:08:07
Thanks...Will try that..
w2m Posted - Feb 09 2012 : 14:59:10
Try this:

procedure ConvertTo256Grayscale;
begin
  {This method converts selected region to gray levels. The image   always will be in true color (16M of colors)}
 ImageENView1.Proc.ConvertToGray;

{Converts current image to 256 colors}
 ImageENView1.Proc.ConvertTo( 256 );
end;


{ not tested }
function IsImageGrayscale: boolean;
begin
  Result := ImageENView1.IEBitmap.PixelFormat = ie8g;
  // gray scale (256 levels)
end;


or

{ not tested }
function IsImageGrayscale: boolean;
begin
  Result := (ImageENView1.IEBitmap.IsGrayScale) and (ImageENView1.IO.Params.BitsPerSample * ImageENView1.IO.Params.SamplesPerPixel = 8);       
// Checks if all pixels have have R=G=B values (the bitmap is grayscale)... BitsPerSample * SamplesPerPixel = 8 bit 256 color
end;


William Miller