In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces VB.NET how to achieve watermarking, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
Watermarking technology
The VB.NET watermark class (watermark) contains a number of attributes that can be used to determine where to embed the watermark in the original image, what type of watermark (text or image) to use, and the exact information of the watermark.
Once the utility class is defined, we can construct our VB.NET watermark class (watermark). For a text type watermark, we need to know what text and font to use to create the watermark. For a watermark of an image type, you need to know the file name of the image used for the watermark. For watermarks that contain both text and image types, you need to know the file name of the original image file and the location of the watermark.
Because all the required information is set in these properties, the main function does not need any other information to create a watermark image. The program will return an instance of type System.Drawing.Bitmap.
The watermarking program runs very well in a multithreaded environment. Programs based on original images and watermarks may take up a lot of CPU running time. Therefore, it may be better to run it in the background and execute the main program in the foreground, which is especially important if the watermark program is part of a Web site. For example, if the site allows users to upload images that they want to watermark, we need to continue to run the rest of the page for users to use, while checking to make sure that the watermark image has been created.
The process of watermarking is quite simple. First, we create an overlay of the same size as the original image and embed the watermark where needed. The watermark can be loaded from a picture, or it can dynamically create the desired font and text. Next, check the overlay, search for the color of each pixel, and show its transparency. When we find the color of a pixel, we use its luminance value to create a multiplier.
This multiplier system may slow down the operation, but it can make the watermark image adjust accordingly as the color of the original image changes. At the same time, by editing the source code or providing a multiplier, we can set the color corresponding to the original color on the same pixel as the original image, but the red, green and blue components of this color are multiplied by a coefficient. Because this coefficient is a number between 0 and 1, it will reduce the color saturation of the pixel and make it appear as a watermark. Listing B contains the main processing code for the watermarking process.
The following code is worth noting, which is used when creating a pixel multiplier.
PixelMultiplier = 1-CSng (1-WatermarkPixel.GetBrightness)) * 0.25)
Change the final value (0.25) in this line of code to adjust the strength of the watermark. Multiplied by 0.25, the saturation of the watermark is limited to 0%, 25%. In other words, if the color of the watermark image is dim, the effect of the watermark will be less obvious, and the darkest color can only show 25% of the intensity of the original color. This value cannot be less than 0.0 (does not show the watermark effect) or higher than 1.0 (so that all places where the watermark will appear appear white).
Through the test, we found that the effect of keeping the value between 0.2 and 0.3. Of course, we can set it to a constant value, or we can modify the code to set its size dynamically at run time.
Test watermarking technology application
Watermarking programs can be used for dynamic web pages or for editing images for industrial purposes. By using a VB.NET watermarking class (watermark), we can easily integrate watermarking technology into our application system. Download and install the entire application to generate a watermark image. The application installs a class file that also contains all the source code and all the image watermarks for the application. We can easily use this code, integrate it into our own project files, and modify it to better meet our needs.
Thank you for reading this article carefully. I hope the article "how to achieve watermarking in VB.NET" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.