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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Colorize function in ImageEn
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

AndyColmes

USA
351 Posts

Posted - Aug 27 2016 :  17:34:32  Show Profile  Reply
In using some commercial imaging programs, there is a function called Colorize that can make a grayscale image into red. Is there such a function in ImageEn? I would like to automatically turn a grayscale image to color, and if possible different color shades without having to replace the color for each pixel, which could be slow.

Thank you for any help.

Andy

w2m

USA
1990 Posts

Posted - Aug 27 2016 :  19:00:49  Show Profile  Reply
TImageEnProc.Colorize

Declaration
procedure Colorize(hue: Integer; saturation: Integer; luminosity: Double);

Description
Set the hue and saturation for all pixels of the image. It also adjusts the luminosity using a multiplier.

Parameter Description
hue A value between 0 and 359 (corresponding to 0 to 359 degrees around hexcone)
saturation A value between 0 (shade of gray) and 99 (pure color).
luminosity This is 1 if you don't touch the original luminosity. Whereas 1.1 would equate to 10% increase in luminosity, for example

Example
// Apply a sepia effect to the image
ImageEnView.Proc.Colorize(40, 50, 1.1);


Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

w2m

USA
1990 Posts

Posted - Aug 27 2016 :  19:14:43  Show Profile  Reply
TImageEnProc.MapGrayToColor

Declaration
procedure MapGrayToColor(map: array of TRGB);

Description
Maps each gray scale level to specified RGB color, using provided map.

var
  map: array [0 .. 255] of TRGB;
  i: Integer;  
for i := 0 to 255 do
begin
  map[i].r := i;
  map[i].g := 0;
  map[i].b := 0;
end;
ImageEnView.Proc.MapGrayToColor(map);
ImageEnView.Update;

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

AndyColmes

USA
351 Posts

Posted - Aug 28 2016 :  05:11:28  Show Profile  Reply
Wow Bill, thank you very much for the tips.

Andy
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: