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
 ImageEnMView - not loading TIFF
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

LukaL

Slovenia
13 Posts

Posted - Apr 01 2014 :  23:34:59  Show Profile  Reply
Hi,

I've got a problem with loading TIFF image from a file. It's strange because 95% of my TIFF files are loaded OK - for some TIFF files ImageEn seems to ignore them.
In the link you can download the two TIFF samples. https://db.tt/2TnYb2NM

Sample A is not loading / Sample B is working fine.

In the code I'm using it as this :
iePriponkaMView.MIO.LoadFromFileTIFF( TmpFileName );

And when loading SampleA and checking iePriponkaMView.ImageCount its value is 0.
BUT when loading SampleB the ImageCount property is 1.

I've also tried your Demos and the same thing is happenig - not loading Sample A.

Thank you for your help.

Edit : typos

xequte

38608 Posts

Posted - Apr 02 2014 :  00:06:08  Show Profile  Reply
Hi

Are you using v5.0.6? There is a loading bug in that version which we will be fixing very shortly.

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

LukaL

Slovenia
13 Posts

Posted - Apr 02 2014 :  00:24:57  Show Profile  Reply
No, I'm using version 4.1.4.

Sorry I did not post this info in my original post.

Go to Top of Page

xequte

38608 Posts

Posted - Apr 02 2014 :  18:46:43  Show Profile  Reply
Hi

This does not open because it is a JPEG with a .TIFF file extension.

You can load it by having ImageEn ignore the file extension using LoadFromFileAuto:

http://www.imageen.com/help/TImageEnIO.LoadFromFileAuto.html


In 5.1.0 (coming very soon) you can use the helper function in iexHelperFunctions which will fall back to LoadFromFileAuto if LoadFromFile fails.

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

LukaL

Slovenia
13 Posts

Posted - Apr 02 2014 :  23:22:29  Show Profile  Reply
Hi,

unfortunately calling LoadFromFileAuto does not solve my problem. If I try to open the file on my system it opens in my default picture viewer and it's displayed ok. So I think the issue is in a loading bug (that you say it's going to be fixed in the upcomming version 5.1.0 ? ).

When I load my problematic TIFF like this :


ExtractTIFFImageStream( MSAll, MSImage, i );

  if ( MSImage.Size > 0 ) then
    iImageCount := ROUND( MSAll.Size / MSImage.Size )
  else
    iImageCount := 0;

  while ( i < iImageCount ) do
  begin
    iemview.InsertImage( i );
    MSImage.Position := 0;
    iemview.SetImageFromStream( i, MSImage );

    Inc( i );

    MSImage.Position := 0;
    ExtractTIFFImageStream( MSAll, MSImage, i );
  end;


It is working. BUT I don't want to go and replace my code with this workaround.
Go to Top of Page

xequte

38608 Posts

Posted - Apr 03 2014 :  02:44:00  Show Profile  Reply
Hi

Are we are looking at the same set of files? Img_Specimen_A.TIFF is a JPEG image. If you rename it to Img_Specimen_A.jpeg it will load correctly.



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

LukaL

Slovenia
13 Posts

Posted - Apr 03 2014 :  03:41:30  Show Profile  Reply
Yes, you are correct - if I load the file with JPG extension - imageEn is rendering it OK.
Is there any way that I can determine image type when I load the image ?
Go to Top of Page

LukaL

Slovenia
13 Posts

Posted - Apr 03 2014 :  04:11:35  Show Profile  Reply
Hi,

nevermind my last question. I've used the code from this thread : http://www.delphipages.com/forum/showthread.php?t=174008

And it's working now.

Thank you for you help!
Go to Top of Page

w2m

USA
1990 Posts

Posted - Apr 03 2014 :  07:51:31  Show Profile  Reply
You would be better off using FindFileFormat which includes all supported ImageEnIO file types:

Declaration

function FindFileFormat(const FileName: WideString; VerifyExtension: Boolean): TIOFileType;

Description

Returns the file format of the specified file by reading the file and trying to recognize the file header.

If VerifyExtension is False, then FindFileFormat function doesn't use the file extension to determine the format. FineFileFormat uses FindStreamFormat to detect image format from file header.

Example

function GetFileType(AFilename): TIOFileType;
begin
  Result := FindFileFormat(AFilename, false);
end;

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

LukaL

Slovenia
13 Posts

Posted - Apr 03 2014 :  23:27:33  Show Profile  Reply
Yes, your solution is more clean - I'm going to use it.

Thanks for all your help.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: