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

Post reply

Other options

Shortcuts: ALT+S save/post or ALT+P preview

Topic summary

Posted by wp
 - 18 May 2009, 15:18:22
Strange...

My test TIFF picture is loaded by IrfanView (v4.23) within 1.3 s (as displayed in their image info dialog). My own, vampyre-based program needs about 2.2 s for loading plus about 0.2 s or 0.4 s for shuffling into a TImage or TImage32, respectively (from the Graphics32 library). The 2.2s for loading are unchanged when I use the low-level, high-level or VCL interface.
Posted by Galfar
 - 18 May 2009, 11:53:55
I guess the slowdown is related to the part when you assign image to VLC picture. Try timing just FImg := TSingleImage.CreateFromFile(AFileName); part and compare to Irfan. Both Imaging and Irfan use LibTiff library to load TIFFs from files so there should't be that much of a difference.
Regarding the memory, just don't do anything where data size of the image changes - resizing, data format conversions, etc. 
Posted by wp
 - 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?

SMF spam blocked by CleanTalk