HEIC to JPG

User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: HEIC to JPG

Post by nageswaragunupudi »

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
Natter
Posts: 524
Joined: Mon May 14, 2007 9:49 am

Re: HEIC to JPG

Post by Natter »

I sent
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: HEIC to JPG

Post by nageswaragunupudi »

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

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

Re: HEIC to JPG

Post by nageswaragunupudi »

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

#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
Natter
Posts: 524
Joined: Mon May 14, 2007 9:49 am

Re: HEIC to JPG

Post by Natter »

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
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: HEIC to JPG

Post by nageswaragunupudi »

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
http://forums.fivetechsupport.com/viewt ... =3&t=39120

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

G. N. Rao.
Hyderabad, India
Post Reply