Batch resize? [Delphi]

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, helmut, xnview

The Re@l
Posts: 3
Joined: Tue Nov 02, 2004 6:51 pm

Batch resize? [Delphi]

Post by The Re@l »

Code: Select all

var
i:integer;
filename1, filename: string;
finfo: TGFL_FILE_INFORMATION;
lp: TGFL_LOAD_PARAMS;
sp: TGFL_SAVE_PARAMS;
gfl_bmp: PGFL_BITMAP;
e,f: GFL_ERROR;
format: string;
begin
   if not DirectoryExists(edit1.text) then MkDir(edit1.text);
   if edit1.Text <>'' then begin
    For i := 0 to FileListBox1.Items.Count - 1 do
      begin

    filename1 := (edit1.text +      ExtractFileName(FileListBox1.Items.Strings[i]));
    filename := FileListBox1.FileName;

    If FileListBox1.FileName <> '' then
    begin

     gflGetDefaultLoadParams(lp);
     e := gflLoadBitmap(Pchar(filename), gfl_bmp, lp, finfo);

    if (e <> gfl_no_error) then begin
    MessageDlg('File not readable: ' + string(gflGetErrorString(e)), mtError, [mbOK], 0);
    exit;
  end;

     gflResize(gfl_bmp, nil, StrToInt(edit2.text), StrToInt(edit3.text), GFL_RESIZE_BILINEAR, 0);


      format := finfo.FormatName;
      gflGetDefaultSaveParams(sp);
      sp.FormatIndex := gflGetFormatIndexByName(PChar(format));
       f := gflSaveBitmap(PChar(filename1 + '.' + format),gfl_bmp, sp);
        gflFreeBitmap(gfl_bmp);

            end;
             end;
              end;
               end;
Hello

I´ve try to resize all files in the Filelistbox, but it doesn`t seem to work.
Please, can you help me? what´s wrong.?

Best regards
The Re@l
User avatar
xnview
Author of XnView
Posts: 38828
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Batchresize? [Delphi]

Post by xnview »

The Re@l wrote:I´ve try to resize all files in the Filelistbox, but it doesn`t seem to work.
Please, can you help me? what´s wrong.?
What's happened?
Pierre.
The Re@l
Posts: 3
Joined: Tue Nov 02, 2004 6:51 pm

Post by The Re@l »

Hi

Nothing Happens,

or

Error mesage: File not Readable : Error to open File.

But I can´t see whats wrong.
The Re@l
Posts: 3
Joined: Tue Nov 02, 2004 6:51 pm

Post by The Re@l »

Ok it works.

My mistake. :)