what if resizing for stored images on load will be allowed?
AddImage as an example API call
AddImage as an example API call
[HookMethod("AddImage")]
public bool AddImage(string url, string imageName, ulong imageId, Action callback = null, int sizeX = 0, int sizeY=0)
and pass this params to DownloadImage method where the plugin could resize it
something like this:public static byte[] Resize(byte[] bytes, int sizeX, int sizeY)
{
Image img = (Bitmap)(new ImageConverter().ConvertFrom(bytes));
Bitmap cutPiece = new Bitmap(sizeX, sizeY);
System.Drawing.Graphics graphic = System.Drawing.Graphics.FromImage(cutPiece);
graphic.DrawImage(img, new Rectangle(0, 0, sizeX, sizeY), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel);
graphic.Dispose();
MemoryStream ms = new MemoryStream();
cutPiece.Save(ms, ImageFormat.Jpeg);
return ms.ToArray();
}