pleweekly.blogg.se

Resize image on scroll
Resize image on scroll






resize image on scroll

This image will hold the section of the input image as decided by scroll position. Create a buffer image which you will plot in the picture box.This byte stream can be in memory or also in hard disk (for cases whereĬ# can't read images by itself and you have to unpack it in a file/memory byte stream manually). Arrange the memory occupied by this new image as bytestream.You will have to use disk space in those cases.ĭon't worry, its fast enough in both cases). (Unpacked Images can be huge and your PC may not have enough memory to hold it. Plot your input image unto this new image. Create an empty image of similar size but of 24 bit pixel resolution. Read the Image you wish to see in the picture box.Create a Windows Form with a picture box and vertical scroll bar.Here is a quick understanding of what the code does: In this code, I have tried a general approach to handling any type of input image using the default C# functions. They may be 1 bit to 32 bit in color resolution. Using the codeīefore we see the code, we need to know that images can be stored in many formats and with different compression schemes. We will see how can this be achieved in the code below. Even though there may be multiple options for scolling images, in a nut shell,Īll demand the image to be unpacked into its R,G,B components, making a data array of these RGB components and then transferring blocks of byte data when ever It, however, turned out that it wasn't as easy as I initially thought it to be. I was making a code which would display images in a scrollable box but found that the Image.Copy (or other methods) is slow and does not allow smooth scrolling of the image. The standard functions provided by C# libraries are slow and do not provide smooth image scrolling. This is a sample code to see one of the options for fast image scrolling in C#.








Resize image on scroll