Thanks, Kambiz. This is what I did... and it works great.
- Code: Select all
Procedure TForm1.RunScript1Click(Sender: TObject);
var
Lines: TStringList;
i, DelimPos, paramVal: Integer;
M1, M2, S, imgFunct: String;
begin
if OpenTextFileDialog1.Execute then
begin
Lines := TStringList.Create;
try
Lines.LoadFromFile(OpenTextFileDialog1.FileName);
for i := 0 to Lines.Count-1 do
begin
S := Lines[i];
DelimPos := AnsiPos(',', S);
if DelimPos > 0 then
begin
M1:= Copy(S, 1, DelimPos - 1);
M2:= Copy(S, DelimPos + 1, MaxInt);
imgFunct:= AnsiLowerCase(M1);
paramVal:= StrtoInt(M2);
if imgFunct = 'sepia' then image1.Picture.Graphic:= bmpsepia(image1.picture.bitmap, paramVal);
if imgFunct = 'posterize' then image1.Picture.Graphic:= bmpposterize(image1.picture.bitmap, paramVal);
if imgFunct = 'solarize' then image1.Picture.Graphic:= bmpsolarize(image1.picture.bitmap, paramVal);
if imgFunct = 'relief' then image1.Picture.Graphic:= bmprelief(image1.picture.bitmap, paramVal);
if imgFunct = 'emboss' then image1.Picture.Graphic:= bmpemboss(image1.picture.bitmap, paramVal);
end else
imgFunct:= AnsiLowerCase(S);
if imgFunct = 'flaxen' then image1.Picture.Graphic:= bmpflaxen(image1.picture.bitmap);
if imgFunct = 'negative' then image1.Picture.Graphic:= bmpnegative(image1.picture.bitmap);
if imgFunct = 'gold' then
begin { gold }
image1.Picture.Graphic:= bmpsolarize(image1.picture.bitmap, 128);
image1.Picture.Graphic:= bmpflaxen(image1.picture.bitmap);
image1.Picture.Graphic:= bmpsepia(image1.picture.bitmap, 30);
end; { gold }
end; { i loop }
if ButtonOriginal.Visible = False then ButtonOriginal.Show;
finally
Lines.Free;
end; { try finally }
end; { if open dialog }
end;
This code is implemented in version 3.5 of my program.
http://www.softpedia.com/get/Multimedia ... bber.shtml As I type this the new version has not been posted. For screen capture it works best if "show window contents while dragging" is enabled.
My unit of image effect functions is available on request. OR I can upload it as an attachment if there is sufficient demand for it.
Don