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

  • SEARCH
  • Home
  • 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 8482713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:53:24+00:00 2026-06-10T19:53:24+00:00

I pass an array to a method and I use a foreach loop. The

  • 0

I pass an array to a method and I use a foreach loop. The parameter I’m passing to new Bitmap() is not valid for some reason. I get the error “Parameter is not valid.” The parameter is a string path (as it should be).

Can anyone tell me what’s wrong?

If I highlight the parameter name, this is what it shows me, which seems to be correct:

“C:\Reinstatement Image Transporter\Image Processing\NYH004402800_REINSTMT_0e2837ae.jpg”

public static void CompressPictures(string[] processingFiles)
        {
            string originalFileName = "";

            foreach (string file in processingFiles)
            {
                //I'm getting the error right here:
                Bitmap pic = new Bitmap(file);

                ImageCodecInfo jgpEncoder = GetEncoder(ImageFormat.Jpeg);

                Encoder myEncoder = Encoder.Quality;

                EncoderParameters myEncoderParameters = new EncoderParameters(1);

                EncoderParameter myEncoderParameter = new EncoderParameter(myEncoder, 50L);

                myEncoderParameter = new EncoderParameter(myEncoder, 0L);
                myEncoderParameters.Param[0] = myEncoderParameter;

                originalFileName = Path.GetFileNameWithoutExtension(file.Remove(file.Length - 1, 1));

                pic.Save(AppVars.ProcessingPolicyImagesFolder + originalFileName, jgpEncoder, myEncoderParameters);
            }
        }
  • 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-10T19:53:25+00:00Added an answer on June 10, 2026 at 7:53 pm

    (Per the comments on the question above: It was a simple FileNotFound error.)

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

Sidebar

Related Questions

How do I pass array of parameters through Get method in rails? Currently my
I use JSON.stringify method to pass an array to server. I have an array
I came across this post pass array to method Java on how to pass
I am using jQuery ajax to pass a string array to a page method.
From a method, I can pass a struct which contains an array of integers,
I am trying to pass array parameter to SQL commnd in C# like below,
I am passing 20+ arguments of different types to method. There should be some
I am trying to pass array to a method and I want the method
Suppose you pass an array as argument to a given method, say, public static
How can I pass an array of filenames into the following method: public static

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.