Size of bitmaps
Size of bitmaps
I need to control if the user insert a 16x16 bitmap .
How I can to control it ?
How I can to control it ?
Best Regards, Saludos
Falconi Silvio
Falconi Silvio
Re: Size of bitmaps
Silvio,
LOCAL cWidth := ""
LOCAL cHeight := ""
cOldImg := ???? ( Restore if NO File selected !!! )
...
...
@ 5, 465 BTNBMP oBtn FILENAME c_path + "\Bitmaps\Text.bmp" ;
SIZE 40, 38 OF oDlg PIXEL NOBORDER ; // Width , Height
TOP ;
PROMPT " &Select Img" ;
FONT oFont ;
ACTION ( cFilter := "ALL (*.*)| *.*|" + ;
"JPG (*.jpg)|*.jpg|" + ;
"BMP (*.bmp)|*.bmp|" + ;
"PNG (*.png)| *.png|" + ;
"DIB (*.dib)| *.dib|" + ;
"ICO (*.ico)| *.ico|" + ;
"PCX (*.pcx)| *.pcx|" + ;
"JPEG (*.jpg)| *.jpg|" + ;
"GIF (*.gif)| *.gif|" + ;
"TIF (*.tif)| *.tif|" + ;
"PSD (*.psd)| *.psd|" + ;
"PCD (*.pcd)| *.pcd|" + ;
"TARGA (*.tga)| *.tga|" + ;
"RLE (*.rle)| *.rle|", ;
cNewImg := cGetFile32( cFilter,"Select a Picture",,"\" + CurDir() ), ;
IMG_SIZE(cNewImg), ;
MsgAlert( "Height : " + cHeight + CRLF + "Width : " + cWidth, "Image-size" ), ;
IIF( empty( cNewImg ), ( MsgAlert( "No file selected !","ATTENTION" ), cIMAGE := cOldImg ), NIL ), ;
cIMAGE := cFileNoPath( cNewImg ) )
oBtn:cToolTip = { "Select a " + CRLF + "Image", "Image-Selection", 1, CLR_BLACK, 14089979 }
...
...
// ------------------
FUNCTION IMG_SIZE(cImgName)
LOCAL oImage
DEFINE IMAGE oImage FILENAME cImgname
cWidth := ALLTRIM(STR(oImage:nWidth()))
cHeight := ALLTRIM(STR(oImage:nHeight()))
oImage:End()
RETURN NIL
Best Regards
Uwe![Laughing :lol:](./images/smilies/icon_lol.gif)
LOCAL cWidth := ""
LOCAL cHeight := ""
cOldImg := ???? ( Restore if NO File selected !!! )
...
...
@ 5, 465 BTNBMP oBtn FILENAME c_path + "\Bitmaps\Text.bmp" ;
SIZE 40, 38 OF oDlg PIXEL NOBORDER ; // Width , Height
TOP ;
PROMPT " &Select Img" ;
FONT oFont ;
ACTION ( cFilter := "ALL (*.*)| *.*|" + ;
"JPG (*.jpg)|*.jpg|" + ;
"BMP (*.bmp)|*.bmp|" + ;
"PNG (*.png)| *.png|" + ;
"DIB (*.dib)| *.dib|" + ;
"ICO (*.ico)| *.ico|" + ;
"PCX (*.pcx)| *.pcx|" + ;
"JPEG (*.jpg)| *.jpg|" + ;
"GIF (*.gif)| *.gif|" + ;
"TIF (*.tif)| *.tif|" + ;
"PSD (*.psd)| *.psd|" + ;
"PCD (*.pcd)| *.pcd|" + ;
"TARGA (*.tga)| *.tga|" + ;
"RLE (*.rle)| *.rle|", ;
cNewImg := cGetFile32( cFilter,"Select a Picture",,"\" + CurDir() ), ;
IMG_SIZE(cNewImg), ;
MsgAlert( "Height : " + cHeight + CRLF + "Width : " + cWidth, "Image-size" ), ;
IIF( empty( cNewImg ), ( MsgAlert( "No file selected !","ATTENTION" ), cIMAGE := cOldImg ), NIL ), ;
cIMAGE := cFileNoPath( cNewImg ) )
oBtn:cToolTip = { "Select a " + CRLF + "Image", "Image-Selection", 1, CLR_BLACK, 14089979 }
...
...
// ------------------
FUNCTION IMG_SIZE(cImgName)
LOCAL oImage
DEFINE IMAGE oImage FILENAME cImgname
cWidth := ALLTRIM(STR(oImage:nWidth()))
cHeight := ALLTRIM(STR(oImage:nHeight()))
oImage:End()
RETURN NIL
Best Regards
Uwe
![Laughing :lol:](./images/smilies/icon_lol.gif)
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: Size of bitmaps
ok now I correct on this
@ 38, 263 BUTTON oBtnSel PROMPT "..." OF oDlg PIXEL SIZE 10, 9 ;
ACTION ( cFile:=cGetFile( "*.*", "Select a file" ),;
iif(Image_size(cFile), MsgAlert( "Dimensione non consentita" ),;
cTabImage:= relativePath( cFile )+cFileNoPath( cFile )) ,;
aGet[3]:refresh())
....
FUNCTION Image_size(cImgname)
LOCAL oImage
local lreturn :=.f.
DEFINE IMAGE oImage FILENAME cImgname
cWidth := ALLTRIM(STR(oImage:nWidth()))
cHeight := ALLTRIM(STR(oImage:nHeight()))
oImage:End()
IF val(cHeight) >16 .and. val(cWidth) >16
MsgAlert( "Height : " + cHeight + CRLF + "Width : " + cWidth, "Image-size" )
lreturn :=.t.
else
lreturn :=.f.
endif
RETURN lreturn
and run ok GOOD MR UWE
@ 38, 263 BUTTON oBtnSel PROMPT "..." OF oDlg PIXEL SIZE 10, 9 ;
ACTION ( cFile:=cGetFile( "*.*", "Select a file" ),;
iif(Image_size(cFile), MsgAlert( "Dimensione non consentita" ),;
cTabImage:= relativePath( cFile )+cFileNoPath( cFile )) ,;
aGet[3]:refresh())
....
FUNCTION Image_size(cImgname)
LOCAL oImage
local lreturn :=.f.
DEFINE IMAGE oImage FILENAME cImgname
cWidth := ALLTRIM(STR(oImage:nWidth()))
cHeight := ALLTRIM(STR(oImage:nHeight()))
oImage:End()
IF val(cHeight) >16 .and. val(cWidth) >16
MsgAlert( "Height : " + cHeight + CRLF + "Width : " + cWidth, "Image-size" )
lreturn :=.t.
else
lreturn :=.f.
endif
RETURN lreturn
and run ok GOOD MR UWE
Best Regards, Saludos
Falconi Silvio
Falconi Silvio
Re: Size of bitmaps
Silvio,
something special ( maybe You like it ) :
![Image](http://www.pflegeplus.com/pictures/img1.jpg)
After Selection :
![Image](http://www.pflegeplus.com/pictures/img2.jpg)
Best Regards
Uwe![Question :?:](./images/smilies/icon_question.gif)
something special ( maybe You like it ) :
![Image](http://www.pflegeplus.com/pictures/img1.jpg)
After Selection :
![Image](http://www.pflegeplus.com/pictures/img2.jpg)
Code: Select all | Expand
FUNCTION MAIN()
LOCAL oDlg, oBtn, oGrp, aGet[3]
LOCAL cTabCodice := SPACE(10)
LOCAL cTabDesc := SPACE(10)
LOCAL cTabImage := SPACE(10)
LOCAL oBmp
c_path := CURDRIVE() + ":\" + GETCURDIR()
cImgname := c_path + "\Bitmaps\Help.bmp"
cWidth := "16"
cHeight := "16"
DEFINE DIALOG oDlg FROM 100, 100 TO 258,808;
TITLE "MODIFY" PIXEL
@ 0, 4 GROUP oGrp TO 56, 350 OF oDlg PIXEL
@ 12, 10 SAY "Codice:" OF oDlg SIZE 24, 8 PIXEL
@ 10, 39 GET aGet[1] var cTabCodice OF oDlg SIZE 25, 12 PIXEL READONLY
@ 26, 10 SAY "Descri:" OF oDlg SIZE 22, 8 PIXEL
@ 24, 39 GET aGet[2] var cTabDesc OF oDlg SIZE 305, 12 PIXEL
@ 40, 10 SAY "Image:" OF oDlg SIZE 21, 8 PIXEL
@ 38, 39 GET aGet[3] var cTabImage OF oDlg SIZE 205, 12 PIXEL
@ 36, 250 BTNBMP oBtnSel OF oDlg 2007 ;
FILE cImgName ;
SIZE 18, 18 ;
ACTION ( cFilter := "ALL (*.*)| *.*|" + ;
"JPG (*.jpg)|*.jpg|" + ;
"BMP (*.bmp)|*.bmp|" + ;
"RLE (*.rle)| *.rle|", ;
cImgName := cGetFile32( cFilter,"Select a Picture",,"\" + CurDir() ), ;
IMG_SIZE(cImgName), ;
IIF( empty( cImgName ), MsgAlert( "No file selected !","ATTENTION" ), NIL ), ;
cIMAGE := cFileNoPath( cImgName ), ;
cSUBDIR := cFileSubDir( cImgName ), ;
cTabImage := cImage, aGet[3]:Refresh(), ;
oBtnSel:SetFile( cImgName ) )
oBtnSel:lTransparent := .T.
oBtnSel:cToolTip = { "Width : " + cWidth + CRLF + "Height : " + cHeight, "Bmp-size", 1, CLR_BLACK, 14089979 }
@ 60, 160 BUTTON oBtn PROMPT "&Conferma" OF oDlg SIZE 42, 14 PIXEL DEFAULT ACTION ( oDlg:end( IDOK ) )
@ 60, 211 BUTTON oBtn PROMPT "An&nulla" OF oDlg SIZE 42, 14 PIXEL CANCEL ACTION ( oDlg:end( IDCANCEL ) )
ACTIVATE DIALOG oDlg
RETURN( NIL )
// ------------------
FUNCTION IMG_SIZE(cImgName)
LOCAL oImage
DEFINE IMAGE oImage FILENAME cImgname
cWidth := ALLTRIM(STR(oImage:nWidth()))
cHeight := ALLTRIM(STR(oImage:nHeight()))
oImage:End()
RETURN NIL
Best Regards
Uwe
![Question :?:](./images/smilies/icon_question.gif)
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: Size of bitmaps
I tried the codes below:
FUNCTION MAIN()
LOCAL oDlg, oBtn, oGrp, aGet[3]
LOCAL cTabCodice := SPACE(10)
LOCAL cTabDesc := SPACE(10)
LOCAL cTabImage := SPACE(10)
LOCAL oBmp
c_path := CURDRIVE() + ":\" + GETCURDIR()
cImgname := c_path + "\Bitmaps\Help.bmp"
cWidth := "16"
cHeight := "16"
DEFINE DIALOG oDlg FROM 100, 100 TO 258,808;
TITLE "MODIFY" PIXEL
@ 0, 4 GROUP oGrp TO 56, 350 OF oDlg PIXEL
@ 12, 10 SAY "Codice:" OF oDlg SIZE 24, 8 PIXEL
@ 10, 39 GET aGet[1] var cTabCodice OF oDlg SIZE 25, 12 PIXEL READONLY
@ 26, 10 SAY "Descri:" OF oDlg SIZE 22, 8 PIXEL
@ 24, 39 GET aGet[2] var cTabDesc OF oDlg SIZE 305, 12 PIXEL
@ 40, 10 SAY "Image:" OF oDlg SIZE 21, 8 PIXEL
@ 38, 39 GET aGet[3] var cTabImage OF oDlg SIZE 205, 12 PIXEL
@ 36, 250 BTNBMP oBtnSel OF oDlg 2007 ;
FILE cImgName ;
SIZE 18, 18 ;
ACTION ( cFilter := "ALL (*.*)| *.*|" + ;
"JPG (*.jpg)|*.jpg|" + ;
"BMP (*.bmp)|*.bmp|" + ;
"RLE (*.rle)| *.rle|", ;
cImgName := cGetFile32( cFilter,"Select a Picture",,"\" + CurDir() ), ;
IMG_SIZE(cImgName), ;
IIF( empty( cImgName ), MsgAlert( "No file selected !","ATTENTION" ), NIL ), ;
cIMAGE := cFileNoPath( cImgName ), ;
cSUBDIR := cFileSubDir( cImgName ), ;
cTabImage := cImage, aGet[3]:Refresh(), ;
oBtnSel:SetFile( cImgName ) )
oBtnSel:lTransparent := .T.
oBtnSel:cToolTip = { "Width : " + cWidth + CRLF + "Height : " + cHeight, "Bmp-size", 1, CLR_BLACK, 14089979 }
@ 60, 160 BUTTON oBtn PROMPT "&Conferma" OF oDlg SIZE 42, 14 PIXEL DEFAULT ACTION ( oDlg:end( IDOK ) )
@ 60, 211 BUTTON oBtn PROMPT "An&nulla" OF oDlg SIZE 42, 14 PIXEL CANCEL ACTION ( oDlg:end( IDCANCEL ) )
ACTIVATE DIALOG oDlg
RETURN( NIL )
// ------------------
FUNCTION IMG_SIZE(cImgName)
LOCAL oImage
DEFINE IMAGE oImage FILENAME cImgname
cWidth := ALLTRIM(STR(oImage:nWidth()))
cHeight := ALLTRIM(STR(oImage:nHeight()))
oImage:End()
RETURN NIL
*************************
I can only see the display for bmp files. How to display jpg files using the above codes ?
Regards
Eddy
FUNCTION MAIN()
LOCAL oDlg, oBtn, oGrp, aGet[3]
LOCAL cTabCodice := SPACE(10)
LOCAL cTabDesc := SPACE(10)
LOCAL cTabImage := SPACE(10)
LOCAL oBmp
c_path := CURDRIVE() + ":\" + GETCURDIR()
cImgname := c_path + "\Bitmaps\Help.bmp"
cWidth := "16"
cHeight := "16"
DEFINE DIALOG oDlg FROM 100, 100 TO 258,808;
TITLE "MODIFY" PIXEL
@ 0, 4 GROUP oGrp TO 56, 350 OF oDlg PIXEL
@ 12, 10 SAY "Codice:" OF oDlg SIZE 24, 8 PIXEL
@ 10, 39 GET aGet[1] var cTabCodice OF oDlg SIZE 25, 12 PIXEL READONLY
@ 26, 10 SAY "Descri:" OF oDlg SIZE 22, 8 PIXEL
@ 24, 39 GET aGet[2] var cTabDesc OF oDlg SIZE 305, 12 PIXEL
@ 40, 10 SAY "Image:" OF oDlg SIZE 21, 8 PIXEL
@ 38, 39 GET aGet[3] var cTabImage OF oDlg SIZE 205, 12 PIXEL
@ 36, 250 BTNBMP oBtnSel OF oDlg 2007 ;
FILE cImgName ;
SIZE 18, 18 ;
ACTION ( cFilter := "ALL (*.*)| *.*|" + ;
"JPG (*.jpg)|*.jpg|" + ;
"BMP (*.bmp)|*.bmp|" + ;
"RLE (*.rle)| *.rle|", ;
cImgName := cGetFile32( cFilter,"Select a Picture",,"\" + CurDir() ), ;
IMG_SIZE(cImgName), ;
IIF( empty( cImgName ), MsgAlert( "No file selected !","ATTENTION" ), NIL ), ;
cIMAGE := cFileNoPath( cImgName ), ;
cSUBDIR := cFileSubDir( cImgName ), ;
cTabImage := cImage, aGet[3]:Refresh(), ;
oBtnSel:SetFile( cImgName ) )
oBtnSel:lTransparent := .T.
oBtnSel:cToolTip = { "Width : " + cWidth + CRLF + "Height : " + cHeight, "Bmp-size", 1, CLR_BLACK, 14089979 }
@ 60, 160 BUTTON oBtn PROMPT "&Conferma" OF oDlg SIZE 42, 14 PIXEL DEFAULT ACTION ( oDlg:end( IDOK ) )
@ 60, 211 BUTTON oBtn PROMPT "An&nulla" OF oDlg SIZE 42, 14 PIXEL CANCEL ACTION ( oDlg:end( IDCANCEL ) )
ACTIVATE DIALOG oDlg
RETURN( NIL )
// ------------------
FUNCTION IMG_SIZE(cImgName)
LOCAL oImage
DEFINE IMAGE oImage FILENAME cImgname
cWidth := ALLTRIM(STR(oImage:nWidth()))
cHeight := ALLTRIM(STR(oImage:nHeight()))
oImage:End()
RETURN NIL
*************************
I can only see the display for bmp files. How to display jpg files using the above codes ?
Regards
Eddy
Re: Size of bitmaps
I can select any image format on my application here
and I see the size the image also jpg
perhaps you made a small mistake... see the function Image_size(cImgname)
mine is not as you wrote in your message
and I see the size the image also jpg
perhaps you made a small mistake... see the function Image_size(cImgname)
mine is not as you wrote in your message
Best Regards, Saludos
Falconi Silvio
Falconi Silvio
Re: Size of bitmaps
Maybe missing ?
FREEIMAGE.DLL is needed to display other Formats.
#include "FiveWin.ch"
#include "Image.ch"
Best Regards
Uwe![Question :?:](./images/smilies/icon_question.gif)
FREEIMAGE.DLL is needed to display other Formats.
#include "FiveWin.ch"
#include "Image.ch"
Best Regards
Uwe
![Question :?:](./images/smilies/icon_question.gif)
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
i work with FW.
If you have any questions about special functions, maybe i can help.
Re: Size of bitmaps
no uwe
if the oimage is closed and before he not saved the values of sizes of image then he cannot show these value
the error is on image_size() function or on the get there is an error
I made and here run ok:
@ 40, 10 SAY "Image:" OF oDlg SIZE 21, 8 PIXEL
@ 38, 39 GET aGet[3] var cTabImage OF oDlg SIZE 145, 12 PIXEL
@ 38, 186 BUTTON oBtnSel PROMPT "=>" OF oDlg PIXEL SIZE 10, 12 ;
ACTION ( cFile:=cGetFile( "*.*", "Select a file" ),;
iif(Image_size(cFile), MsgAlert( "Immagine non consentita.@@@ Sono consentite solo le immagini@@@ con risoluzione 16X16 con formato BITMAP" ),;
cTabImage:= relativePath( cFile )+cFileNoPath( cFile )) ,;
aGet[3]:refresh())
FUNCTION Image_size(cImgname)
LOCAL oImage
local lreturn :=.f.
DEFINE IMAGE oImage FILENAME cImgname
cWidth := ALLTRIM(STR(oImage:nWidth()))
cHeight := ALLTRIM(STR(oImage:nHeight()))
oImage:End()
IF val(cHeight) >16 .and. val(cWidth) >16
MsgAlert( "Le misure dell'immagine selezionata sono:@@@ Altezza => " + cHeight +;
CRLF + "Larghezza => " + cWidth, "Dimensioni immagine selezionata" )
lreturn :=.t.
else
lreturn :=.f.
endif
RETURN lreturn
if the oimage is closed and before he not saved the values of sizes of image then he cannot show these value
the error is on image_size() function or on the get there is an error
I made and here run ok:
@ 40, 10 SAY "Image:" OF oDlg SIZE 21, 8 PIXEL
@ 38, 39 GET aGet[3] var cTabImage OF oDlg SIZE 145, 12 PIXEL
@ 38, 186 BUTTON oBtnSel PROMPT "=>" OF oDlg PIXEL SIZE 10, 12 ;
ACTION ( cFile:=cGetFile( "*.*", "Select a file" ),;
iif(Image_size(cFile), MsgAlert( "Immagine non consentita.@@@ Sono consentite solo le immagini@@@ con risoluzione 16X16 con formato BITMAP" ),;
cTabImage:= relativePath( cFile )+cFileNoPath( cFile )) ,;
aGet[3]:refresh())
FUNCTION Image_size(cImgname)
LOCAL oImage
local lreturn :=.f.
DEFINE IMAGE oImage FILENAME cImgname
cWidth := ALLTRIM(STR(oImage:nWidth()))
cHeight := ALLTRIM(STR(oImage:nHeight()))
oImage:End()
IF val(cHeight) >16 .and. val(cWidth) >16
MsgAlert( "Le misure dell'immagine selezionata sono:@@@ Altezza => " + cHeight +;
CRLF + "Larghezza => " + cWidth, "Dimensioni immagine selezionata" )
lreturn :=.t.
else
lreturn :=.f.
endif
RETURN lreturn
Best Regards, Saludos
Falconi Silvio
Falconi Silvio
Re: Size of bitmaps
OR GOOD THIS:
@ 38, 186 BUTTON oBtnSel PROMPT "=>" OF oDlg PIXEL SIZE 10, 12 ;
ACTION ( cFile:=cGetFile( "*.*", "Select a file" ),;
iif(Image_size(cFile,16,16), MsgAlert( "Immagine non consentita.@@@ Sono consentite solo le immagini@@@ con risoluzione 16X16 con formato BITMAP" ),;
cTabImage:= relativePath( cFile )+cFileNoPath( cFile )) ,;
aGet[3]:refresh())
//USAGE Image_size(NAME OF IMAGE,HEIGHT OF IMAGE , WITH OF IMAGE)
FUNCTION Image_size(cImgname,XF,yf)
LOCAL oImage
local lreturn :=.f.
DEFAULT XF:= 16,;
Yf:=16
DEFINE IMAGE oImage FILENAME cImgname
cWidth := ALLTRIM(STR(oImage:nWidth()))
cHeight := ALLTRIM(STR(oImage:nHeight()))
oImage:End()
IF val(cHeight) >XF .and. val(cWidth) >YF
MsgAlert( "Le misure dell'immagine selezionata sono:@@@ Altezza => " + cHeight +;
CRLF + "Larghezza => " + cWidth, "Dimensioni immagine selezionata" )
lreturn :=.t.
else
lreturn :=.f.
endif
RETURN lreturn
@ 38, 186 BUTTON oBtnSel PROMPT "=>" OF oDlg PIXEL SIZE 10, 12 ;
ACTION ( cFile:=cGetFile( "*.*", "Select a file" ),;
iif(Image_size(cFile,16,16), MsgAlert( "Immagine non consentita.@@@ Sono consentite solo le immagini@@@ con risoluzione 16X16 con formato BITMAP" ),;
cTabImage:= relativePath( cFile )+cFileNoPath( cFile )) ,;
aGet[3]:refresh())
//USAGE Image_size(NAME OF IMAGE,HEIGHT OF IMAGE , WITH OF IMAGE)
FUNCTION Image_size(cImgname,XF,yf)
LOCAL oImage
local lreturn :=.f.
DEFAULT XF:= 16,;
Yf:=16
DEFINE IMAGE oImage FILENAME cImgname
cWidth := ALLTRIM(STR(oImage:nWidth()))
cHeight := ALLTRIM(STR(oImage:nHeight()))
oImage:End()
IF val(cHeight) >XF .and. val(cWidth) >YF
MsgAlert( "Le misure dell'immagine selezionata sono:@@@ Altezza => " + cHeight +;
CRLF + "Larghezza => " + cWidth, "Dimensioni immagine selezionata" )
lreturn :=.t.
else
lreturn :=.f.
endif
RETURN lreturn
Best Regards, Saludos
Falconi Silvio
Falconi Silvio
Re: Size of bitmaps
Thanks for the help
I put in:
#include "FiveWin.ch"
#include "Image.ch"
and select a 7 x 15 jpg.
But it still does not show.
Please help
Regards
acwoo
I put in:
#include "FiveWin.ch"
#include "Image.ch"
and select a 7 x 15 jpg.
But it still does not show.
Please help
Regards
acwoo
Re: Size of bitmaps
Thanks Silvio
I tried your code.
But it does not show the picture in the button, something perhaps like:
oBtnSel:SetFile( cImgName )
Regards
acwoo
I tried your code.
But it does not show the picture in the button, something perhaps like:
oBtnSel:SetFile( cImgName )
Regards
acwoo