ASP.NET Imaging Issue - Jpeg Output Resolution?

Results 1 to 2 of 2

Thread: ASP.NET Imaging Issue - Jpeg Output Resolution?

  1. #1
    Join Date
    Dec 1969

    Default ASP.NET Imaging Issue - Jpeg Output Resolution?

    Hello,<br /><br />Thank you for all your support, The ASP Message Board forums have been a great help over the last few years.<br /><br />Currently, I am working on an image resizer so that various product photo sizes can be generated on the fly from one primary image. To accomplish this, I have used the ASP.NET imaging namespace to dynamically generate the image content and push it to the web browser.<br /><br />However, many of the product images we use are extremely high resolution and it seems that the higher the resolution of the original, the more distorted the resized output becomes.<br /><br />I can provide code excerpts if necessary, but is there a way to specify the quality of the jpeg output in the imaging namespace?<br /><br />Thank you,<br />

  2. #2
    Join Date
    Dec 1969

    Default RE: ASP.NET Imaging Issue - Jpeg Output Resolution

    See if this helps:<BR><BR> private void render()<BR> {<BR> int intJpgCodec;<BR> ImageCodecInfo[] icf = ImageCodecInfo.GetImageEncoders();<BR><BR> for(intJpgCodec = 0; intJpgCodec &#060; icf.GetUpperBound(0); intJpgCodec ++)<BR> {<BR> if(icf[intJpgCodec].FormatDescription == "JPEG")<BR> break;<BR> }<BR><BR> EncoderParameters encps = new EncoderParameters( 2 );<BR> EncoderParameter encp = new EncoderParameter( System.Drawing.Imaging.Encoder.Quality, <BR> (long) 100);<BR> encps.Param[0] = encp;<BR> Encoder myEncoder = Encoder.ColorDepth;<BR> encp = new EncoderParameter(myEncoder, 24L);<BR> encps.Param[1] = encp;<BR> bmp.Save( Response.OutputStream, icf[intJpgCodec], encps ); <BR> }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts