当前位置:网站首页>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
边栏推荐
- Niuke.com: Candy distribution
- quarkus saas动态数据源切换实现,简单完美
- 芯片的发展史和具体用途以及结构是什么样的
- 翌圣生物冲刺科创板:25%收入来自新冠产品销售 拟募资11亿
- Design and implementation of university laboratory goods management information system based on SSH
- Flink partition policy
- Arrays. asList()
- GC
- 记一次有趣的逻辑SRC挖掘
- Use of Presto visualization client-yanagishima20.0
猜你喜欢
Research on parallel computing architecture of meteorological early warning based on supercomputing platform
Data Lake survey
Source code analysis of AQS & reentrantlock
记一次给OpenHarmony提交代码的过程
Capacity expansion mechanism of Dict Of redis (rehash)
The service layer reports an error. The XXX method invalid bound statement (not found) cannot be found
Redis6 note02 configuration file, publish and subscribe, new data type, jedis operation
Leetcode 1249. Remove invalid brackets (awesome, finally made)
SQL注入漏洞(类型篇)
Vulnérabilité à l'injection SQL (contournement)
随机推荐
Golden sun education listed in the U.S.: a small cap medium cap stock with a market value of USD 360million
Big endian and little endian
SMS verification before deleting JSP
Use of JSP sessionscope domain
Niuke: rotation array
Very important very important very important very important very important very important very important very important very important
JVM shutdown hook details
元素定位不到的 9 种情况
Why distributed IDS? What are the distributed ID generation schemes?
Geographic location system based on openstreetmap+postgis paper documents + reference papers + project source code and database files
Xishan technology rushes to the scientific innovation board: it plans to raise 660million yuan. Guoyijun and his wife have 60% of the voting rights
WebRTC Native M96 基础Base模块介绍之网络相关的封装
Detailed explanation of Spark's support source code for Yan priority
Database Series: MySQL index optimization summary (comprehensive version)
Application of analytic hierarchy process in college teaching evaluation system (principle + example + tool)
Niuke.com: Candy distribution
Under what circumstances will Flink combine operator chains to form operator chains?
The temporary table from XML to VFP is simple and easy to use and worth collecting
Idea uses the fast request interface for debugging
文献之有效阅读