FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour HEIC to JPG
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: HEIC to JPG
Posted: 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
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: HEIC to JPG
Posted: Thu Jul 02, 2020 11:25 AM

I sent

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: HEIC to JPG
Posted: Thu Jul 02, 2020 12:40 PM

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

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: HEIC to JPG
Posted: Thu Jul 02, 2020 01: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 (fw): Select all Collapse
#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




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
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM
Re: HEIC to JPG
Posted: Thu Jul 02, 2020 02: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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: HEIC to JPG
Posted: Thu Jul 02, 2020 05: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=3t=39120

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

&

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion