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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Display as successive pages

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
rico Posted - Jul 09 2013 : 02:42:23
Hi!
Can I show you some pictures of the TIFF file as a sequence of pages (like PDF files in Adobe Reader)?
5   L A T E S T    R E P L I E S    (Newest First)
rico Posted - Jul 15 2013 : 23:41:49
I'm sorry, found the mistake. All OK!
rico Posted - Jul 15 2013 : 23:29:06
Causes "EAccessViolation" (VerticalGrid1Click) on line:
ImageEnView2.Bitmap.Canvas.Draw(0, y, iBitmap);

BDS2009, ImageEn 4.1.4
w2m Posted - Jul 12 2013 : 08:47:58
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
rico Posted - Jul 11 2013 : 22:33:03
How to use this mode to ImageEnMView?
w2m Posted - Jul 09 2013 : 05:58:52
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