What is the output of running npx envinfo --binaries --languages --system --utilities?
System:
OS: macOS Mojave 10.14.6
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Memory: 88.89 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.16.3 - ~/.nvm/versions/node/v10.16.3/bin/node
npm: 6.9.0 - ~/.nvm/versions/node/v10.16.3/bin/npm
Utilities:
Make: 3.81 - /usr/bin/make
GCC: 10.14. - /usr/bin/gcc
Git: 2.23.0 - /usr/local/bin/git
Clang: 1001.0.46.4 - /usr/bin/clang
Subversion: 1.10.3 - /usr/bin/svn
Languages:
Bash: 3.2.57 - /bin/bash
Go: 1.13 - /usr/local/bin/go
Java: 11.0.2 - /usr/bin/javac
Perl: 5.18.4 - /usr/bin/perl
PHP: 7.1.23 - /usr/bin/php
Python: 2.7.16 - /usr/local/bin/python
Python3: 3.7.0 - /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
Ruby: 2.3.7 - /usr/bin/ruby
What are the steps to reproduce?
I'm trying to use a base64 encoded SVG in an SVG image's source
What is the expected behavior?
When I use base64 encoded SVG in another SVG's image source, the library must convert it to a png file.
Are you able to provide a standalone code sample, without other dependencies, that demonstrates this problem?
Here's a piece of my code to show the problem;
console.log('App started!')
const sharp = require('sharp');
sharp(Buffer.from('<svg width="75" height="120"> <image width="75" height="120" opacity="0.7" x="250" y="250" xlink:href="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSJDYXBhXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgNTEyIDUxMiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgNTEyIDUxMjsiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KCTxyZWN0I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C4zNSw0MS4zNw0KCUMyOTEuNDE5LDE1MC4zODcsMjg4LjE3OCwxNTIuOTcxLDI4NC41MzksMTUyLjk3MXoiIC8+DQoJPGNpcmNsZSBzdHlsZT0iZmlsbDojRjk1NDVCOyIgY3g9IjI4NC41MjYiIGN5PSIxNDUuMjQ0IiByPSIzOC43ODIiIC8+DQo8L3N2Zz4=" /> </svg>'))
.toFile('output.png').then(out => {
console.log('Output: ', out)
console.log('App ended!')
})
Are you able to provide a sample image that helps explain the problem?
Yes, Here's a Fiddle to show clearly what I'm trying to do. I need to convert this image to a PNG file
Terminal Output;
objc[5120]: Class GNotificationCenterDelegate is implemented in both /Users/mustafa/image-processor/node_modules/sharp/vendor/lib/libgio-2.0.0.dylib (0x107675578) and /usr/local/opt/glib/lib/libgio-2.0.0.dylib (0x1081a1578). One of the two will be used. Which one is undefined.
(sharp:5120): GdkPixbuf-CRITICAL **: 14:45:34.859: gdk_pixbuf_get_width: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(sharp:5120): GdkPixbuf-CRITICAL **: 14:45:34.859: gdk_pixbuf_get_height: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(sharp:5120): GdkPixbuf-CRITICAL **: 14:45:34.859: gdk_pixbuf_set_option: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(sharp:5120): GdkPixbuf-CRITICAL **: 14:45:34.859: gdk_pixbuf_set_option: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(sharp:5120): GdkPixbuf-CRITICAL **: 14:45:34.860: gdk_pixbuf_get_width: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(sharp:5120): GdkPixbuf-CRITICAL **: 14:45:34.860: gdk_pixbuf_get_width: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(sharp:5120): GdkPixbuf-CRITICAL **: 14:45:34.860: gdk_pixbuf_get_height: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(sharp:5120): GdkPixbuf-CRITICAL **: 14:45:34.860: gdk_pixbuf_get_height: assertion 'GDK_IS_PIXBUF (pixbuf)' failed
(sharp:5120): GdkPixbuf-CRITICAL **: 14:45:34.860: gdk_pixbuf_scale_simple: assertion 'GDK_IS_PIXBUF (src)' failed
Are there any other native dependencies such as canvas involved? If so, as you're relying on a globally-installed cairo for canvas you must therefore also rely on a globally-installed libvips for sharp.
See also https://github.com/Automattic/node-canvas/issues/1386
I checked my global and project dependencies and I found ImageMagick in my global dependencies and I removed it but didn't work! Also, I've edited the issue with the error log
You'll need to reinstall/rebuild sharp after globally-(re)installing vips so it links against the global version rather than the locally-vendored version.
I used both local and global vips but unfortunately it didn't work!
If the path node_modules/sharp/vendor/lib/libgio-2.0.0.dylib is still appearing in the error message then you're still using the locally-vendored libvips and its dependencies. Perhaps remove the node_modules/sharp directory, reinstall sharp and ensure the node_modules/sharp/vendor does not exist.
@Mustafax06 Were you able to make any progress with this?
Closing due to inactivity but please feel free to reopen with more details if further help is required.
Same issue here (though apparently just a warning):
objc[48917]: Class GNotificationCenterDelegate is implemented in both /Users/dhowe/git/spectre/node_modules/sharp/vendor/lib/libgio-2.0.0.dylib (0x107d08578) and /Users/dhowe/git/spectre/node_modules/canvas/build/Release/libgio-2.0.0.dylib (0x10958e588). One of the two will be used. Which one is undefined.
Would be great not to have to see it every time the app starts though
I'm getting the same waring:
objc[76528]: Class GNotificationCenterDelegate is implemented in both /Volumes/Felix/Work/Highlighter/highlighter-backend/node_modules/canvas/build/Release/libgio-2.0.0.dylib (0x106241568) and /Volumes/Felix/Work/Highlighter/highlighter-backend/node_modules/sharp/vendor/lib/libgio-2.0.0.dylib (0x1076be578). One of the two will be used. Which one is undefined.
Why was this closed? It is quite annoying
If canvas and sharp are used together in the same process, both using the prebuilt binaries each provides, then this warning is unavoidable.
Have you tried ensuring both cairo and vips are globally-installed before canvas and sharp, as recommended in https://github.com/lovell/sharp/issues/1917#issuecomment-541744780 ?
See https://github.com/lovell/sharp-libvips/issues/39 for a future possible enhancement to experiment with statically-linking the dependencies of libvips.
objc[11334]: Class GNotificationCenterDelegate is implemented in both /Users/huanghuazhi/Desktop/projects/zwdc/frontend/previewer/node_modules/[email protected]@canvas/build/Release/libgio-2.0.0.dylib (0x1089df588) and
/usr/local/opt/glib/lib/libgio-2.0.0.dylib (0x10b655948). One of the two will be used. Which one is undefined.
as you can see vips is globally and locally installed . and canvas and sharp were both rebuild. but this error still occurs? any idea please?
and node_modules/sharp/vendor do not exist
does sharp support anti-alising image? if so i won't need node-canvas then....
@constantank You have the inverse problem, namely that node-canvas is using its own prebuilt cairo rather than a globally-installed cairo.
Please see the kernel option of resize and if you still have a question about anti-aliasing, please open a new "question" issue ensuring you answer all of the questions, provide sample images and the code you're using.
Most helpful comment
I'm getting the same waring:
objc[76528]: Class GNotificationCenterDelegate is implemented in both /Volumes/Felix/Work/Highlighter/highlighter-backend/node_modules/canvas/build/Release/libgio-2.0.0.dylib (0x106241568) and /Volumes/Felix/Work/Highlighter/highlighter-backend/node_modules/sharp/vendor/lib/libgio-2.0.0.dylib (0x1076be578). One of the two will be used. Which one is undefined.