怎样获取图像(jpg)的尺寸,不是像素,而是文件大小.比如80cm-60cm
如题!我是想做一个按钮,点取按钮,得到图的路径.然后将图像的长和宽赋值给变量!!感谢!
2013-02-02 18:45
程序代码:lcImageName='c:\abc.jpg' Declare Integer GdipLoadImageFromFile In GDIPlus.Dll String wFilename, Integer @nImage Declare Integer GdipGetImageWidth In GDIPlus Integer img,Integer @ imgwidth Declare Integer GdipGetImageHeight In GDIPlus Integer img,Integer @ imgheight Declare Integer GdipDisposeImage In GDIPlus.Dll Long nativeImage Store 0 To nImage,nWidth,nHeight GdipLoadImageFromFile(Strconv(lcImageName+Chr(0),5),@nImage) GdipGetImageWidth(nImage,@nWidth) GdipGetImageHeight(nImage,@nHeight) GdipDisposeImage(nImage) ?'图片宽度:',nWidth ?'图片高度:',nHeight像素与显示器的分辨率有关系,一般1厘米约为28像素,自己换算吧

2013-02-02 19:04
2013-02-02 21:02
2013-02-02 21:05
2013-02-02 21:06
程序代码:picsize(参数1[,参数2])
参数说明:
参数1:字符型,指定需要返回大小的图片文件名,如果文件不在当前搜索路径下,请指定全路径。
参数2:字符型可选参数,默认返回图片宽度,当指定参数"h"时,返回图片高度
返回值:数值型。
如果忽略第一个参数,或参数指定的文件不存在,返回0
忽略第二个参数,或第二个参数不是"h",返回图片宽度,否则返回图片高度
sample:
?picsize("c:\windows\tulips.jpg")
800
?picsize("c:\windows\tulips.jpg","h")
600
?picsize("c:\windows\")
0
*代码:
PARAMETERS pict,wh
IF TYPE("pict")<>"C" or !FILE(pict)
return
ENDIF
IF TYPE("wh")<>"C" &&参数类型容错
wh="w" &&默认返回图片宽度
ENDIF
PRIVATE picw,pich
STORE 0 to picw,pich
picform=CREATEOBJECT("form")
picform.addobject("pic","image")
WITH picform.pic
.width=0
.height=0
.stretch=0
.picture=pict
ENDWITH
picw=picform.pic.width
pich=picform.pic.height
picform.release
IF wh="h"
RETURN pich
ELSE
RETURN picw
ENDIF

2013-02-02 21:11
2013-02-02 21:29
2013-02-02 21:36
2013-02-02 21:42
2013-02-02 21:43