Open source .NetCore general tool library Xmtool usage serialization – Image processing
Open source .NetCore general tool library Xmtool usage serial – Image processing articles [Github source code] “Previous Article” introduced the extended dynamic objects in the Xmtool tool library. Today we will continue to introduce to you the image processing class library. In our software system, we often need to perform various processing on images; for example, the most common avatar scaling requires scaling the images uploaded by users to the optimal size required by the system. This toolkit mainly summarizes commonly used image methods for the convenience of developers. Currently, the package only provides methods for image scaling and image generation base64 strings, and will continue to be added as needed. Zoom image files Scale the image data stream Convert image files into Base64 strings Convert image data stream into Base64 string Convert the content of the Image object into a Base64 string 1. Zoom the image file public Image Resize(string originFile, int height, int width, bool keepRatio, bool getCenter) Description: Scale the original image file to the specified width and height, and return the generated image object. ImageTool tool = Xmtool.Image(); Image result = tool.Resize(“c:\avatar.png”, 200, 200, true, true); // TODO 2. Scale the image data stream public Image…