save as progressive JPEG

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • byteit101
    New Member
    • Mar 2009
    • 25

    save as progressive JPEG

    I am working a an Image processing program, and I want to save my jpegs as being progressive (blurry to sharp instead of line by line while it loads). this does not work howerver:
    Code:
    ImageCodecInfo iciJpegCodec = null;
    EncoderParameter epQuality = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 98L);
    ImageCodecInfo[] iciCodecs = ImageCodecInfo.GetImageEncoders();
    EncoderParameters epParameters = new EncoderParameters(2);
    epParameters.Param[0] = epQuality;
    epParameters.Param[1] = new EncoderParameter(System.Drawing.Imaging.Encoder.RenderMethod, EncoderValue.RenderProgressive);//does not work
    for (int i = 0; i < iciCodecs.Length; i++)
    {
        if (iciCodecs[i].MimeType == "image/jpeg")
        {
            iciJpegCodec = iciCodecs[i];
            break;
        }
    }
    
    btmp.Save(toplace, iciJpegCodec, epParameters);
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    "Does not a work" is more than just a little vague. Do you get an error message? Does the code break on a given line? Do you get no errors but it doesn't save?

    Comment

    • byteit101
      New Member
      • Mar 2009
      • 25

      #3
      Originally posted by tlhintoq
      "Does not a work" is more than just a little vague. Do you get an error message? Does the code break on a given line? Do you get no errors but it doesn't save?
      It saves with no errors, but it is not progressive. (when I use Firefox throttle, it comes in line by line)

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Progressive IS line by line.
        Interlaced is every other line

        No idea how the blurry->sharp comes about

        Comment

        • byteit101
          New Member
          • Mar 2009
          • 25

          #5
          Originally posted by Plater
          Progressive IS line by line.
          Interlaced is every other line

          No idea how the blurry->sharp comes about
          line by line is standard JPEG
          blurry->sharp is progressive

          Comment

          • Plater
            Recognized Expert Expert
            • Apr 2007
            • 7872

            #6
            Ah, I was thinking of the old GIF style of terminology:
            "Interlacin g is also known as "progressiv e" encoding, because the image becomes progressively clearer as it is received. This terminology is different than the interlaced and progressive scan terminology of video encoding."

            According to what I read in the wiki, you would want the interlace.
            Interlacing is a method of encoding a bitmap image such that a person who has partially received it sees a degraded copy of the entire image. When communicating over a slow communications link, this is often preferable to seeing a perfectly clear copy of one part of the image, as it helps the viewer decide more quickly whether to abort or continue the transmission.
            Or
            There is also an interlaced "Progressiv e JPEG" format, in which data is compressed in multiple passes of progressively higher detail. This is ideal for large images that will be displayed while downloading over a slow connection, allowing a reasonable preview after receiving only a portion of the data. However, progressive JPEGs are not as widely supported, and even some software which does support them (such as some versions of Internet Explorer) only displays the image once it has been completely downloaded.

            Comment

            Working...