How to use Imagemagick?
based in the table at https://developers.cloudflare.com/pages/platform/language-support-and-tools/, Imagemagick 6.7.7 is included in v1 build system
I have to questions:
1- how to use it? Because I tried using
magick -version
and errors
2- is it available in v2 build system? The table at the previous link show it's not included, but maybe is just showing some of the tools9 Replies
cc @johndotawesome
I'd be interested in giving v2 imagemagick support. How are you utilizing it in your build? I'm unsure how folks have been using it in v1, but I know it's installed
Hey @johndotawesome - thanks for looking into this! I'm also keen to use ImageMagick on v2. I think it's the only thing stopping me from being able to migrate my Jekyll site over from v1.
I use the
jekyll_picture_tag
ruby gem at build-time to create variants of my blog's images in different formats and sizes. Under the hood, that gem requires either ImageMagick or MiniMagick to be installed. Let me know if you want more details, I'm happy to share deployment logs with you, etc.Thanks for the info @alex.plescan !
Since v2 uses asdf, you could install imagemagick in your build by adding the following environment variable to your project:
The alternative to the pre_build env var is to prefix your build command with that^ or add it to a build script
The other option is to add a
.tool-versions
file with the contents:
Or whatever version you wantedHey @johndotawesome - thanks for that. I use
asdf
for local development so it's great to know it aligns with what the Cloudflare builder uses too!
Looks like the imagemagick asdf plugin isn't included though. After declaring it my .tool-versions
, my build fails on the "Building application" step, with:
huhmph that's weird. I suppose asdf requires you to preinstall plugins listed in the
.tool-version
file. In that case, you'll still need to run asdf plugin add imagemagick
in your UNSTABLE_PRE_BUILD` COMMANDAaah I missed your mention of setting the
UNSTABLE_PRE_BUILD
env var. I just did that and of course it immediately started working!
A thought is that it may be useful for the imagemagick plugin to be preinstalled. It took ~8 minutes between running the pre-build command and my build continuing on - smells like maybe imagemagick was being built from source?
Anyway - now my site's building with the V2 build system! Thanks for your help and for your work on Pages 😁 🧡Yeah very much likely being built from source. I agree. We should probably include it. Although, it seems that more and more static site builders are relying on their own prepackaged binaries for image processing (like in the case of node.js/sharp/vips)
We're trying to keep the v2 build system slimmer than v1 so that it's easier for us to maintain/update over time. That being said! I do think imagemagick deserves to be pre-installed. I'll talk to our team about it 🙂
Hey, I'm trying to use ImageMagick but the above doesn't work, the build just freezes. What could be up?
It turns out that this works, but just the installation step takes 6 minutes to run. The workflow generally takes a few seconds, but now it's 6 minutes just because of the installation
@JohnDotAwesome I haven't managed to find any other way to install this