给个参考代码,时间问题,像素色的判断就自己去测试
DECLARE LONG GdiplusStartup IN gdiplus LONG@, STRING@, LONG
DECLARE LONG GdiplusShutdown IN gdiplus LONG
DECLARE LONG GdipLoadImageFromFile IN gdiplus STRING@, LONG@
DECLARE LONG GdipGetImageWidth IN gdiplus LONG, LONG@
DECLARE LONG GdipGetImageHeight IN gdiplus LONG, LONG@
DECLARE LONG GdipBitmapGetPixel IN gdiplus LONG, LONG, LONG, LONG@
DECLARE LONG GdipBitmapSetPixel IN gdiplus LONG, LONG, LONG, LONG
DECLARE LONG GdipSaveImageToFile IN gdiplus LONG, STRING@, STRING@, LONG
DECLARE LONG GdipDisposeImage IN gdiplus LONG
inFile = "test0.jpg"
outFile = "test1.jpg"
stGSI = 0h01000000000000000000000000000000
pGDI = 0
GdiplusStartup(@pGDI, @stGSI, 0)
pImage = 0
GdipLoadImageFromFile(STRCONV(inFile+0h00,5), @pImage)
nWidth = 0
GdipGetImageWidth(pImage, @nWidth)
nHeight = 0
GdipGetImageHeight(pImage, @nHeight)
nARGB = 0
FOR i=0 TO nWidth-1
FOR j=0 TO nHeight-1
GdipBitmapGetPixel(pImage, i, j, @nARGB) && 取像素颜色
R = BITAND(BITRSHIFT(nARGB,16), 0xFF)
G = BITAND(BITRSHIFT(nARGB, 8), 0xFF)
B = BITAND(nARGB, 0xFF)
IF (在这判断符合条件的R、G、B值)
nRGB = 要替换的颜色值
GdipBitmapSetPixel(pImage, i, j, nRGB) && 替换像素颜色
ENDIF
ENDFOR
ENDFOR
CLSID_JPG = 0h01F47C55041AD3119A730000F81EF32E
GdipSaveImageToFile(pImage, STRCONV(outFile+0h00,5), CLSID_JPG, 0)
GdipDisposeImage(pImage)
GdiplusShutdown(pGDI)
CLEAR ALL
RETURN
[此贴子已经被作者于2020-7-4 11:51编辑过]