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

The gif operation requires libvips to have been installed with support for ImageMagick #2437

Closed
msiric opened this issue Nov 11, 2020 · 14 comments
Labels

Comments

@msiric
Copy link

msiric commented Nov 11, 2020

I am trying to resize a gif file, but keep getting this error: The gif operation requires libvips to have been installed with support for ImageMagick
I am aware that I need to install libvips with *magick, but I'm not sure how to do that.
Is it possible to list this as a dependency so I don't have to install it separately on every single machine that I use?

@lovell
Copy link
Owner

lovell commented Nov 11, 2020

@msiric
Copy link
Author

msiric commented Nov 11, 2020

Thanks for the quick reply.
I read the instructions, but I'm still not sure how to compile "libvips with imageMagick support" automatically on running npm install / yarn.
Should I configure package.json somehow to reflect this or set a global flag inside the project somehow?

@lovell
Copy link
Owner

lovell commented Nov 11, 2020

You'll need to globally install libvips compiled with support for ImageMagick before using npm to install sharp.

https://libvips.github.io/libvips/install.html#building-libvips-from-a-source-tarball

@msiric
Copy link
Author

msiric commented Nov 11, 2020

I deleted node_modules and ran:
yarn config set sharp_binary_host "https://npm.taobao.org/mirrors/sharp" yarn config set sharp_libvips_binary_host "https://npm.taobao.org/mirrors/sharp-libvips" yarn install sharp
After doing this, I am getting the same error.

@giopalma
Copy link

And who does he use Windows for? The guide specifies "The use of a globally-installed libvips is unsupported on Windows." What can I do as an alternative? I gloabally-installed libvips, added to the PATH but is not recognized by Sharp

@lovell
Copy link
Owner

lovell commented Nov 17, 2020

@DragoSpiro98 If your constraints include Windows and requirements include GIF output then sharp is probably the wrong solution.

@lovell
Copy link
Owner

lovell commented Dec 7, 2020

@msiric Were you able to make any progress with this by following the instructions at https://libvips.github.io/libvips/install.html#building-libvips-from-a-source-tarball ?

@msiric
Copy link
Author

msiric commented Dec 20, 2020

@lovell I haven't made any progress on a Win machine, but judging by your reply above, I assume it isn't possible to install libvips globally with ImageMagick support?

@Muratcol
Copy link

Muratcol commented Apr 12, 2021

I've also trying to install sharp to configure a GIF file however I couldn't make it work.

OS: Ubuntu 18.04.5 LTS
Nodejs Version: v10.24.1
NPM Version: 6.14.12

I followed instructions to install libvips
These are the installation results:

muratcolyaran@MSI:~/microservices-google-cloud$ pkg-config --modversion vips-cpp
8.10.6

And this is the npm installation

sharp: Detected globally-installed libvips v8.10.6
sharp: Building from source via node-gyp
make: Entering directory '/home/muratcolyaran/microservices-google-cloud/node_modules/sharp/build'
  CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
  AR(target) Release/obj.target/../node-addon-api/nothing.a
  COPY Release/nothing.a
  TOUCH Release/obj.target/libvips-cpp.stamp
  CXX(target) Release/obj.target/sharp/src/common.o
  CXX(target) Release/obj.target/sharp/src/metadata.o
  CXX(target) Release/obj.target/sharp/src/stats.o
  CXX(target) Release/obj.target/sharp/src/operations.o
  CXX(target) Release/obj.target/sharp/src/pipeline.o
  CXX(target) Release/obj.target/sharp/src/utilities.o
  CXX(target) Release/obj.target/sharp/src/sharp.o
  SOLINK_MODULE(target) Release/obj.target/sharp.node
  COPY Release/sharp.node
make: Leaving directory '/home/muratcolyaran/microservices-google-cloud/node_modules/sharp/build'

However when I try to make an operation on a GIF file I'm getting this error message

Error: GIF output requires libvips with support for ImageMagick

Do you have any advice? On which step I'm making mistake

@teeramusic
Copy link

I've found an easy solution for this and that is to grab the libvips build for your platform
https://github.com/libvips/libvips/releases and just extract the binaries from the bin folder to node_modules/sharp/build/Release and overwrite all files.
Verified to work (at least for this particular use case) for sharp@0.28.1 with libvips@8.10.6

@johnkeep
Copy link

I recommend just using FFmpeg. its faster than imagemagick by almost several folds and uses far less ram. it shouldn't be this difficult to convert some gifs on lambda! but it is and after weeks of trying I've given up and surprised how well FFmpeg works. I guess when you deal with hours and hours of hd video compression, image ain't nothin

@sonjz
Copy link

sonjz commented Jul 9, 2021

leaving this here... on macOS Big Sur 11.4 I ran into some issues, but resolved it.
haven't tested with Lambda, but GIF output working on macOS now.
NOTE: I also have imagemagick installed, so not sure if that plays into it.

# install global vips, which already includes the --with-magick flag
brew install vips

# next I had issues with OpenEXR and Imath not being in the default pkgconfig paths, so I added some links from the Homebrew Cellar:
# NOTE: it was 3.0.5 at the time, this will change depending on your version installed with vips
sudo ln -s /usr/local/Cellar/openexr/3.0.5/lib/pkgconfig/OpenEXR.pc /usr/local/lib/pkgconfig/OpenEXR.pc;
sudo ln -s /usr/local/Cellar/Imath/3.0.5/lib/pkgconfig/Imath.pc /usr/local/lib/pkgconfig/Imath.pc;

# not sure if required, but I also ensured this was installed globally, it was were sharp was failing.
npm install -g node-gyp;

# the last issue I encountered was with XCode CLI tools,
# i have s newer version installed, but the path points to the older one,
# i opted to just update the path with this command:
# (other options here: https://github.com/schnerd/d3-scale-cluster/issues/7)
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer;

# last step, your sharp install should be good now, it should pickup your global vips without issue.
yarn add sharp;
# npm install sharp;

@enijar
Copy link

enijar commented Sep 17, 2021

I fixed this issue by uninstalling vips, since I had it installed globally:

brew uninstall vips

@leafac
Copy link

leafac commented Feb 3, 2022

If, like me, you’re arriving here after 2022-02-01, then you should know that starting with v0.30.0 sharp supports GIF with the prebuilt binaries, so you don’t need to bring your own ImageMagick or anything like that.

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

No branches or pull requests

9 participants