能在新的目录下批量修改,初步成功,就是显示原照片与新照片不成功。附上代码,请指教。
cd d:\51016
use ls
SCAN
=resizeimage([d:\51016\]+photo,[d:\5101\]+photo,400,300)
ENDSCAN
Declare INTEGER ShellExecute IN shell32;
INTEGER hwnd, STRING lpOperation,;
STRING lpFile, STRING lpParameters,;
STRING lpDirectory, INTEGER nShowCmd
= ShellExecute (0, [open], [d:\51016\510160001.jpg],[],[], 3) && 此处代码没有起作用,不显示原图
=INKEY(2) && 等待2秒钟再查看新图
= ShellExecute (0, [open], [d:\5101\510160001.jpg],[],[], 3) && 此处代码没有起作用,不显示新图
*******************************************
*算法制作:行者孙(QQ:310727570)
*******************************************
FUNCTION RESIZEIMAGE
PARAMETERS
pSourceFileNAme,pNewFileNAme,nWidth,nHeight
DECLARE INTEGER GdiplusStartup IN gdiplus INTEGER @token, STRING @INPUT, INTEGER OUTPUT
LOCAL hToken, cInput
hToken = 0
cInput = PADR(CHR(1), 16, CHR(0))
GdiplusStartup(@hToken, @cInput, 0)
DECLARE INTEGER GdipLoadImageFromFile IN gdiplus.DLL STRING wFilename, INTEGER @nImage
LOCAL nImage
nImage = 0
GdipLoadImageFromFile(STRCONV(pSourceFileNAme + CHR(0), 5), @nImage)
#DEFINE
GDIPLUS_PIXELFORMAT_32bppARGB
0x0026200A
DECLARE INTEGER GdipCreateBitmapFromScan0 IN gdiplus.DLL ;
INTEGER nWidth, INTEGER nHeight, INTEGER nStride;
, INTEGER nPixelFormat, STRING @cScan0, INTEGER @nImage
LOCAL nBitmap, nX, nY
nBitmap = 0
nX = 0
nY = 0
GdipCreateBitmapFromScan0(nWidth, nHeight, 0, GDIPLUS_PIXELFORMAT_32bppARGB, 0, @nBitmap)
DECLARE INTEGER GdipGetImageGraphicsContext IN gdiplus.DLL INTEGER nImage, INTEGER @ nGraphics
LOCAL nGraphics
nGraphics = 0
GdipGetImageGraphicsContext (nBitmap, @nGraphics)
DECLARE INTEGER GdipDrawImageRect IN gdiplus.DLL ;
INTEGER nGraphics, INTEGER nImage, SINGLE,SINGLE,SINGLE,SINGLE
GdipDrawImageRect(nGraphics, nImage, nX, nY, nWidth, nHeight)
LOCAL lcEncoder
lcEncoder = REPLICATE(CHR(0),16)
DECLARE INTEGER CLSIDFromString IN ole32 STRING lpsz, STRING @pclsid
CLSIDFromString(STRCONV("{557CF401-1A04-11D3-9A73-0000F81EF32E}" + CHR(0), 5), @lcEncoder)
DECLARE INTEGER GdipSaveImageToFile IN gdiplus.DLL ;
INTEGER nImage, STRING wFilename, STRING qEncoder, INTEGER nEncoderParamsPtr
ERASE (pNewFileNAme)
DECLARE Long GdipDisposeImage IN Gdiplus.dll Long nativeImage
GdipDisposeImage(nImage)
GdipSaveImageToFile (nBitmap, STRCONV(pNewFileNAme,5) + CHR(0), lcEncoder, 0)
DECLARE INTEGER GdiplusShutdown IN gdiplus INTEGER token
GdiplusShutdown(hToken)
CLEAR DLLS
ENDFUNC