HEIC to JPG

Re: HEIC to JPG

Postby nageswaragunupudi » Thu Jul 02, 2020 10:16 am

Natter wrote:You don't need to rename the HEIC to JPG. The FIMakeThmbNail() function normally makes a thumbnail of the .HEIC file. also, the HEIC file is normally loaded in TIMAGE. Everything is good except that the orientation of the photo is lost. If you pre-convert the HEIC to JPG , the orientation is not lost


I have tested with latest downloaded freeimage.dll.
I am unable to view the heic file I downloaded with TImage.
Can you please share one or two heic files you are testing with me? Can you send to my email address
nageswaragunupudi [at] gmail [dot] com
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10313
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: HEIC to JPG

Postby Natter » Thu Jul 02, 2020 11:25 am

I sent
Natter
 
Posts: 1137
Joined: Mon May 14, 2007 9:49 am

Re: HEIC to JPG

Postby nageswaragunupudi » Thu Jul 02, 2020 12:40 pm

Thanks. I got two images. I will test and get back.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10313
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: HEIC to JPG

Postby nageswaragunupudi » Thu Jul 02, 2020 1:17 pm

For some reason, the heic sample file I downloaded was not working.
But I got two files from you and both of them working well with all the imaging functions of FWH, if FreeImage.dll is available.

Please try this sample program, which shows how to convert heic to jpg and to display them with XIMAGE.

Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local cHeic, cJpeg, oDlg, oImageH, oImageJ
   local x

   cHeic    := "image-30-06-20-08-07-9.heic"
   cJpeg    := cFileSetExt( cHeic, "jpg" )
   if FW_SaveImage( cHeic, cJpeg, 50 )
      ? cHeic + CRLF + " converted to " + CRLF + cJpeg
   else
      ? "Conversion failed"
   endif

   DEFINE DIALOG oDlg SIZE 860,400 PIXEL TRUEPIXEL TITLE ;
      FWVERSION + " : Conversion of Images HEIC to JPG"

   @  20, 20 XIMAGE oImageH FILE cHeic SIZE 400,300 OF oDlg
   @  20,440 XIMAGE oImageJ FILE cJpeg SIZE 400,300 OF oDlg

   @ 350, 20 SAY cHeic SIZE 400,20 PIXEL OF oDlg CENTER
   @ 350,440 SAY cJpeg SIZE 400,20 PIXEL OF oDlg CENTER

   ACTIVATE DIALOG oDlg CENTERED

return nil
 


Image

Use FW_SaveImage( cHeicfile, cJpegfile, nJpgQuality ) for silent conversion.
You can convert the images in batches also.
It is necessary that you need to have freeimage.dll in the exe path for (1) conversion and (2) directly read heic files andd display them
Once converted to jpg, you do not need freeimage.dll to read or display jpg files.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10313
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: HEIC to JPG

Postby Natter » Thu Jul 02, 2020 2:59 pm

Miracles ! I did exactly as you have, but still get a jpg rotated by 90 degrees. It may be the case in version freeimage.dll ? I have freeimage.dll it has a size of 2,084,864
Natter
 
Posts: 1137
Joined: Mon May 14, 2007 9:49 am

Re: HEIC to JPG

Postby nageswaragunupudi » Thu Jul 02, 2020 5:41 pm

I downloaded the latest freeimage.dll today and tested this program with it. dll size is 6,018,560.
After reading your post I tested with old dll provided in fwh\dll and fwh\samples folder size 2,084,864. With this old dll also I got the correct result.

Please try with the same file "image-30-06-20-08-07-9.heic"

You sent another file "image-30-06-20-08-07-3.heic" also to me.
This image has a problem. When we view with Windows fileexplorer, photos or paint, we see it upright in the correct orientation.
But when freeimage.dll (both old and new) reads it, it is rotated by 45 deg to the left.

This problem seems similar to
viewtopic.php?f=3&t=39120

Right now, I do not have any answer for this.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10313
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 42 guests