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

OSX - GdkPixbuf-WARNING when converting an SVG to PNG #588

Closed
dynamite-ready opened this issue Oct 2, 2016 · 3 comments
Closed

OSX - GdkPixbuf-WARNING when converting an SVG to PNG #588

dynamite-ready opened this issue Oct 2, 2016 · 3 comments
Labels

Comments

@dynamite-ready
Copy link

I'm running Sharp 0.16.0 on OSX 10.11.6, and am currently trying to convert a buffered SVG to a PNG file with the following code:

sharp(cmon).toFile('new.png');

The SVG contains an embedded image (data URL).
This works fine on Windows. The PNG is produced as expected.

However, on OSX, the PNG file prints, but does not display the embedded image.
The terminal window also prints the following:

(sharp:8201): GdkPixbuf-WARNING **: Cannot open pixbuf loader module file '/usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache': No such file or directory

This likely means that your installation is broken.
Try running the command
  gdk-pixbuf-query-loaders > /usr/local/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache
to make things work again for the time being

Has anyone else encountered this issue? Are there any simple fixes or work arounds?

@lovell
Copy link
Owner

lovell commented Oct 3, 2016

Hello, are you using a global version of libvips installed via homebrew? brew info vips should tell you.

@lovell lovell added the question label Oct 3, 2016
@dynamite-ready
Copy link
Author

dynamite-ready commented Oct 3, 2016

Hi, I did actually switch to using the Homebrew version of libvips found here - http://www.vips.ecs.soton.ac.uk/index.php?title=Build_on_OS_X - and it worked.
You can probably close this, but it would be cool if the npm installation process was fixed, or the documentation helped to troubleshoot the issue better.

Thank you for looking into the issue.

@lovell
Copy link
Owner

lovell commented Oct 3, 2016

Use of a homebrew-installed copy of vips is not required to use sharp on OS X. However I know some people do use it and the mention of a global path /usr/local/lib/... in your error message suggested this might be the case here, so I asked only to help narrow down the problem.

The SVG to PNG use case is included in the tests and seems to work on OS X using the pre-built binaries.

A recent commit to Homebrew/homebrew-core#4259 suggests the "Cannot open pixbuf loader module file" error is or at least has been a known problem with a homebrew-installed gdk-pixbuf.

My best guess here is that an older version of gdk-pixbuf has previously been installed globally (perhaps as a dependency of something else) and was somehow being used in preference to sharp's own bundled version of it.

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

2 participants