Wrox Programmer Forums
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old June 6th, 2006, 06:22 AM
Registered User
Join Date: May 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to vkshrestha
Default Progressive JPG image

Can anybody help me creating progressive jpeg images?
I believed this was done using:
but its not working.
Did not find anything in MSDN and in google.

Here is the code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

  If Page.IsPostBack Then

      ' create Image object from posted image file
      Dim imgObj As System.Drawing.Image
      imgObj = System.Drawing.Image.FromStream(upFile.PostedFile. InputStream)

      ' create bitmap object with required dimensions
      Dim bmpObj As Bitmap
      Dim ImageWidth As Integer = 800, ImageHeight As Integer = 600
      bmpObj = New Bitmap(imgObj, ImageWidth, ImageHeight)

      ' select JPEG codec
      Dim CodecInfo() As System.Drawing.Imaging.ImageCodecInfo
      Dim JpgCodec As System.Drawing.Imaging.ImageCodecInfo
      CodecInfo = System.Drawing.Imaging.ImageCodecInfo.GetImageEnco ders()
      JpgCodec = CodecInfo(1)

      ' add parameters to the codec
      ' the ScanMethod parameter is not working, maybe the inbuilt codec does not support it.
      Dim ParametersCount As Integer = 2
      Dim EncParams As New System.Drawing.Imaging.EncoderParameters(Parameter sCount)
      Dim JpgQuality As Integer = 50
      Dim ScanMethod As Integer = 2
      EncParams.Param(0) = New System.Drawing.Imaging.EncoderParameter(System.Dra wing.Imaging.Encoder.Quality, JpgQuality)
      EncParams.Param(1) = New System.Drawing.Imaging.EncoderParameter (System.Drawing.Imaging.Encoder.ScanMethod, ScanMethod)

      ' save the file
      Dim FullFilePath As String = "g:\tmp\aa.jpg"
      bmpObj.Save(FullFilePath, JpgCodec, EncParams)

   End If

End Sub
Old August 10th, 2006, 12:44 PM
Registered User
Join Date: Aug 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

I believe the issue is the value you are passing to your ScanMethod.

Try passing a value from the object System.Drawing.Imaging.EncoderValue

I believe the one you are looking for is EncoderValue.ScanMethodInterlaced though you may also need to add another parameter to imaging.encoder.rendermethod which would be imaging.encodervalue.renderprogressive

I hope this helps. Please post a reply one way or the other to help others. there are not many posts about this topic on the web (per Google)

Old October 26th, 2006, 04:15 PM
Registered User
Join Date: Oct 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Text(Sql Server Text Field) to Image(JPG) srinivas72 ADO.NET 2 February 13th, 2009 06:31 PM
Progressive list boxes Wall st Guru Excel VBA 3 March 27th, 2006 10:11 AM
jpg pictures boker990 VB.NET 2002/2003 Basics 2 July 12th, 2005 08:40 PM
WordML image to JPG spencer.clark XSLT 1 June 18th, 2005 06:19 AM
Dynamic Zip file fails with jpg image benburrows PHP How-To 0 November 19th, 2004 08:38 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.