Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

magick:flip does not work, passes extra cli argument #641

Open
melkamar opened this issue Apr 4, 2020 · 0 comments
Open

magick:flip does not work, passes extra cli argument #641

melkamar opened this issue Apr 4, 2020 · 0 comments

Comments

@melkamar
Copy link

melkamar commented Apr 4, 2020

First off, thanks for a great library!

I encountered an issue when using the magick:flip argument of {% asset %}.

Full description

ImageMagick works correctly, because using magick:resize works as expected:

<div class="image ratio bg-cover"
     {% for image in post.image %}
     style="background-image: url({% asset '{{ image }}' @path magick:resize=512x512 %}) ;"
     {% endfor %}>
</div>

However, if I add the magick:flip argument, the compilation fails with:

  Liquid Exception: `magick mogrify -resize 512x512 -flip /site/.jekyll-cache/assets/proxied/5f93e6.jpeg` failed with error: mogrify: no decode delegate for this image format `' @ error/constitute.c/ReadImage/560. in index.html

First I thought that there is no delegate to handle jpeg, but I checked and it is enabled. Also, this works with the resize, so ImageMagick knows how to handle jpegs.

What is weird is the empty string in the error report:

`... for this image format `'

So I tried changing the HTML code for:

style="background-image: url({% asset '{{ image }}' @path magick:resize=512x512 magick:flip=foobar %}) ;"

And true enough, the error message changed to

  Liquid Exception: `magick mogrify -resize 512x512 -flip foobar /site/.jekyll-cache/assets/proxied/a3b287.jpeg` failed with error: mogrify: unable to open image 'foobar': No such file or directory @ error/blob.c/OpenBlob/3497. mogrify: no decode delegate for this image format `' @ error/constitute.c/ReadImage/560. in index.html

Note the command it is trying to execute:

magick mogrify -resize 512x512 -flip foobar /site/.jekyll-cache/assets/proxied/a3b287.jpeg

The root cause

jekyll-assets is trying to pass n argument to the -flip parameter and that's making ImageMagick fail. My guess is that when there is no arg provided for magick:flip, then the CLI contains an empty string which gets picked up by ImageMagick and makes it fail.

Executing the magick cli command manually works as expected:

magick mogrify -resize 512x512 -flip /site/.jekyll-cache/assets/proxied/a3b287.jpeg

Package versions

jekyll-assets (3.0.12)
mini_magick (4.10.1)
ImageMagick 7.0.8-68 Q16 x86_64 2019-12-18 https://imagemagick.org

Suggested fix

The -flip parameter should not take any positional argument. Maybe this is a legacy expectation? ImageMagick now has -flip and -flop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant