当前位置:网站首页>VFP a picture processing library, simple and easy to use, free of charge, worth recommending
VFP a picture processing library, simple and easy to use, free of charge, worth recommending
2022-06-25 11:44:00 【VFP of Garfield】
Cat cat returned to his hometown in Hunan during the Spring Festival , Eat, drink and play during the Chinese New Year , No intention to work , Now let's close our hearts , Move bricks carefully , The people who carry bricks are the most lovely .
Now the picture processing library introduced by cat , From the papaya warrior , Simple and easy to use , No charge for free , Is worth to recommend
At present, the document processing system developed by cat has been used .
Brief introduction
- MyImg.fll
- The main function : PrintScreen 、 tailoring 、 The zoom 、 rotate 、 format conversion 、 Generate to variable 、 Copy to clipboard
- author : Papaya :
- Call to order :ImgOpen() --> Other functions -->ImgClose() , When something goes wrong , Use ImgGetLastError Read error
Here are the test cases
#define _FROM_SCREEN 1
#define _FROM_CLIPBORD 2
#define _IMG_BMP 1
#define _IMG_GIF 2
#define _IMG_JPG 3
#define _IMG_PNG 4
#define _IMG_TIF 5
Clear
Set Library To myImg
* 1. Open the image The screen 、 clipboard
hImg = ImgOpen(_FROM_SCREEN) && Open screen
* hImg = ImgOpen(_FROM_CLIPBORD) && Open the shear plate
* hImg = ImgOpen( cFileName ) && Open the image
If hImg==""
MessageBox(" Failed to open image !")
Return
EndIf
ImgSave(hImg,"1 The original picture .bmp",_IMG_BMP)
* 2. Get image size
?" Width :",ImgGetWidth(hImg)
?" Height :",ImgGetHeight(hImg)
* 3. tailoring ImgCrop( Parameters : Handle , Left , On , wide , high )
If not ImgCrop(hImg,10,10,500,300) &&( from (10,10) Coordinates start , Generate a wide 500, high 300 Image
MessageBox(ImgGetLastError(hImg)," Clipping failed !")
EndIf
ImgSave(hImg,"3 post-crop .bmp",1)
* 4. The zoom ImgZoom( Handle , New width , New height )
If not ImgZoom(hImg,400,400) && Zoom to 400×400 Image
MessageBox(ImgGetLastError(hImg)," Zoom failed !")
EndIf
ImgSave(hImg,"4 After zooming .bmp",1)
* 5. rotate ImgRotate( Handle , angle )
If not imgRotate(hImg,90)
MessageBox(ImgGetLastError(hImg)," Rotation failed !")
EndIf
ImgSave(hImg,"5 After rotation .bmp",1)
* 6. format conversion
If not ImgSave(hImg,"6 format conversion .png",_IMG_PNG) && The second parameter is the file name , The third is the picture type
MessageBox(ImgGetLastError(hImg)," Format conversion failed !")
EndIf
* 7. If you want to turn JPG, Can be set jpg Quality 1-100
ImgSetJpegQuality(hImg,70) && Set up jpg Quality
If not ImgSave(hImg,"7 format conversion .jpg",_IMG_JPG)
MessageBox(ImgGetLastError(hImg)," Save as failed !")
EndIf
* 8. Copy to clip board
If ImgCopyToClipbord(hImg)
MessageBox(" Copied to clipboard , You can open the drawing program and paste ")
Else
MessageBox(ImgGetLastError(hImg)," Copy to clipboard failed !")
EndIf
* 9. Get the image variable directly ( It returns a variable , It can be directly stored in the database )
vImgSrc = ImgGetPtr(hImg,_IMG_GIF) && obtain Gif Format image content
StrToFile(vImgSrc,"9 Use memory variables .gif")
* 10. Close image
ImgClose(hImg)
* 11. Create... From memory variables ( vImgSrc It was generated earlier , It can also be used. FileToStr obtain
hImg2=ImgOpen(vImgSrc,_IMG_GIF)
If hImg2==""
MessageBox(ImgGetLastError(hImg)," Failed to open image from variable !")
Return
EndIf
* 12. And Vfp9 Of PictureVal Use a combination of ,ImgGetPtr() The return value of can be directly assigned to PictureVal
If Val(_vfp.Version) >=9
Local oForm as Form
oForm=CreateObject("form")
oForm.AddObject("image","image")
With oForm.image as Image
.Visible=.t.
.PictureVal = ImgGetPtr(hImg2,_IMG_TIF) && Change the format to tif, Assign to image The control of PictureVal
EndWith
oForm.Show(1)
EndIf
*13. obtain DPI
?"DPI:",ImgGetXDpi(hImg),ImgGetXDpi(hImg)
ImgClose(hImg2)
* 14 Grayscale
hImg=ImgOpen(_FROM_SCREEN)
ImgSetGray(hImg)
ImgSave(hImg," Grayscale processed screen .gif",_IMG_TIF)
ImgClose(hImg)
* 15 Frame operation multi page tif And animation gif It can be operated in this way :
cFile="fox.gif" && This is an animation
hImg=ImgOpen(cFile)
If hImg==""
MessageBox(" Unable to open image !")
Return
EndIf
* Get the number of frames
nFrames=ImgGetFramesCount(hImg)
?" This file has a total of frames :",nFrames
ImgClose(hImg) && close
* Get every frame
For x=1 to nFrames
hImg=ImgOpen(cFile,0,x) && Open the first x frame , The second parameter can be ignored
If hImg==""
MessageBox(" Unable to open page "+Transform(x)+" frame !")
Loop
EndIf
?" Is generating ",x," frame ……"
ImgSave(hImg,"Frame"+Transform(x)+".gif",_IMG_GIF)
ImgClose(hImg) && Each frame is a separate handle , It's all closed
EndFor
Set Library To
Cat has uploaded to the cloud , download
https://share.weiyun.com/JXz9Mzkt
边栏推荐
- 牛客网:分糖果问题
- TCP如何處理三次握手和四次揮手期間的异常
- 手机上股票开户安全吗?找谁可以开户啊?
- Customize to prevent repeated submission of annotations (using redis)
- Manually rollback abnormal data
- Handler、Message、Looper、MessageQueue
- Ladder Side-Tuning:预训练模型的“过墙梯”
- 数据库系列:MySQL索引优化总结(综合版)
- Thingspanel releases Internet of things mobile client (multiple pictures)
- 剑指 Offer II 091. 粉刷房子 : 状态机 DP 运用题
猜你喜欢

Develop two modes of BS mode verification code with VFP to make your website more secure

Idea local launch Flink task

杭州/北京内推 | 阿里达摩院招聘视觉生成方向学术实习生(人才计划)

TCP如何處理三次握手和四次揮手期間的异常

Recommend a virtual machine software available for M1 computer

Spark history server performance improvement (I) -- Application List

为什么要分布式 id ?分布式 id 生成方案有哪些?

Niuke.com: Candy distribution

SQL injection vulnerability (type chapter)

牛客网:主持人调度
随机推荐
Under what circumstances will Flink combine operator chains to form operator chains?
Detailed explanation of spark specification
GC
Detailed explanation of Spark's support source code for Yan priority
Openfeign uses
记一次给OpenHarmony提交代码的过程
What is the development history, specific uses and structure of the chip
Thirty lines of code prevent VFP forms from running repeatedly, and the function supports parameter transfer
cnds
Spark runs wordcount (case 2)
Flink batch key points (personal translation)
Tool usage summary
基于SSH的高校实验室物品管理信息系统的设计与实现 论文文档+项目源码及数据库文件
C disk uses 100% cleaning method
Builder pattern
Spark Tuning common configuration parameters
Comparator (for arrays.sort)
云原生数据湖以存储、计算、数据管理等能力通过信通院评测认证
Source code analysis of AQS & reentrantlock
JS indexof() always returns -1