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
 ImageEnView PNG TO JPG
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

save0804

Korea
20 Posts

Posted - Nov 07 2023 :  19:42:11  Show Profile  Reply
ImageEnView1.IO.LoadFromFile(OpenPictureDialog1.FileName);
ImageEnView1.IO.Params.JPEG_Quality := 95;
ImageEnView1.IO.SaveToFile(OpenPictureDialog1.FileName + '.JPG');


ImageEnView2.IO.LoadFromFile(OpenPictureDialog1.FileName + '.JPG');


I load a PNG file into ImageEnView1, save it as a JPG file, and load the JPG file again into ImageEnView2. How do I directly insert the JPG file into ImageEnView2 without saving and reloading?

xequte

38341 Posts

Posted - Nov 07 2023 :  21:07:23  Show Profile  Reply
Hi

Please use:

ImageEnView1.Assign( ImageEnView2 );

http://www.imageen.com/help/TImageEnView.Assign.html

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

save0804

Korea
20 Posts

Posted - Nov 08 2023 :  01:36:30  Show Profile  Reply
If you do this, the png file will still be imported. What I want is to bring a converted jpg file.
Go to Top of Page

xequte

38341 Posts

Posted - Nov 08 2023 :  02:27:06  Show Profile  Reply
Hi

Are you trying display the image as it will appear as a saved JPEG?

In that case you do need to save it. You could save it to a stream if you don't want to use a temporary file.

Something like:

  ms := TMemoryStream.Create();
  try
    ImageEnView1.IO.SaveToStreamJpeg( ms );
    ms.Position := 0;
    ImageEnView2.IO.LoadFromStreamJpeg( ms );
  finally
    ms.Free();
  end;



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