Is ToByteArray "expensive"?
What we really care about for the application is the size in bytes, and candidate code for that is ToByteArray().Length.
Does ToByteArray "do real work" such as processing image bytes, or does it simply convert the image structure to bytes?
What we really care about for the application is the size in bytes, and candidate code for that is ToByteArray().Length.
if (resizeParameters.SizeMaximumBytes.HasValue && (imageWrapper.ToByteArray().Length > resizeParameters.SizeMaximumBytes.Value))
{
imageWrapper.Morphology(MorphologyMethod.Dilate, Kernel.Diamond);
if (imageWrapper.ToByteArray().Length > resizeParameters.SizeMaximumBytes.Value)
{
imageWrapper.BlurAndThreshold(0, 2, 50);
}
}
Curious about any performance or side effects from multiple calls on ToByteArray.Does ToByteArray "do real work" such as processing image bytes, or does it simply convert the image structure to bytes?