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
 Demo working with tiff files

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
Fábio Nascimento Posted - May 19 2016 : 15:15:33
Hi,

While Bill was woking on his demo I was too, so I'll post it here anyways since it has a different approach.

The demo is very simple, it can open a multipage tiff file (attached on the zip file), show the pages as thumbnails on a ImageEnMView and show the selected page on a ImageEnVect.

Then you can add a bitmap to the ImageEnVect (click on add bitmap button, select the bmp that is attached and then click on a free area of the ImageEnVect).

I tried a lot a things, but I could not:

1) Print the entire tiff (all the pages) WITH the object bitmap added;

2) The tiff attached has an annotation made with the Kodak software, but I cant find a way to show this annotation on the ImageEnVect, if you look closely on the ImageEnMView, on the top left corner, you can see a red blur, which is the annotation, also, if you click print, on the print preview form, this annotation is also shown, and it is printed too; and

3) I need to be able to save annotations do the tiff file and load them in the future.

If Nigel or anyone else with more experience could take a look I'd be very grateful!

Fábio



attach/Fábio Nascimento/2016519151341_ImageEn.zip
381.39 KB
8   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - May 20 2016 : 18:54:20
Also, please note that you can other frames into a TImageEnVect/TImageEnView by settings IO.Params.ImageIndex:

Please see the printing example at:

http://www.imageen.com/help/TIOParams.ImageIndex.html

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Fábio Nascimento Posted - May 20 2016 : 13:44:48
Apperentely it did the job Bill, thats what I was talking about..


procedure Tfrm_ged_digitalizacoes_v2.act_imprimirExecute(Sender: TObject);
var
  current_page, i: Integer;
  iIndex: Integer;
  iIEBitmap: TIEBitmap;
  print_ImageEnMView: TImageEnMView;
begin

  print_ImageEnMView := TImageEnMView.Create(nil);

  try

    current_page := ImageEnMView.SelectedImage;

    for i := 0 to ImageEnMView.ImageCount - 1 do begin

      ImageEnMView.SelectedImage := i;

      iIEBitmap := TIEBitmap.Create;

      try

        iIEBitmap.AssignImage(ImageEnMView.IEBitmap);

        if i = current_page then ImageEnVect.DrawObjectsToBitmap(iIEBitmap,True);

        iIndex := print_ImageEnMView.AppendImage;

        // Add the iIEbitmap to the thumbnail
        print_ImageEnMView.SetIEBitmapEx(iIndex, iIEBitmap);
      finally
        iIEBitmap.Free;
      end;

    end;

    print_ImageEnMView.Update;
    print_ImageEnMView.MIO.DoPrintPreviewDialog('Print', True, 'Print Preview', False);
    ImageEnVect.RemoveAllObjects;

  finally
    print_ImageEnMView.Free;
  end;


I tried a more simple code that uses the same ImageEnMView instead of creating one and it worked too, but the thumbnail looks ugly after the Update.

I'll keep working here now, thanks a million again for all your support.

Best regards,

Fábio
w2m Posted - May 20 2016 : 11:08:59
The beautiful thing about ImageEn there are a lot of ways to solve a problem if you work on a problem long enough.

Try adding this to my demo. This displays the objects in the print preview dialog so you can print all the images or just the selected frame along with the objects even with your 1-bit tiff files:
procedure TForm1.Print1Click(Sender: TObject);
var
  i: Integer;
  iIndex: Integer;
  iIEBitmap: TIEBitmap;
  iImageEnVect: TImageEnVect;
  iImageEnMView: TImageEnMView;
begin
  if Assigned(PageControl1.ActivePage) then
  begin
    iImageEnMView := TImageEnMView.Create(nil);
    try
      for i := 0 to PageControl1.PageCount - 1 do
      begin
        ImageEnVect := TImageEnVect(PageControl1.Pages[i].Controls[0]);
        if Assigned(ImageEnVect) then
        begin
          iIEBitmap := TIEBitmap.Create;
          try
            { Draw the image to the iIEBitmap }
            iIEBitmap.AssignImage(ImageEnVect.IEBitmap);
            { Draw the objects to iIEBitmap }
            ImageEnVect.DrawObjectsToBitmap( iIEBitmap, True );
            iIndex := iImageEnMView.AppendImage;
            { Add the iIEbitmap to the thumbnail }
            iImageEnMView.SetIEBitmapEx(iIndex, iIEBitmap);
          finally
            iIEBitmap.Free;
          end;
        end;
      end;
      iImageEnMView.Update;
      iImageEnMView.MIO.DoPrintPreviewDialog('Print', True,
        'Print Preview', False);
    finally
      iImageEnMView.Free;
    end;
  end;
end;

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Fábio Nascimento Posted - May 20 2016 : 10:09:21
Then we get back to the problem that ImageEnMView doesn't print the annotations right?

Do you think is it possible to draw the bitmap on the page, save and then print it with ImageEnMView?

On the Kodak OCX components, I use a "BurnInAnnotations" method, that draws permanent draws the bitmap to the tiff, then I print the tiff.
w2m Posted - May 20 2016 : 10:04:09
You do not have to use workarounds to print all the frames in a tiff file.
ImageEnVect can only work with one image at a time, so by itself it can not handle printing all the pages. You should use ImageEnMView when you are working with multiframe tiff files. If you use the ImageEnMView.DoPrintPreviewsDialog you can print all the images or just the selected frame.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Fábio Nascimento Posted - May 20 2016 : 09:50:33
Thank you both!

Is it possible to print all the pages using a ImageEnVect? Because I can load all the pages with ImageEnVect.IO.LoadFromFileTIFF(OpenPictureDialogTIFF.FileName); and navigate through the pages using ImageEnVect.IO.Seek, but unlike the ImageEnMView I can't find a way to print all the pages, only the one it's shown.

Also, I was thinking about using the Printer itself, loop through the pages printing each page with a Printer.Canvas, but I really didn't expect to have to use workarounds for some basic job like print the document.

Do you think you can look into it the next week?

Thank you!
xequte Posted - May 20 2016 : 00:40:25
Hi Bill

Yes, there is something weird going on there that I have not got to the bottom of yet. Unfortunately it is now the weekend, so it will have to wait till monday.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
w2m Posted - May 19 2016 : 19:28:24
Nigel,

Fabio is using 1- bit tiff images and as best as I can determine for some reason the ImageEnMView1.MIO.DoPrintPreviewDialog('Print', True, 'Print Preview', False); does not show valid bitmap objects in the DoPrintPreviewDialog with his tiff image.

Can you try my demo to try to determine why objects do not appear in the DoPrintPreviewDialog with the 1-bit tiff images?

I took his tiff file, exported the 4 pages to 4 jpg files then I added the pages back to the tiff file and saved as a tiff. When I used the converted tiff file the bitmap objects displayed perfectly in the DoPrintPreviewDialog with the converted tiff file.

When I compared the 2 tiff files I get:

Original
TIFF_DocumentName:
iTIFF_ImageDescription:
BitsPerSample: 1
SamplesPerPixel: 1
TIFF_Compression: ioTIFF_G4FAX
TIFF_JPEGQuality: 80
TIFF_JPEGColorSpace: ioJPEG_YCbCr
TIFF_SubIndex: -1
TIFF_PhotometInterpret: ioTIFF_WHITEISZERO
TIFF_PlanarConf: 1
TIFF_NewSubfileType: 0
TIFF_Orientation: Image is Orientated Correctly
TIFF_ByteOrder: LittleEndian
TIFF_BigTIFF: False

Converted
TIFF_DocumentName:
iTIFF_ImageDescription:
BitsPerSample: 8
SamplesPerPixel: 3
TIFF_Compression: ioTIFF_UNCOMPRESSED
TIFF_JPEGQuality: 80
TIFF_JPEGColorSpace: ioJPEG_YCbCr
TIFF_SubIndex: -1
TIFF_PhotometInterpret: ioTIFF_RGB
TIFF_PlanarConf: 1
TIFF_NewSubfileType: 0
TIFF_Orientation: Image is Orientated Correctly
TIFF_ByteOrder: LittleEndian
TIFF_BigTIFF: False

There is something going on with the 1-bit tiff files so they do not function correctly to display objects in the DoPrintPreviewDialog.

For testing please use my new demo which you may obtain here:
How to use Annotations With TImageEnMView with TImageEnVect here:
http://www.imageen.com/ieforum/topic.asp?TOPIC_ID=1446&whichpage=5

The file that is not previewing correctly is Tiff_File.tif
The converted file that displays correctly is Corrected_Tiff_File.tif
Both text files may be downloaded here:
attach/w2m/2016519192219_TIFF_Files.zip
5724 KB

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development