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
 LoadFromFileOnDemand and ImagingAnnot
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

graph_man

326 Posts

Posted - Jun 02 2015 :  07:51:39  Show Profile  Reply
I have ImageEnMView2 <---> ImageEnMIO2

If I use
ImageEnMIO2->LoadFromFileTIFF(TempFileTiff);
I can get
ImageEnMIO2->Params[0]->ImagingAnnot->ObjectsCount

result for my file and first page is 4

If I use
ImageEnMView2->LoadFromFileOnDemand(TempFileTiff, false);
I can't get
ImageEnMView2->MIO->Params[0]->ImagingAnnot->ObjectsCount

result is 0

How to fix it?

w2m

USA
1990 Posts

Posted - Jun 02 2015 :  10:32:01  Show Profile  Reply
As best as I can determine this may be a bug. My test application shows that the ImagingAnnot.ObjectsCount is indeed 0 despite the fact that the objects are visible in the thumbnail for the selected image and ImageEnAnnot.IsEmpty is not True and ImageEnAnnot.CopyToTImageEnVect successfully copies all the objects from ImageEnMView to ImageEnVect. The only work-around that I can find is to get the object count from ImageEnVect instead of ImageEnMView.
procedure TForm1.ImageEnMView1ImageSelect(Sender: TObject; idx: Integer);
begin
  if ImageEnMView1.SelectedImage > -1 then
  begin
    { Clear }
    ImageEnVect1.RemoveAllObjects;
    ImageEnVect1.Clear;

    { Copy the selected IEBitmap to the background of ImageEnVect }
    ImageEnMView1.CopyToIEBitmap(idx, ImageEnVect1.IEBitmap);

    { Copy the annotations from ImageEnMView to ImageEnVect }
    if ImageEnMView1.MIO.Params[idx].ImageEnAnnot.IsEmpty = False then
    begin
      ImageEnMView1.MIO.Params[idx].ImageEnAnnot.CopyToTImageEnVect
        (ImageEnVect1);
      { Display the object count in the statusbar.  If ImagingAnnot.ObjectsCount is 0 then
        get the object count from ImageEnVect }
      if ImageEnMView1.MIO.Params[idx].ImagingAnnot.ObjectsCount <> 0 then
        StatusBar1.Panels[5].Text := 'Objects: ' +
          IntToStr(ImageEnMView1.MIO.Params[idx].ImagingAnnot.ObjectsCount)
      else if ImageEnMView1.MIO.Params[idx].ImagingAnnot.ObjectsCount = 0 then
      begin
          MessageDlg
            (PChar('ImageEnMView1.MIO.Params[idx].ImagingAnnot.ObjectsCount is 0. '
            + 'Getting the object count from ImageEnVect instead.'), mtWarning,
            [mbOK], 0);
        StatusBar1.Panels[5].Text := 'Objects: ' +
          IntToStr(ImageEnVect1.ObjectsCount);
      end;
    end;

    { Refresh the TImageEnVect }
    ImageEnVect1.Update;

    StatusBar1.Panels[3].Text := 'Frame: ' +
      IntToStr(ImageEnMView1.SelectedImage + 1);
  end;
end;

A simple demo that reveals the problem has been posted in the user demos here: http://www.xecute.com/ieforum/topic.asp?whichpage=3&TOPIC_ID=1446#8003

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

graph_man

326 Posts

Posted - Jun 02 2015 :  13:38:05  Show Profile  Reply
Thanks, but I need to display this value (ObjectsCount) on all thumbnails without loading each into ImageEnVect1.
Go to Top of Page

w2m

USA
1990 Posts

Posted - Jun 02 2015 :  14:55:11  Show Profile  Reply
Not possible I am afraid unless the problem I demonstrated is fixed. Meanwhile... you could do it this way and not even see the TImageEnVect:
var
  iImageEnVect: TImageEnVect;
  iObjectCount: Integer;
begin
  { Display the object count in the statusbar. }
  iImageEnVect := TImageEnVect.Create(nil);
  try
    ImageEnMView1.MIO.Params[idx].ImageEnAnnot.CopyToTImageEnVect
      (iImageEnVect);
    iObjectCount := iImageEnVect.ObjectsCount;
    StatusBar1.Panels[5].Text := 'Objects: ' + IntToStr(iObjectCount);
  finally
    iImageEnVect.Free;
  end;
end;

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

graph_man

326 Posts

Posted - Jun 02 2015 :  15:21:47  Show Profile  Reply
I will wait for Nigel answer
Go to Top of Page

w2m

USA
1990 Posts

Posted - Jun 02 2015 :  15:26:58  Show Profile  Reply
It is also possible that the objects you have created are not ImagingAnnot object and are ImageEnAnnot objects. They are different... Unfortunately there is no ImageEnAnnot.ObjectsCount parameter.

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

graph_man

326 Posts

Posted - Jun 02 2015 :  15:30:20  Show Profile  Reply
No, I know exactly that these objects are ImagingAnnot objects
Go to Top of Page

graph_man

326 Posts

Posted - Jun 03 2015 :  16:54:42  Show Profile  Reply
I have found other solution

TImageEnIO* MyIO = new TImageEnIO(this);

for (int i = 0; i < PagesCount; i++)
{
MyIO->Params->ImageIndex = i;
MyIO->ParamsFromFile(FileName);
ImageEnMIO2->Params[i]->Assign(MyIO->Params);
}

delete MyIO;

Now I have access to all parameters including ImagingAnnot
Go to Top of Page

xequte

38510 Posts

Posted - Jun 04 2015 :  15:53:39  Show Profile  Reply
Hi

Thanks for the report. I'll investigate this shortly.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

w2m

USA
1990 Posts

Posted - Jun 06 2015 :  08:38:09  Show Profile  Reply
I want to point out that TIEImageEnAnnot does not have ObjectsCount property currently. Here are the current properties for both:

TIEImagingAnnot
- Assign
- Clear
- CopyFromTImageEnVect
- CopyToTImageEnVect
- DrawToBitmap
- LoadFromStandardBuffer
- LoadFromStream
- Objects
- ObjectsCount
- SaveToStandardBuffer
- SaveToStream

TIEImageEnAnnot
- Clear
- CopyToTImageEnVect
- CopyFromTImageEnVect
- DrawToBitmap
- IsEmpty
- ObjectsCount - Not available in 6.1 but just added in repository.

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

xequte

38510 Posts

Posted - Jun 22 2015 :  21:46:07  Show Profile  Reply
Hi

In v6.1.0 you can use EnsureImageLoaded to force the loading of an image so its params are ready.

// Read the Photoshop description of the selected image
if ImageEnMView1.SelectedImage >= 0 then
begin
  ImageEnMView1.EnsureImageLoaded( ImageEnMView1.SelectedImage );
  StatusBar.Text [ 1 ] := ImageEnMView1.MIO.Params[ ImageEnMView1.SelectedImage ].ReadIPTCField(PhotoShop_IPTC_Records, IPTC_PS_Caption);
end;


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: