Skip to content

GMagick No encode delegate for this image format #732

@ausi

Description

@ausi

Issue description

On my system it is not possible to save a GMagick image to a file without a file extension. The Exception No encode delegate for this image format (jpeg) gets thrown.

What's the PHP version you are using?

7.3.13-1+ubuntu16.04.1+deb.sury.org+1

What's the imaging library you are using [gd/imagick/gmagick/any]?

GMagick

What's the imaging library configuration

gmagick version => 2.0.5RC1
GraphicsMagick version => GraphicsMagick 1.4 snapshot-20180922 Q16 http://www.GraphicsMagick.org/

Minimal PHP code to reproduce the error:

$gmagick = new \Gmagick();
$gmagick->newimage(100, 100, (new \GmagickPixel('#ffffff'))->getcolor(false));
$gmagick->setimageformat('jpeg');
$gmagick->writeimage(__DIR__.'/testimage');

How to fix

The GraphicsMagick documentation shows the image format in uppercase ("GIF") and if I replace the 'jpeg' with 'JPEG' in the test code above this fixes the issue for me.

I think we should replace https://github.com/avalanche123/Imagine/blob/3db069bd870f45b5305e7d6bd4e08d45ebb22cef/src/Gmagick/Image.php#L433 with:

$this->gmagick->setimageformat(strtoupper($options['format']));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions