当前位置:网站首页>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
边栏推荐
- Evaluating the overall situation of each class in a university based on entropy weight method (formula explanation + simple tool introduction)
- 時創能源沖刺科創板:擬募資11億 年營收7億淨利反降36%
- 数据库系列:MySQL索引优化总结(综合版)
- Caused by: org. xml. sax. SAXParseException; lineNumber: 1; columnNumber: 10; Processing matching '[xx][mm][ll]' is not allowed
- How PHP extracts image addresses from strings
- Niuke.com: host scheduling
- try-catch-finally
- Use of JSP sessionscope domain
- Yisheng biological sprint scientific innovation board: 25% of the revenue comes from the sales of new crown products, and it is planned to raise 1.1 billion yuan
- SQL injection vulnerability (bypass)
猜你喜欢

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

Shichuang Energy sprint Technology Innovation Board: le chiffre d'affaires annuel prévu de 1,1 milliard de RMB est de 0,7 milliard de RMB, en baisse de 36%

Countdownlatch source code analysis

Database Series: MySQL index optimization summary (comprehensive version)

How terrible is it not to use error handling in VFP?

牛客网:主持人调度

The service layer reports an error. The XXX method invalid bound statement (not found) cannot be found

数据库系列:MySQL索引优化总结(综合版)

VFP serial port communication is difficult for 9527. Maomao just showed his skill and was defeated by kiss

Double tampon transparent cryptage et décryptage basé sur le cadre minifilter
随机推荐
ROS 笔记(06)— 话题消息的定义和使用
文献之有效阅读
数据库系列:MySQL索引优化总结(综合版)
揭秘GaussDB(for Redis):全面对比Codis
Comparison between relu and SIGMOD
Record the process of submitting code to openharmony once
Develop two modes of BS mode verification code with VFP to make your website more secure
How to realize the rich text editor function of mobile terminal
Shichuang energy rushes to the scientific innovation board: it plans to raise 1.1 billion yuan, with an annual revenue of 700million yuan and a 36% decrease in net profit
Recommend a virtual machine software available for M1 computer
What is the development history, specific uses and structure of the chip
Introduction to JVM principle
Niuke: rotation array
WebRTC Native M96 基础Base模块介绍之网络相关的封装
Whole process of web page request
子类A继承父类B, A a = new A(); 则父类B构造函数、父类B静态代码块、父类B非静态代码块、子类A构造函数、子类A静态代码块、子类A非静态代码块 执行的先后顺序是?
Why distributed IDS? What are the distributed ID generation schemes?
SQL注入漏洞(类型篇)
try-catch-finally
Capacity expansion mechanism of Dict Of redis (rehash)