Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8311461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:49:24+00:00 2026-06-08T19:49:24+00:00

We are using the image resizer from imageresizing.net and are seeing some weird behaviour.

  • 0

We are using the image resizer from imageresizing.net and are seeing some weird behaviour.

When we read an image in from a stream and then resize the image we can no longer access the properties of the original image.

The following code will reproduce the issue.

 static void Main(string[] args)
        {
            using(var httpPostedFileBaseImage = new FileStream(@"C:\test.jpg",FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                using(var uploadedImage = Image.FromStream(httpPostedFileBaseImage))
                {

                    Console.WriteLine(uploadedImage.Width);
                    var resizedImage = ImageBuilder.Current.Build(uploadedImage,
                                                                  new ResizeSettings("width=110;height=83"));

                    Console.WriteLine(uploadedImage.Width);
                }
            }
        }

Before the ImageBuilder line we are able to see the uploadedImage.Width fine but afterwards it throws an exception:

System.ArgumentException was unhandled
  HResult=-2147024809
  Message=Parameter is not valid.
  Source=System.Drawing
  StackTrace:
       at System.Drawing.Image.get_Width()
       at ConsoleApplication6.Program.Main(String[] args) in C:\Users\Daniel\Desktop\ConsoleApplication6\ConsoleApplication6\Program.cs:line 25
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

Is there something that we are doing wrong here or could this possibly be a bug in the image resizer?

Note: the problem was originally from an asp.net mvc app that has images uploaded which is why the variable is called httpPostedFileBaseImage and we are using Image.FromStream instead of perhaps Image.FromFile

The image is enter image description here but it appears to happen on most images.

EDIT:

Tried the following after the image resizing to no avail

httpPostedFileBaseImage.Seek(0, SeekOrigin.Begin);

EDIT2:

This is what confused me
enter image description here

The documentation seems to suggest that "it will not be disposed unless disposeSource=true, or am I misreading this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T19:49:26+00:00Added an answer on June 8, 2026 at 7:49 pm

    Don’t know how I missed it but there is an parameter to the ImageBuilder that tells it not to dispose the source

    var resizedImage = ImageBuilder.Current.Build(uploadedImage,new ResizeSettings("width=110;height=83"),false);
    

    Even though this fixes it, its strange as the documentation says its false by default

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am uploading some image files using servelt. I want to resize the images.
I am using image upload and resize script from someones blog. It stores the
How can I resize an image using HTML/CSS only (i.e no server code) while
I am trying to resize the image using javascript, but I am getting errors
JavaScript. I want to create simple script, that will be resize loaded image using
I'm using this code to resize an image on the iPhone: CGRect screenRect =
I m using Gesture touch function to Rotate resize my image. Now what i
This is all in C#: I am using this code to resize an image:
I am using a mx:Resize effect to change the width of an image in
I have an image that I want to resize on my websites rendering using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.