Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
JPG Manipulation in Fox
Message
De
11/07/2000 00:31:11
 
 
À
07/07/2000 12:22:51
Steve Summers
Pima County Superior Court
Tucson, Arizona, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00389559
Message ID:
00390588
Vues:
10
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?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform