FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour resolution of a JPG
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
resolution of a JPG
Posted: Fri Dec 02, 2022 03:43 PM

Hello friends,

How can I get the resolution of a JPG?

I want to remember that I read here that it can be done without opening and reading the photo.

Best regards,

Otto

Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: resolution of a JPG
Posted: Sat Dec 03, 2022 12:17 PM
Marc Venken

Using: FWH 23.08 with Harbour
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: resolution of a JPG
Posted: Sat Dec 03, 2022 08:39 PM
Hello Marc,

Thanks. With the help of your link, I remembered that I already solved the problem with modHarbour and a JS LIB.
Thanks again.
Should also work with WEBVIEW2.
Here is the link to the library:
https://github.com/exif-js/exif-js

Best regards,
Otto
PS: That's where forensics starts.

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: resolution of a JPG
Posted: Sat Dec 03, 2022 08:55 PM
Hello Marc,
now I remember.
I wanted to program a working time recording.
A display shows a clock with a QR code that changes every 10 sec.

When an employee scans the QR code and follows the link, the photo is sent to the server and the metadata is read out.

If the picture is older than e.g. 10 sec. then the server reports that the capture was not correct.
This means that the employee must be on-site because he needs the current link and must send immediately.

Best regards,
Otto

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: resolution of a JPG
Posted: Sat Dec 03, 2022 09:09 PM
...
The program is still working:
https://winhotel.space/qrcodejs-master/index-svg.prg

Best regards,
Otto
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: resolution of a JPG
Posted: Sun Dec 04, 2022 01:15 PM

Great !

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: resolution of a JPG
Posted: Sun Dec 04, 2022 01:15 PM

Great !

Regards



G. N. Rao.

Hyderabad, India
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: resolution of a JPG
Posted: Sun Dec 04, 2022 01:48 PM

Dear Mr. Rao,

Hearing that from you means a lot to me.

Have a nice Sunday.

Best regards,

Otto

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: resolution of a JPG
Posted: Sat Dec 31, 2022 10:40 PM
Otto wrote:Hello friends,
How can I get the resolution of a JPG?

I want to remember that I read here that it can be done without opening and reading the photo.

Best regards,
Otto
FWH function
Code (fw): Select all Collapse
JpegDim( cFileJpg ) // --> { nWidth, nHeight }
Source: fwh\source\function\imgtxtio.prg

Ofc, can not provide as much information as the exif.js
Regards



G. N. Rao.

Hyderabad, India
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: resolution of a JPG
Posted: Wed Jan 04, 2023 03:21 AM
hi Otto,

for Desktop App you can get Information of JPG File this Way
Code (fw): Select all Collapse
#include "fivewin.CH"
PROCEDURE MAIN
   MsgInfo( hb_valToExp( JpgMetaData("d:\Bilder\NASA\","02-spitzer-smc.jpg") ) )
RETURN

FUNCTION JpgMetaData( cPath, cFilename )
LOCAL aRet     := {}
LOCAL nItem, ii,iMax
LOCAL objShell := CreateObject( "Shell.Application" )
LOCAL objFolder
LOCAL objFolderItem
LOCAL cFileInfo
LOCAL cHeaderInfo
LOCAL aItems := {176,178,175,177}

   objFolder := objShell:Namespace( cPath )
   objFolderItem := objFolder:ParseName( cFilename )
   iMax := LEN(aItems)
   FOR ii := 1 TO iMax
      nItem := aItems[ii]
      cFileInfo := objFolder:GetDetailsOf( objFolderItem, nItem )
      cHeaderInfo := objFolder:GetDetailsOf( objFolder:Items, nItem )
      IF !EMPTY( cHeaderInfo ) .AND. !EMPTY( cFileInfo )
         AADD( aRet, { STRZERO( nItem, 3 ), cHeaderInfo, STRTRAN( cFileInfo , "?", "" ) } )
      ENDIF
   NEXT

   objFolderItem := NIL
   objFolder := NIL
   objShell := NIL

RETURN ACLONE( aRet )
greeting,

Jimmy

Continue the discussion