This is one of those internet myths that just persists.
According to your formula, this image and this one ought to approach 2.0. They are to all intents and purposes identical.
The actual result:
C:\test>jimagezipcmp.pl
adding: 1.png (160 bytes security) (deflated 90%)
adding: 2.png (160 bytes security) (deflated 89%)
adding: 1.png (160 bytes security) (deflated 90%)
adding: 2.png (160 bytes security) (deflated 89%)
1.0272952853598
Try it yourself:
#! perl -slw
use strict;
use GD;
sub rgb2n { unpack 'N', pack 'CCCC', 0, @_ }
for my $n ( 1, 2 ) {
my $im1 = GD::Image->new( 600, 400, 1 );
$im1->filledRectangle( 0, 0, 600, 400, rgb2n( 255, 255, 255 ) );
$im1->filledRectangle( 100, 100, 500, 300, rgb2n( 255 - $n, 0, 0 )
+ );
open O, '>:raw', $n . '.png' or die $!;
print O $im1->png;
close O;
}
system q[zip 1.zip 1.png];
system q[zip 2.zip 2.png];
system q[zip 3.zip 1.png 2.png];
my $size1 = -s '1.zip';
my $size2 = -s '2.zip';
my $size3 = -s '3.zip';
print +( $size1 + $size2 ) / $size3;
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.