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
 TIEMultiBitmap can't load this JPG
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Dany

65 Posts

Posted - Dec 09 2024 :  07:30:31  Show Profile  Reply
Hello;

TIEMultiBitmap can't load the attached JPG (I sent it into a zip).

attach/Dany/202412972924_test.zip
175.42 KB

Example code:

procedure TForm23.Button1Click(Sender: TObject);
begin
 with TIEMultiBitmap.Create do
 try
   if not Read('TEST.JPG') then
     ShowMessage('Error')
   else
     ShowMessage('ok');
 finally
   free
 end;
end;

Regards!

xequte

38682 Posts

Posted - Dec 09 2024 :  16:21:40  Show Profile  Reply
Hi Dany

Any time you find an image that does not load (in ImageEn or elsewhere), examine it in a hex or text editor and look at the magic string. You will see that this one, despite having the extension .JPG is actually a PNG file.

To make TIEMultiBitmap load images even if they have the incorrect file extension, you need to enable the bCheckUnknown parameter for Read/LoadFromFile()

http://www.imageen.com/help/TIEMultiBitmap.LoadFromFile.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Dany

65 Posts

Posted - Dec 09 2024 :  19:24:19  Show Profile  Reply
Hi Nigel;
Before asking, I already saw the file at low level founding that it say is PGN; so before asking I changed the extension to PGN, but TIEMultiBitmap can't load it. I also see that the old and well known :) MS-Paint can load it.
Go to Top of Page

xequte

38682 Posts

Posted - Dec 09 2024 :  23:15:46  Show Profile  Reply
Hi Dany

Did you enable the bCheckUnknown parameter?

This works fine for me:

 with TIEMultiBitmap.Create do
 try
   if not Read( 'D:\TEST.JPG', nil, True ) then
     ShowMessage('Error')
   else
     ShowMessage('ok');
 finally
   free
 end;


This also works fine (note: extension needs to be "PNG"):

 RenameFile( 'D:\TEST.JPG', 'D:\TEST.PNG' );
 with TIEMultiBitmap.Create do
 try
   if not Read( 'D:\TEST.PNG' ) then
     ShowMessage('Error')
   else
     ShowMessage('ok');
 finally
   free
 end;


Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Dany

65 Posts

Posted - Dec 10 2024 :  06:35:45  Show Profile  Reply
Read( 'D:\TEST.JPG', nil, True ) works.
But renaming to PNG does not work.
Go to Top of Page

xequte

38682 Posts

Posted - Dec 10 2024 :  16:20:40  Show Profile  Reply
I'm sorry, I don't see that.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Dany

65 Posts

Posted - Dec 11 2024 :  08:28:15  Show Profile  Reply
Maybe some environment diference?. The test is the same .....
Go to Top of Page

xequte

38682 Posts

Posted - Dec 12 2024 :  02:50:38  Show Profile  Reply
Please attach your test.png and let me test it again.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Dany

65 Posts

Posted - Dec 12 2024 :  12:55:01  Show Profile  Reply
Here is the TEST.PNG file.

Go to Top of Page

Dany

65 Posts

Posted - Dec 12 2024 :  13:00:32  Show Profile  Reply
Here the same file into a ZIP.

attach/Dany/20241212125844_test.zip
175.42 KB
Go to Top of Page

xequte

38682 Posts

Posted - Dec 15 2024 :  22:56:41  Show Profile  Reply
Yes, this works fine in our testing. I cannot explain the reason for the behavior on your side.

procedure TForm1.Button1Click(Sender: TObject);
var
  mbmp : TIEMultiBitmap;
begin
   mbmp := TIEMultiBitmap.Create;
   try
     if not mbmp.read( 'D:\TEST.PNG' ) then
       ShowMessage('Error')
     else
       ShowMessage('ok');
       ImageEnMView1.AssignEx( mbmp );
   finally
     mbmp.Free
   end;
 end;


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