Hi everyone! Is there any way to compress the quality of an image? In memory stream or byte or any other type.
Does WiseJ have any extension or anything we can use to do it easily?
Example an image of 2MB we can choose how much quality we can reduce from that image, and it can goes to like 200/300 kb…
Thanks!
Hi Ruben,
while Wisej already compresses all communication between client and server (http and websocket) we don´t offer any specialized extension for image compression.
However there are a gazillion tools for VB.NET and C# out there that you can use with Wisej.NET like you did in WinForms before.
Some are commercial, others are free.
Best regards
Frank
using System.Drawing.Drawing2D;
//set max width and height we are willing to accept e.g HD Image
double maxWidth = 1920;
double maxHeight = 1080;double srcWidth = src_image.Width;
double srcHeight = src_image.Height;double widthRatio = maxWidth / srcWidth;
double heightRatio = maxHeight / srcHeight;double ratio = Math.Min(widthRatio, heightRatio);
//set new dimensions with aspect ratio preserved
int newWidth = (int)(srcWidth * ratio);
int newHeight = (int)(srcHeight * ratio);Size size = new Size(newWidth, newHeight);
Image out_image = (Image)(new Bitmap(src_image, size));
Please login first to submit.