Resize Image using DotNet

We have a function to export items and their images to an Excel file using an RDLC report. However, the user was always forced to export in smaller parts, because the dataset was growing too big.

After some checking, it seems that their images were all very large around 7 mega pixels…

So… I created a function to resize an image.

I’m not going to make this post too long, so here is the function:

These are the variables:

One more heads-up, but I’ll put an extra blog post for this:

You notice that I put a clear of the blob before creating the outstream to it.
If I don’t clear that, only the first part of the old blob data is overwritten, while the larger part of the previous blob remains in there…

Check this post for more information.

2 thoughts on “Resize Image using DotNet

    • Hello Thomas,

      I have started on a version with the compression inside NAV before, but then stopped due to some weird results. So far I haven’t needed the extra compression. But I imagine it should be possible.

      The code sample you refer to is a good starting point indeed. Maybe take a look at my other blog post: .net to DotNet?

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.