后面是jpg图,但不是用vfp转的,那是先看有没有可能满足你的要求,如果可以,就用vfp实现。图像格式转换是用Windows GDI完成的,只要满足要求,就可以用vfp调用GDI做出来。
这两天有点忙,有空给你写一个程序批量转换吧。
这两天有点忙,有空给你写一个程序批量转换吧。
授人以渔,不授人以鱼。
[此贴子已经被作者于2015-12-26 19:40编辑过]
** Test.prg DECLARE LONG StrDup IN Shlwapi STRING@ DECLARE LONG GdipLoadImageFromFile IN Gdiplus.dll STRING, LONG@ DECLARE LONG GdipSaveImageToFile IN Gdiplus.dll LONG, STRING, STRING, STRING DECLARE LONG GdipDisposeImage IN Gdiplus.dll LONG #DEFINE CLSID_JPG 0h01F47C55041AD3119A730000F81EF32E #DEFINE GUID_Quality 0hB5E45B1D4AFA2D459CDD5DB35105E7EB *sInFile = "C:\TEMP\Test\相片样本\032016100067.bmp" *sInFile = "C:\TEMP\Test\相片样本\032016100182.bmp" sInFile = "C:\TEMP\Test\相片样本\wujianxiong1212210850.bmp" sOutFile = "C:\TEMP\Test\相片样本\temp.jpg" _ImageConver(sInFile, sOutFile, 100) of = CREATEOBJECT("form") of.addobject("image1", "image") of.image1.picture = sOutFile of.image1.visible = .T. SET COMPATIBLE ON of.caption = "前 " + TRANSFORM(ROUND(FSIZE(sInFile) /1024,1)) + " KB "; + "后 " + TRANSFORM(ROUND(FSIZE(sOutFile)/1024,1)) + " KB" SET COMPATIBLE OFF of.show(1) CLEAR RESOURCES RETURN FUNCTION _ImageConver(sInFile, sOutFile, nValue) LOCAL pImage, sValue, tEP pImage = 0 GdipLoadImageFromFile(STRCONV(sInFile + 0h00, 5), @pImage) IF pImage > 0 sValue = BINTOC(nValue, "4RS") tEP = BINTOC(1, "4RS"); + GUID_Quality; + BINTOC(1, "4RS"); + BINTOC(4, "4RS"); + BINTOC(StrDup(@sValue), "4RS") GdipSaveImageToFile(pImage, STRCONV(sOutFile + 0h00,5), CLSID_JPG, @tEP) GdipDisposeImage(pImage) ELSE MESSAGEBOX("载入图片 " + sInFile + " 失败", "提示") ENDIF ENDFUNC
[此贴子已经被作者于2015-12-27 08:31编辑过]