Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(249)

Issue 10841: Image content rewriting

Can't Edit
Can't Publish+Mail
Start Review
Created:
16 years, 9 months ago by louiscryan
Modified:
16 years, 8 months ago
Reviewers:
awiner, shindig-dev, etnu00
Base URL:
http://svn.apache.org/repos/asf/incubator/shindig/trunk/
Visibility:
Public.

Description

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.

Patch Set 1 #

Total comments: 28

Patch Set 2 : Updated with security fixes #

Total comments: 26

Patch Set 3 : Use No-op rewriter by default. Updated as per comments #

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

Messages

Total messages: 10
louiscryan
16 years, 9 months ago (2008-12-12 22:43:18 UTC) #1
awiner
A quick glance at the non-test classes. http://codereview.appspot.com/10841/diff/1/21 File java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BaseOptimizer.java (right): http://codereview.appspot.com/10841/diff/1/21#newcode35 Line 35: ImageReader ...
16 years, 9 months ago (2008-12-12 23:47:03 UTC) #2
etnu00
http://codereview.appspot.com/10841/diff/1/21 File java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BaseOptimizer.java (right): http://codereview.appspot.com/10841/diff/1/21#newcode63 Line 63: * @throws IOException No point in the javadoc ...
16 years, 9 months ago (2008-12-13 01:26:22 UTC) #3
louiscryan
Rewrite to use Sanselan library to handler attacks from malicious images and vulnerabilities in the ...
16 years, 8 months ago (2009-01-22 23:56:19 UTC) #4
louiscryan
Updated with security fixes
16 years, 8 months ago (2009-01-22 23:59:44 UTC) #5
awiner
http://codereview.appspot.com/10841/diff/1001/818 File ../trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGuiceModule.java (right): http://codereview.appspot.com/10841/diff/1001/818#newcode57 Line 57: bind(DefaultImageRewriter.class).annotatedWith(Names.named("org.apache.shindig.image-rewriter")) think this should be binding ImageRewriter.class. Not ...
16 years, 7 months ago (2009-01-27 00:46:04 UTC) #6
louiscryan
http://codereview.appspot.com/10841/diff/1001/818 File ../trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/DefaultGuiceModule.java (right): http://codereview.appspot.com/10841/diff/1001/818#newcode57 Line 57: bind(DefaultImageRewriter.class).annotatedWith(Names.named("org.apache.shindig.image-rewriter")) On 2009/01/27 00:46:05, awiner wrote: > think ...
16 years, 7 months ago (2009-01-27 20:03:56 UTC) #7
Paul Lindner
added a note about interaction with refreshInterval... http://codereview.appspot.com/10841/diff/1001/812 File ../trunk/java/common/conf/shindig.properties (right): http://codereview.appspot.com/10841/diff/1001/812#newcode32 Line 32: can ...
16 years, 7 months ago (2009-01-27 20:27:34 UTC) #8
louiscryan
http://codereview.appspot.com/10841/diff/1001/812 File ../trunk/java/common/conf/shindig.properties (right): http://codereview.appspot.com/10841/diff/1001/812#newcode32 Line 32: On 2009/01/27 20:27:34, lindner wrote: > can we ...
16 years, 7 months ago (2009-01-27 21:43:48 UTC) #9
louiscryan
16 years, 7 months ago (2009-01-27 21:50:06 UTC) #10
Use No-op rewriter by default. Updated as per comments
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b