Encoder Parameters - System.Drawing.Imaging

  • Thread starter Thread starter Elmo Watson
  • Start date Start date
E

Elmo Watson

I found an example on the msdn showing how to save JPG files with a quality:
myEncoderParameter = New EncoderParameter(myEncoder, CType(25L, Int32))
myEncoderParameters.Param(0) = myEncoderParameter
Of course, in a normal application, you'd want the quality to be dynamic,
based on user input. It's easy to hard something like this, but I'm totally
unsure of how to make 25L work dynamically.

It's obviously supposed to be an integer, and I've tried ways to concatenate
25 as a string and "L" - then including that inside the 'ctype' section, but
it never works, since I get an error:

Conversion from string "25L" to type 'Integer' is not valid.

I've even tried:

sQuality = frm.txtQuality.Text & "L"
Dim iQuality As Integer = CInt(sQuality)

Still - the same error, of course - - -

Still - I've tried leaving off the "L", but it gives me the same size file,
no matter what, so I know it's not working correctly.

Any ideas on how to accomplish this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top