开发者

Control image file size when uploading to ASP.Net

A couple of questions in this one here I'm afraid, I'm uploading images to our website using an ASP.Net control, when the image is uploaded I create 3 smaller sized images using GDI+. My main questions are:

  1. The original size of the image from the camera is over 2MB (JPEG), if I simply read + save this image without any modification it reduces it to around 800Kb, is this losing any quality or is there simply some kind of bloat in the file that the came开发者_StackOverflow社区ra has added?

  2. Uploading a 2MB image onto a site is slow, is it possible to perform the file reduction as stated in question 1 on the client before upload?

Thanks


  1. If you load the incoming stream into a Bitmap and you save that, it is possible that the image is saved with other parameter (compression, etc.). Try to save the stream instead

  2. There are many upload flash scripts or java applets that can do resizing. I've used

http://www.element-it.com/MultiPowUpload.aspx

I can't remember which Java Applet I've used.


check out http://jszip.stuartk.co.uk/ to enable you to zip data then post it to your server, not quite compressing it but its a start


  1. Cameras generally save JPEG images with quite low compression, to preserve more of the original information. If you resave it as JPEG it will use a higher compression rate and produce a smaller file, but it will of course also trow away some of the original information. It's up to you to decide how much quality you need to preserve.

  2. You can't do that with a regular upload, you would need to use a component or applet that runs in the client to do that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜