Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: FileSize zero after Blur and ReduceNoise

$
0
0
Is ToByteArray "expensive"?

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?

Viewing all articles
Browse latest Browse all 3693

Trending Articles