Connecting Tech Pros Worldwide Help | Site Map

save as progressive JPEG

Newbie
 
Join Date: Mar 2009
Posts: 24
#1: Sep 13 '09
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:
Expand|Select|Wrap|Line Numbers
  1. ImageCodecInfo iciJpegCodec = null;
  2. EncoderParameter epQuality = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 98L);
  3. ImageCodecInfo[] iciCodecs = ImageCodecInfo.GetImageEncoders();
  4. EncoderParameters epParameters = new EncoderParameters(2);
  5. epParameters.Param[0] = epQuality;
  6. epParameters.Param[1] = new EncoderParameter(System.Drawing.Imaging.Encoder.RenderMethod, EncoderValue.RenderProgressive);//does not work
  7. for (int i = 0; i < iciCodecs.Length; i++)
  8. {
  9.     if (iciCodecs[i].MimeType == "image/jpeg")
  10.     {
  11.         iciJpegCodec = iciCodecs[i];
  12.         break;
  13.     }
  14. }
  15.  
  16. btmp.Save(toplace, iciJpegCodec, epParameters);
tlhintoq's Avatar
Moderator
 
Join Date: Mar 2008
Location: Arizona, USA
Posts: 1,745
#2: Sep 14 '09

re: save as progressive JPEG


"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?
Newbie
 
Join Date: Mar 2009
Posts: 24
#3: Sep 14 '09

re: save as progressive JPEG


Quote:

Originally Posted by tlhintoq View Post

"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)
Plater's Avatar
Moderator
 
Join Date: Apr 2007
Location: New England
Posts: 7,148
#4: Sep 15 '09

re: save as progressive JPEG


Progressive IS line by line.
Interlaced is every other line

No idea how the blurry->sharp comes about
Newbie
 
Join Date: Mar 2009
Posts: 24
#5: Sep 15 '09

re: save as progressive JPEG


Quote:

Originally Posted by Plater View Post

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

http://ask-leo.com/blurry_images_why..._clear_up.html
Plater's Avatar
Moderator
 
Join Date: Apr 2007
Location: New England
Posts: 7,148
#6: Sep 15 '09

re: save as progressive JPEG


Ah, I was thinking of the old GIF style of terminology:
"Interlacing is also known as "progressive" 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.
Quote:
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
Quote:
There is also an interlaced "Progressive 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.
Reply