Someone may have an ImageEn method to create Sepia effect, but here is another way:
function BmpToSepia(const ABitmap: TBitmap; ADepth: Integer): boolean;
//This function adds a sepia effect to a bitmap.
//Adepth sets the colour intensity of the red-brown color
//Greater ADepth values set a higher intensity.
//Usually ADepth values from 35-75 produce the best effect
//To create a greyscale effect, set ADepth to 0
var
iColor: longint;
iColor2: longint;
r, g, b, rr, gg: byte;
iWidth, iHeight: Integer;
begin
Screen.Cursor := crHourGlass;
try
Result := False;
begin
for iHeight := 0 to ABitmap.Height do
begin
for iWidth := 0 to ABitmap.Width do
begin
//first convert the bitmap to greyscale
iColor := ColorToRGB(ABitmap.Canvas.Pixels[iWidth, iHeight]);
r := GetRValue(iColor);
g := GetGValue(iColor);
b := GetBValue(iColor);
iColor2 := (r + g + b) div 3;
ABitmap.Canvas.Pixels[iWidth, iHeight] := RGB(iColor2, iColor2, iColor2);
//then convert it to sepia
iColor := colortorgb(ABitmap.Canvas.Pixels[iWidth, iHeight]);
r := GetRValue(iColor);
g := GetGValue(iColor);
b := GetBValue(iColor);
rr := r + (ADepth * 2);
gg := g + ADepth;
if rr<=((ADepth * 2) - 1) then
rr := 255;
if gg<=(ADepth - 1) then
gg := 255;
ABitmap.Canvas.Pixels[iWidth, iHeight] := RGB(rr, gg, b);
end;
Result := True;
end;
end;
finally
Screen.Cursor := crDefault;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
iDepth: Integer;
begin
ImageEnView1.Proc.SaveUndoCaptioned('Sepia ' + IntToStr(ImageEnView1.Proc.UndoCount));
Undo1.Hint := 'Sepia ' + IntToStr(ImageEnView1.Proc.UndoCount);
iDepth := 3;
iDepth := StrToIntDef(InputBox('Blur', 'Enter Sepia Level, IntToStr(iDepth)), 1);
BmpToSepia(ImageEnView1.Bitmap, iDepth);
ImageEnView1.Update;
Undo1.Enabled := ImageEnView1.Proc.CanUndo;
ImageEnView1.Bitmap.Modified := True;
end;
William Miller
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html