|
This code is the basis for integrating image rewriting into the Shindig proxy pipeline. This code will try to make reasonable assumptions about what target image format is most suitable and then serialize to that format. If the content is smaller than the original then it is used. A fairly high degree of configurability is added and protections to ensure that rogue images cannot create exceesively large memory burdens on the VM
For sample traffic seen on Orkut this kind of rewriting can yield pretty substantial reductions in image size. Ill post more thorough results later.
Details
GIF - We dont rewrite animated GIFs though we could it is an expensive process doing frame to frame differencing. We also dont rewrite transparent GIF currently though we could later with a reasonable AlphaImageLoader solution for IE6
PNG - Most PNG writers dont do a good job stripping metadata or minimizing palette and bit depth, or they use palettes when the image is small. This will fix most of this. We also attempt to rewrite to JPEG if the image is opaque and only if it yields a significant improvement ( > 20%) over an efficient PNG. JPEG should only provide significant improvement if the image is photographic in nature.
JPEG - We strip metadata and allow for configurable compression level.
Total comments: 28
Total comments: 26
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+1428 lines, -7 lines) |
Patch |
 |
|
../trunk/java/common/conf/shindig.properties
|
View
|
2
|
1 chunk |
+7 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/java/gadgets/pom.xml
|
View
|
|
2 chunks |
+4 lines, -1 line |
0 comments
|
Download
|
 |
|
../trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGuiceModule.java
|
View
|
2
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java
|
View
|
2
|
4 chunks |
+15 lines, -1 line |
0 comments
|
Download
|
 |
|
../trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BMPOptimizer.java
|
View
|
|
1 chunk |
+50 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BaseOptimizer.java
|
View
|
2
|
1 chunk |
+141 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java
|
View
|
|
1 chunk |
+186 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/GIFOptimizer.java
|
View
|
2
|
1 chunk |
+59 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/ImageRewriter.java
|
View
|
2
|
1 chunk |
+53 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/ImageUtils.java
|
View
|
|
1 chunk |
+123 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/JPEGOptimizer.java
|
View
|
2
|
1 chunk |
+85 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/NoOpImageRewriter.java
|
View
|
|
1 chunk |
+39 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/OptimizerConfig.java
|
View
|
2
|
1 chunk |
+95 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/PNGOptimizer.java
|
View
|
2
|
1 chunk |
+108 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/image/BMPOptimizerTest.java
|
View
|
|
1 chunk |
+72 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/image/BaseOptimizerTest.java
|
View
|
|
1 chunk |
+38 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/image/GIFOptimizerTest.java
|
View
|
2
|
1 chunk |
+51 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/image/ImageRewriterTest.java
|
View
|
2
|
1 chunk |
+102 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/image/JPEGOptimizerTest.java
|
View
|
|
1 chunk |
+120 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/rewrite/image/PNGOptimizerTest.java
|
View
|
|
1 chunk |
+66 lines, -0 lines |
0 comments
|
Download
|
 |
|
../trunk/java/gadgets/src/test/java/org/apache/shindig/gadgets/servlet/MakeRequestHandlerTest.java
|
View
|
|
4 chunks |
+4 lines, -5 lines |
0 comments
|
Download
|
 |
|
../trunk/pom.xml
|
View
|
|
2 chunks |
+9 lines, -0 lines |
0 comments
|
Download
|
Total messages: 10
|