There is a scanned TIFF image with the parameters 16bit, 14000px X 14000px, 1200dpi. In php imagick I do:

$im->readImage( $DOCUMENT_ROOT.$TifFilePath ); $im->setImageCompression(Imagick::COMPRESSION_ZIP); $im->setCompressionQuality(10); $im->setImageFormat( "jpg" ); 

I get a file with the image of the same linear dimensions and resolution. The file size is about 40 MB. It is necessary to reduce the size of the output file by an order of magnitude, even at the price of deteriorating image quality. Linear dimensions and resolution should be maintained.

  • Honey, you train him, but not jeep. $ comression_type = Imagick :: COMPRESSION_JPEG; - strangeqargo
  • one
  • one
    upvote astronomers should be respected and yes, a person may have made a mistake somewhere in the code (and we know where), but gave an example, limiting parameters and correct tags and this is not a query for “how can I solve the problem”, but something important for work. When the Moon falls on your head and the Sun and all the meteorites start beating you, only these (and Elon Musk) and the Virgin Mary and the spirit Queen and Holy Donkey will save you. - strangeqargo
  • I do not care, zip or jep, when using Imagick :: COMPRESSION_JPEG, the resulting file gets even more. setCompressionQuality in the code, if you see, I apply, but even if I put 1 there, the file is of the same size and quality. upvote, and where is the error in the code? - Ludmila Pakuliak
  • one
    Oops! inattentively read. I'll try Imagick :: setImageCompressionQuality (). - Ludmila Pakuliak

1 answer 1

Try resizing the image, or scale it:

  $imagick = new \Imagick; $imagick->setResolution(200,200); $imagick->readImage($file); $imagick->scaleImage(1920,0); $imagick->setImageFormat('jpeg'); $imagick->setImageCompression(\Imagick::COMPRESSION_JPEG); $imagick->setImageCompressionQuality(55); $imagick->writeImages($path.$filename, false); $imagick->clear(); $imagick->destroy();