public void SetImage(byte[] imageBytes, Size shortcutSize, int? x = null, int? y = null)
{
var tempImage = ImageUtils.ByteArrayToImage(imageBytes);
//very high resolution images cause GDI+ exceptions, and logos shouldn't need to be this high res anyway
if (tempImage.Width > 300 || tempImage.Height > 300)
tempImage = ImageUtils.ScaleImage(tempImage, 300, 300);
var scaledSize = ImageUtils.GetScaledWidthAndHeight(tempImage.Width, tempImage.Height, shortcutSize.Width,
shortcutSize.Height);
Width = scaledSize.Width;
Height = scaledSize.Height;
Bytes = ImageUtils.ImageToByteArray(tempImage);
tempImage.Dispose();
if (x != null) X = (int) x;
if (y != null) Y = (int) y;
}