If you do not want to delve into some serious math, you need to load the byte array into the memory stream, load the image from this data stream, and use the built-in GDI functions in the System.Drawing namespace.
Performing 25% or 50% of the scale is easy. In addition to this, you need to start making interpolation and distinction so that everything looks half decent in manipulating binary data. You will have several days before you can match what is already available in GDI.
System.IO.MemoryStream myMemStream = new System.IO.MemoryStream(myBytes); System.Drawing.Image fullsizeImage = System.Drawing.Image.FromStream(myMemStream); System.Drawing.Image newImage = fullsizeImage .GetThumbnailImage(newWidth, newHeight, null, IntPtr.Zero); System.IO.MemoryStream myResult = new System.IO.MemoryStream(); newImage.Save(myResult ,System.Drawing.Imaging.ImageFormat.Gif);
BTW - if you really need to figure out the type of source image, see How to check if a byte array is a valid image
source share