phMagick code samples

These are the code examples available for phMagick

Browse them, read the code, see the result of each code block, and have fun

If you have questions ot suggestions just drop us a line

Converts an image into another format.

You can use this command to convert a file into another.
phMagick is smart, so it will guess the correct format from the file extension optionaly you can optimize the image (striping exif tags) and set the final image quality

Code:

        $phMagick = new \phMagick\Core\Runner();
        $action = new \phMagick\Action\Convert($this->originalFile, $this->newFile);

        // optimize the image
        $action->optimize();

        // sets image quality
        $action->quality(70);

        // execute the convert action
        $phMagick->run($action);