Set PNG compressen algorithm to use when saving image

@param int $compress as the algorithm to use.

@return $this
6111
public function setPngCompression($compress = null)
    {
        if ($compress) {
            $this->useCompress = true;
        }

        $this->compress = isset($compress)
            ? $compress
            : self::PNG_COMPRESSION_DEFAULT;

        (is_numeric($this->compress) and $this->compress >= -1 and $this->compress <= 9)
            or $this->raiseError('Quality not in range.');

        $this->log("Setting PNG compression level to {$this->compress}.");

        return $this;
    }
1269853
public function save($path, $quality = array()) {
		$ext = pathinfo($path, PATHINFO_EXTENSION);

		$jpeg_quality = elgg_extract('jpeg_quality', $quality);
		$png_quality = elgg_extract('png_quality', $quality);
		$png_filter = elgg_extract('png_filter', $quality);

		switch ($ext) {
			default :
				$this->source->saveToFile($path, $jpeg_quality);
				break;

			case 'gif';
				$this->source->saveToFile($path);
				break;

			case 'png' :
				$this->source->saveToFile($path, $png_quality, $png_filter);
				break;
		}

		return $this;
	}
698085
public function encode($format, $quality = null)
    {
        $this->toggleModified();

        $this->getInterventionImage()->encode($format, $quality);

        return $this;
    }
1136369
public function setCompressor(CompressorInterface $compressor)
    {
        if (!$compressor->isSupported()) {
            throw new \RuntimeException('Unsupported type of compressor: ' . $compressor->getName());
        }

        $this->compressor = $compressor;

        return $this;
    }
1155210
public function save($imgname, $type = null, $quality=80,$interlace = true){
        $this->img->save($imgname, $type, $quality,$interlace);
        return $this;
    }
50067
public function compress($content)
    {
        $archive = $this->getArchive();
        if (!empty($archive)) {
            $file = gzopen($archive, 'w' . $this->getLevel());
            if (!$file) {
                throw new Exception\RuntimeException("Error opening the archive '" . $this->options['archive'] . "'");
            }

            gzwrite($file, $content);
            gzclose($file);
            $compressed = true;
        } elseif ($this->options['mode'] == 'deflate') {
            $compressed = gzdeflate($content, $this->getLevel());
        } else {
            $compressed = gzcompress($content, $this->getLevel());
        }

        if (!$compressed) {
            throw new Exception\RuntimeException('Error during compression');
        }

        return $compressed;
    }
6588
public function getDeCompressor($compression)
    {
        if (isset($this->deCompressors[$compression])) {
            return $this->deCompressors[$compression];
        } else {
            throw new InvalidCompressionTypeException($compression);
        }
    }
117482
public function setZip($v)
    {
        if ($v !== null) {
            $v = (string) $v;
        }

        if ($this->zip !== $v) {
            $this->zip = $v;
            $this->modifiedColumns[] = CustomerPeer::ZIP;
        }


        return $this;
    }
791284
private function createFromPng(string $path): self
    {
        $imageData = imagecreatefrompng($path);
        if (false === $imageData) {
            throw new ImageException(sprintf('Unable to create PNG image from %s!', $path));
        }
        $this->workingData = $imageData;
        $this->setTransparency(false, true);
        $this->encrypted = false;
        return $this;
    }
567403
public function setMask(int $mask): ZipManager {

        try {
            foreach ( $this->zip_archives as $archive ) {
                $archive->setMask($mask);
            }
            return $this;
        } catch (ZipException $ze) {
            throw $ze;
        }

    }
52605
public function compress()
    {
        if (!$this->collection->schema) {
            $this->compressed =& $this->data;

            return;
        }
        if ($this->state !== 'compressed' && $this->collection) {
            $this->compressed = $this->applyCompression($this->data);
            $this->asDotSyntax();
            $this->state = 'compressed';
        }
    }
860274
public function save($dest = null, $compress = true)
    {
        if (!file_exists(dirname($dest))) {
            mkdir(dirname($dest), 0755, true);
        }

        file_put_contents($dest, $this->get(null, $compress));
    }
918177
public BasicNDArrayCompressor setDefaultCompression(@NonNull String algorithm) {
        algorithm = algorithm.toUpperCase();
        //       if (!codecs.containsKey(algorithm))
        //            throw new RuntimeException("Non-existent compression algorithm requested: [" + algorithm + "]");

        synchronized (this) {
            defaultCompression = algorithm;
        }

        return this;
    }
33052
public function setBlob($blob) {
        $this->blob = $blob;
        $this->setFilesize(strlen($blob));
        $this->setChecksum(md5($blob));

        return $this;
    }
787560
public function save($filename=null) {

        if ( !$filename ) $filename = $this->fileSrc;

        switch ( $this->extension ) {

            case 'jpg':
            case 'jpeg':
                imagejpeg($this->imgDst, $filename, 90);
                break;

            case 'gif':
                imagegif($this->imgDst, $filename);
                break;

            case 'png':
                imagepng($this->imgDst, $filename);
                break;

        }

        return $this;

    }
1086403
public function setPrefix($prefix)
    {
        foreach ($this->storage as &$path) {
            $path->setPrefix((string) $prefix);
        }

        return $this;
    }
732025
public function setCompression($compression)
    {
        /**
         * If we don't support passed compression, leave old one.
         */
        switch ($compression) {
            case 'gzip':
                $this->compression = Phar::GZ;
                break;
            case 'bzip2':
                $this->compression = Phar::BZ2;
                break;
            default:
                break;
        }
    }