Working with Image and Bitmap in c#? -
I am developing a project that includes a photo gallery managed by the admin panel. I want to show a thumbnail image for the admin in the admin panel which is active and will be shown to end the user.
OK I am storing images in two parameters in DB: Image data (byte []), ImageMemType. So when I store images for the first time, I want to store thumbnail editions of images. In this address, I have got some example code to resize and manipulate the pictures:
Private static image crop image (image image, rectangle crop area) {bitmap bmpImage = new bitmap (img) ); Bitmap bmpCrop = bmpImage.Clone (Croparia, bmpImage.PixelFormat); Return (Image) (BMPCRP); }
This function takes an image as a parameter. But I have image data (byte []).
So, how do I convert the image and the image to a byte array in my byte array?
image from byte array
public image bytereremes (byte [] bytere ) {Memorystream MS = new memorystream (byte); Return image.freamstream (ms); }
image byte array
public byte [] imageToByteArray (image image) {MemoryStream ms = new MemoryStream (); Return image. Save (ms, image format.jpg) .oir (); }
Comments
Post a Comment