public bool TryGetBitmapTransform(string optionValue, IEnumerable<KeyValuePair<string, string>> settings, out Func<BitmapSource, BitmapSource> bitmapTransformerFunc)
{
int width;
if (!int.TryParse(optionValue, out width))
{
bitmapTransformerFunc = null;
return false;
}
bitmapTransformerFunc = (sourceBitmap =>
{
var scale = width / (double)sourceBitmap.PixelWidth;
return new TransformedBitmap(sourceBitmap, new ScaleTransform(scale, scale));
});
return true;
}