ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Display as successive pages
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

rico

Russia
6 Posts

Posted - Jul 09 2013 :  02:42:23  Show Profile  Reply
Hi!
Can I show you some pictures of the TIFF file as a sequence of pages (like PDF files in Adobe Reader)?

w2m

USA
1990 Posts

Posted - Jul 09 2013 :  05:58:52  Show Profile  Reply
You could try drawing the images to a TPanel.Canvas or another control to mimic AdobeReader, otherwise use ImageEnMView.

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page

rico

Russia
6 Posts

Posted - Jul 11 2013 :  22:33:03  Show Profile  Reply
How to use this mode to ImageEnMView?
Go to Top of Page

w2m

USA
1990 Posts

Posted - Jul 12 2013 :  08:47:58  Show Profile  Reply
procedure TForm1.VerticalGrid1Click(Sender: TObject);
{ Show the images in a vertical grid similar to Adobe Reader.
{ This would have to be run in a secondary thread to maintain an active GUI.
{ This is reasonably fast for up to about 25-50 images }
var
  i: integer;
  y: integer;
  iWidth: integer;
  iHeight: integer;
  iBitmap: TBitmap;
  iSpaceBetweenImages: integer;
begin
   Screen.Cursor := crHourGlass;
  try
    { Set the dimensions of the image to draw to- all images must have the same dimensions }
    iSpaceBetweenImages := 25; { vertical space between images in pixels }
    iWidth := ImageEnMView1.ImageOriginalWidth[0];
    iHeight := (ImageEnMView1.ImageOriginalHeight[0] + iSpaceBetweenImages) *
      ImageEnMView1.ImageCount;
    try
      { Try to create a bitmap large enough to hold all the images }
      { Image the bitmap is too large an exception will ocur }
      ImageEnView2.Proc.ImageResize(iWidth, iHeight);
      i := 0;
      y := 0;
      while y < iHeight do
      begin
        iBitmap := TBitmap.Create;
        { Get the image from ImageEnMview }
        iBitmap.Assign(ImageEnMView1.GetBitmap(i));
        { Draw the image to ImageEnView2.Bitmap.Canvas }
        ImageEnView2.Bitmap.Canvas.Draw(0, y, iBitmap);
        Application.ProcessMessages;
        ImageEnView2.Update;
        { Set the y position for next image }
        y := y + iBitmap.Height + iSpaceBetweenImages;
        { Free the bitmap }
        ImageEnMView1.ReleaseBitmap(i);
        { Image number }
        inc(i);
      end;
    except
      on E: Exception do
      begin
        ShowMessage('Exception class name = ' + E.ClassName);
        ShowMessage('Exception message = ' + E.Message);
      end;
    end;
  finally
    Screen.Cursor := crDefault;
  end;
end;

procedure TForm1.ThumbnailVerticalGrid1Click(Sender: TObject);
{ Show thumbnails of the images in a vertical grid. 
  This requires iexHelperFunctions.pas that is in the latest version of imageen }
var
  i: integer;
  y: integer;
  iWidth: integer;
  iHeight: integer;
  iThumbnailHeight: integer;
  iThumbnailWidth: integer;
  iBitmap: TBitmap;
  iSpaceBetweenImages: integer;
begin
  { Use this if you have a large number of images or images are of large size.
    This draws a 1/3 size thumbnail of each image.  Unfortunately if you have a large (> 50)
    number of images this will take several seconds (30-40 sceconds) to complete.  This
    would have to be run in a secondary thread to maintain an active GUI. }
  Screen.Cursor := crHourGlass;
  try
    ImageEnView2.Clear;
    { Set the dimensions of the image to draw to- all images must have the same dimensions }
    iSpaceBetweenImages := 25; { vertical space between images in pixels }
    iWidth := ImageEnMView1.ImageOriginalWidth[0] div 3;
    iHeight := (ImageEnMView1.ImageOriginalHeight[0] div 3 + iSpaceBetweenImages) *
      ImageEnMView1.ImageCount;
    iThumbnailWidth := ImageEnMView1.ImageOriginalWidth[0] div 3;
    iThumbnailHeight := ImageEnMView1.ImageOriginalHeight[0] div 3;
    try
      { Try to create a bitmap large enough to hold all the images }
      { Image the bitmap is too large an exception will occur }
      ImageEnView2.Proc.ImageResize(iWidth, iHeight);
      i := 0;
      y := 0;
      while y < iHeight do
      begin
        iBitmap := TBitmap.Create;
        { Get the image from ImageEnMview }
        iBitmap.Assign(ImageEnMView1.GetBitmap(i));
        { Convert the bitmap to a thumbnail to reduce memory requirements }
        iBitmap.IEConvertToThumbnail(iThumbnailWidth, iThumbnailHeight, True, rfLanczos3, True, clWhite, True, 4, 4, clBlack);
        { OR resample the image to 1/3 size
        iBitmap.IEResample(iThumbnailWidth, -1); }
        { Draw the image to ImageEnView2.Bitmap.Canvas }
        ImageEnView2.Bitmap.Canvas.Draw(0, y, iBitmap);
        ImageEnView2.Update;
        { This is necessary to update each image when it is drawn }
        Application.ProcessMessages;
        { Set the y position for next image }
        y := y + iBitmap.Height + iSpaceBetweenImages;
        { Free the bitmap }
        ImageEnMView1.ReleaseBitmap(i);
        { Image number }
        inc(i);
      end;
    except
      on E: Exception do
      begin
        ShowMessage('Exception class name = ' + E.ClassName);
        ShowMessage('Exception message = ' + E.Message);
      end;
    end;
  finally
    Screen.Cursor := crDefault;
  end;
end;

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page

rico

Russia
6 Posts

Posted - Jul 15 2013 :  23:29:06  Show Profile  Reply
Causes "EAccessViolation" (VerticalGrid1Click) on line:
ImageEnView2.Bitmap.Canvas.Draw(0, y, iBitmap);

BDS2009, ImageEn 4.1.4
Go to Top of Page

rico

Russia
6 Posts

Posted - Jul 15 2013 :  23:41:49  Show Profile  Reply
I'm sorry, found the mistake. All OK!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: