You are unable to load the DLL because you don't have it.
Dave
>Does anyone have any experience with manipulating .jpg files in Fox? I am looking to automate cropping of JPG images. I search the UT and found one thread that had the following code sample:
>
>Here's some sample code for cropping an image from uLeft,uTop to
>uRight,uBottom and writing the image back to disk with quality factor of
>iQualFactor
>
>Procedure Resize
>Param cInputFile,cOutPutFile,uLeft, uTop, uRight, uBottom,iQualFactor
>
>Declare Integer ImgDLLReadRGBFromJPG in ImgDLL String @Filename, Integer
>@Width, Integer @Height
>declare integer ImgDLLCropRGB in ImgDLL Integer pRGB, Integer InW, Integer
>inH, Integer uLeft, Integer uTop, Integer uRight, Integer uBottom
>declare integer ImgDLLSaveRGBToJPG in ImgDLL String @FileName, Integer
>pRGBBuf, Integer W, Integer H, Integer Qual, Integer ColorFlag, Integer
>ProgressiveFlag
>Declare GlobalUnlock in Win32API Integer hpRGB
>Declare GlobalFree in Win32API Integer hpRGB
>declare integer GlobalLock in Win32API Integer hpRGB
>
>iWid=0
>iHeight=0
>hpRGB=ImgDLLReadRGBFromJPG(@cInputFile,@iWid,@iHeight) && Read image from
>disk
>If hpRGB = 0
>Message("Reading input file")
>Return
>Endif
>pRGB=GlobalLock(hpRGB)
>If pRGB = 0
>* This should never happen
>GlobalFree(hpRGB)
>ErrMsg("Getting global lock on input buffer")
>Return
>Endif
>hpRGBNew=ImgDLLCropRGB(pRGB, iWid, iHeight, uLeft, uTop, uRight, uBottom)
>If hpRGBNew = 0
>* Error happened
>GlobalUnlock(hpRGB) && Free the original input file's buffer
>GlobalFree(hpRGB)
>ErrMsg("Cropping file")
>Return
>Endif
>pRGBNew=GlobalLock(hpRGBNew) && Lock the cropped image buffer
>GlobalUnlock(hpRGB) && Free the original input file's buffer
>GlobalFree(hpRGB)
>NewIWid=uRight-uLeft
>NewIHeight=uBottom-uTop
>iStat=ImgDLLSaveRGBToJPG(@cOutPutFile, pRGBNew, NewIWid, NewIHeight,
>iQualFactor, 1,0)
>If iStat <> 1
>ErrMsg("Saving to resized JPG")
>Endif
>GlobalUnlock(hpRGBNew)
>GlobalFree(hpRGBNew) && Free the cropped image buffer
>Return
>
>
>Procedure ErrMsg
>LParam txtInfo
>Priv iStat
>iStat=ImgDLLGetLastError()
>MSG("ImgDLL Error " + txtInfo + ", error: " + allt(str(iStat)) )
>Return
>
>When I try to use this code I get “Cannot 32 bit DLL ImgDLL”. Any idea on what might be causing this program error? Do I need this DLL?
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only