We are using build 4.1.2 beta with Delphi XE We use the ImageEnMView component which load a 45 page tiff via ImageEnMView.LoadFromFileOnDemand(). the exception happens when executing ImageEnMView.MIO.SaveToFileTIFF(_Currentfile),see below. After the exception the ImageEnMView image 1-5 are blank.
if the number of pages is small, say 10 pages there are no issues.
Thanks All... Ron
procedure TImagEnFrm.ImageAutoCollate(iList:TList<integer>); var PagesToMove: Int32; i: Int32; MoveTo, PageToMove: Integer; ImageEnVectTemp: TImageEnVect; begin if iList.Count > 0 then begin ImageEnVectTemp := TImageEnVect.Create(nil); iList.Sort; ImageEnMView.LockPaint; PagesToMove := (iList.Count div 2)-1; try for i := 1 to PagesToMove do begin PageToMove := iList[Pred(iList.Count)] ; MoveTo := iList[Pred( i*2 )]; ImageEnMView.MoveImage(PageToMove ,MoveTo); ImageEnMView.UpdateEx(true); // need this to load file into viewer for update ImageEnMView.CopyToIEBitmap(PageToMove, ImageEnVectTemp.IEBitmap); ImageEnMView.CopyToIEBitmap(MoveTo, ImageEnVectTemp.IEBitmap); end; ImageEnMView.MIO.SaveToFileTIFF(_Currentfile); finally ImageEnMView.UnLockPaint; ImageEnVectTemp.Free; end; end; end;
Hi Ron, because LoadFromFileOnDemand uses threads to load images (when they are actually displayed) please make sure that your code access to an image when it is actually loaded. Also, please describe what your code should do, another solution (using other ImageEn functions) could be more efficient.