Jpg Height and Width?

Jpg Height and Width?

Postby Ugo » Sat Jan 14, 2006 5:43 pm

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?

Postby Enrico Maria Giordano » Sat Jan 14, 2006 6:59 pm

Load it in a TImage control and then use nHeight() and nWidth() methods.

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

Re: Jpg Height and Width?

Postby Ugo » Sun Jan 15, 2006 10:09 am

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?

Postby Ugo » Sun Jan 15, 2006 11:00 am

EnricoMaria wrote:Load it in a TImage control and then use nHeight() and nWidth() methods.

Enrico,
I test this code:
Code: Select all  Expand view
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  Expand view
oImg := Nil

is correct to release the lib?

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?

Postby Enrico Maria Giordano » Sun Jan 15, 2006 12:40 pm

This is a working sample:

Code: Select all  Expand view
#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: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Jpg Height and Width?

Postby Enrico Maria Giordano » Sun Jan 15, 2006 12:41 pm

Ugo wrote:
Code: Select all  Expand view
oImg := Nil

is correct to release the lib?


No, you need oImg:End() or RELEASE IMAGE oImg.

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

Re: Jpg Height and Width?

Postby Ugo » Sun Jan 15, 2006 1:41 pm

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?

Postby Ugo » Sun Jan 15, 2006 1:43 pm

EnricoMaria wrote:No, you need oImg:End() or RELEASE IMAGE oImg.


:)
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?

Postby Enrico Maria Giordano » Sun Jan 15, 2006 2:10 pm

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
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Jpg Height and Width?

Postby Ugo » Sun Jan 15, 2006 3:47 pm

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
User avatar
Ugo
 
Posts: 283
Joined: Sat Oct 15, 2005 6:40 am
Location: Turin, Italy



Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 52 guests