Jpg Height and Width?

Post Reply
User avatar
Ugo
Posts: 283
Joined: Sat Oct 15, 2005 6:40 am
Location: Turin, Italy

Jpg Height and Width?

Post by Ugo »

Hi fw's,
is possible to know the dimensions (Height and Width) of an Jpg with Fwh?
Ciao, best regards,
Ugo
User avatar
Ugo
Posts: 283
Joined: Sat Oct 15, 2005 6:40 am
Location: Turin, Italy

Re: Jpg Height and Width?

Post by Ugo »

EnricoMaria wrote:Load it in a TImage control and then use nHeight() and nWidth() methods.
Enrico,
is possible to load only in memory?
(not in an object/resource?)
I want use this info only for know if the image is horizontal or vertical.

thank you.
Ciao, best regards,
Ugo
User avatar
Ugo
Posts: 283
Joined: Sat Oct 15, 2005 6:40 am
Location: Turin, Italy

Re: Jpg Height and Width?

Post by Ugo »

EnricoMaria wrote:Load it in a TImage control and then use nHeight() and nWidth() methods.
Enrico,
I test this code:

Code: Select all

oImg     := TImage():Define( , cImage, oDlg )
nHorDim  := oImg:nWidth() 
nVerDim  := oImg:nHeight()
oImg     := Nil     // is correct for release the lib?
MsgInfo( "Altezza " + cValToChar( nVerDim ) + CRLF +;
              "Larghezza " + cValToChar( nHorDim ), "" )
but the return is height 0 and width 0
in cImage there is a correct path and jpg file name,
use the standard nviewlib;
where is my error?

and

Code: Select all

oImg := Nil

is correct to release the lib?

Thank you.
Ciao, best regards,
Ugo
User avatar
Enrico Maria Giordano
Posts: 7356
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Jpg Height and Width?

Post by Enrico Maria Giordano »

This is a working sample:

Code: Select all

#include "Fivewin.ch"


STATIC hLib


FUNCTION MAIN()

    LOCAL oDlg, oImg

    DEFINE DIALOG oDlg

    @ 0,  1 BUTTON "Sizes" ACTION SHOWSIZES( oDlg )

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


STATIC FUNCTION SHOWSIZES( oDlg )

    LOCAL oImg := TImage():Define( , "SFONDO.JPG", oDlg )

    ? oImg:nWidth(), oImg:nHeight()

    oImg:End()

    RETURN NIL
EMG
User avatar
Enrico Maria Giordano
Posts: 7356
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Jpg Height and Width?

Post by Enrico Maria Giordano »

Ugo wrote:

Code: Select all

oImg := Nil

is correct to release the lib?
No, you need oImg:End() or RELEASE IMAGE oImg.

EMG
User avatar
Ugo
Posts: 283
Joined: Sat Oct 15, 2005 6:40 am
Location: Turin, Italy

Re: Jpg Height and Width?

Post by Ugo »

EnricoMaria wrote:This is a working sample:
...
Enrico,
work but in any case return 0 and 0
it is correct?
Ciao, best regards,
Ugo
User avatar
Ugo
Posts: 283
Joined: Sat Oct 15, 2005 6:40 am
Location: Turin, Italy

Re: Jpg Height and Width?

Post by Ugo »

EnricoMaria wrote:No, you need oImg:End() or RELEASE IMAGE oImg.
:)
Thank you.
Ciao, best regards,
Ugo
User avatar
Enrico Maria Giordano
Posts: 7356
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Jpg Height and Width?

Post by Enrico Maria Giordano »

Ugo wrote:
EnricoMaria wrote:This is a working sample:
...
Enrico,
work but in any case return 0 and 0
it is correct?
Which cases? Can I reproduce the problem? How?

EMG
User avatar
Ugo
Posts: 283
Joined: Sat Oct 15, 2005 6:40 am
Location: Turin, Italy

Re: Jpg Height and Width?

Post by Ugo »

EnricoMaria wrote:Which cases? Can I reproduce the problem? How?
Yes, the case is the jpg create from my camera! :wink:

Can I send to your mail?
Ciao, best regards,
Ugo
Post Reply