• Welcome to Vampyre Imaging Library Forum. Please login or sign up.
 

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Topics - wp

1
Help & Questions / Speed and memory usage
12 May 2009, 21:35:54
I have to deal with pretty large TIFF files (some 100 MB). This is my code to load an image:


type
  TMainForm = class(TForm)
      ...
  private
    FImg : TSingleImage;
    {$IFDEF USE_GR32}
    Image32 : TImage32;
    {$ENDIF}
    procedure LoadFile(AFileName:string);
       ...
  end;

procedure TMainForm.LoadFile(AFileName:string);
var
  T : int64;
  imgbitmap : TImagingBitmap;
  success : boolean;
begin
  success := false;
  T := ImagingUtility.GetTimeMicroseconds;
  FreeAndNil(FImg);
  Screen.Cursor := crHourglass;
  try
    FImg := TSingleImage.CreateFromFile(AFileName);
    if FImg <> nil then begin
      imgbitmap := TImagingBitmap.Create;
      try
        imgbitmap.Assign(FImg);
        {$IFDEF USE_GR32}
        Image32.Bitmap.Assign(imgbitmap);
        {$ELSE}
        Image.Picture.Assign(imgbitmap);
        {$ENDIF}
        success := true;
      finally
        imgbitmap.Free;
      end;
    end;
    ...
  finally
    Screen.Cursor := crDefault;
  end;
end;


Is this the fastest way to load an image? I observe that IrfanView is able to open the same images considerably faster. In my program I used the high-level VCL interface, is it faster to use the low-level routines instead?

A related question concerns memory usage. What is the best practice to avoid multiple memory allocations and copy operations?

2
Help & Questions / Load and save progress
12 May 2009, 11:02:46
Hi

I have some large pictures where loading and saving takes some seconds and would like to display a progress bar. Can this be done somehow?

Werner
SMF spam blocked by CleanTalk