[TYPO3] Size of IM-output

Niels Fröhling niels.froehling at adsignum.com
Wed May 30 10:02:25 CEST 2007


 Hy;

 A little question; did anybody recognize that the output of ImageMagick 
is absolutly terrifying:

-rw-r--r--  1 apache apache  6259 May 30 02:41 0fff6bdfed.png            
  pngcrush                      98%
-rw-r--r--  1 apache apache  6376 May 30 02:41 0fff6bdfed.png_         
   ImageMagick
-rw-r--r--  1 apache apache  3359 May 30 02:41 194062b5f8.jpg           
jpegtran -progressive    8.1%
-rw-r--r--  1 apache apache 41318 May 30 02:41 194062b5f8.jpg_        
ImageMagick
-rw-r--r--  1 apache apache  4085 May 30 02:41 4c374280a9.jpg           
jpegtran -progressive   13.5%
-rw-r--r--  1 apache apache 30318 May 30 02:41 4c374280a9.jpg_        
ImageMagick
-rw-r--r--  1 apache apache  5153 May 30 02:41 50456ae6dc.png          
pngcrush                      48.1%
-rw-r--r--  1 apache apache 10712 May 30 02:41 50456ae6dc.png_       
ImageMagick
-rw-r--r--  1 apache apache  3696 May 30 02:41 a0f68e8ff0.jpg         
    jpegtran -progressive    9.6%
-rw-r--r--  1 apache apache 38312 May 30 02:41 a0f68e8ff0.jpg_          
ImageMagick
-rw-r--r--  1 apache apache  1911 May 30 02:41 ccedab50af.jpg            
jpegtran -progressive    100%
-rw-r--r--  1 apache apache  1911 May 30 02:41 ccedab50af.jpg_          
ImageMagick
-rw-r--r--  1 apache apache  2554 May 30 02:41 f1fc590051.jpg            
jpegtran -progressive    7.8%
-rw-r--r--  1 apache apache 32845 May 30 02:41 f1fc590051.jpg_         
ImageMagick

 JPEGs are about 1000% of what they could be. People familiar with 
image-compression should recognize
that jpegtran is not re-compressing lossily, it's mere a re-ordering of 
the data. And I would guess that even
a baseline transformation would be a similar size, way below the IM-output.
 Is this normal (I could accept the PNG-output though, the default 
compression-scheme in libpng is not
the most efficient) for you too? Or is it my ImageMagick that is bad?

 Ciao
    Niels

 I changed my imageMagickExec to this:

            // +NIELS
                // Check file extension:
            $ext = '';
            $reg = array();
            if (ereg('(.*)\.([^\.]*$)', $output, $reg))
                $ext = strtolower($reg[2]);

            $cmd = t3lib_div::imageMagickCommand('convert', $params.' 
'.$this->wrapFileName($input).' '.$this->wrapFileName($output) . '_');
            $this->IM_commands[] = array($output, $cmd);

            $ret = exec($cmd /*. ' 2>'.$outpath.'.log2 
1>'.$outpath.'.log1'*/);
            if ($ext == 'jpg')
                exec('jpegtran -progressive 
'.$this->wrapFileName($output).'_ >'.$this->wrapFileName($output));
            else if ($ext == 'png')
                exec('pngcrush -rem cHRM -rem gAMA -rem iCCP -rem sRGB 
-reduce '.$this->wrapFileName($output).'_ '.$this->wrapFileName($output));
            else
                exec('cat '.$this->wrapFileName($output).'_ 
 >'.$this->wrapFileName($output));
            exec('rm '.$this->wrapFileName($output).'_');

            t3lib_div::fixPermissions($this->wrapFileName($output));    
// Change the permissions of the file
            // -NIELS

 for producing these results.


More information about the TYPO3-english mailing list