Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.4k views
in Technique[技术] by (71.8m points)

.net - Png compression and image resizing

Is there a way / plugin to help the image resizer with png compression?

I have a png image that I use in navigation and would like to keep it as small as possible. The original image has width 200px and size 38kb. I need to resize it down to 150px. Once I do so using the image resizer the size goes up to 150kb.

Originally the image was compressed using http://tinypng.org/

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Yes, the PrettyGifs plugin offers excellent octree quantization for both PNG and GIF images.

Use &colors=256, &colors=128, etc to adjust the bit depth. You can also preserve the existing color palette with preservePalette=true.

Note that advanced PNG compression optimizations (such as offered by smush.it, tinypng, etc) require an additional 150-400MB of RAM and take 10-20 seconds to perform - for obvious reasons you wouldn't want that to happen during a dynamic request. ImageResizer tries to finish each request under 250ms.

Hand-optimizing PNG/GIF CSS sprites and site-wide icons is usually going to give you a smaller file size that ImageResizer can, although it's nearly impossible to beat for photographic data.

Of course, with the WebP plugin installed, ImageResizer will wipe the floor with the competition.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...