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

Support for png images #756

Closed
hsribei opened this issue Mar 25, 2017 · 7 comments
Closed

Support for png images #756

hsribei opened this issue Mar 25, 2017 · 7 comments

Comments

@hsribei
Copy link
Contributor

hsribei commented Mar 25, 2017

Sorry if this is too newbie a question, but I've had the following problem. I created a blog using the official blog starter, then went to replace profile-pic.jpg with a png image. I replace jpg with png in components/Bio.js, deleted the original image and added my own profile-pic.png. That's all. Then I got this error:

ERROR in ./components/profile-pic.png
Module build failed: Error: /home/hsribei/usr/src/blog/node_modules/pngquant-bin/vendor/pngquant: error while loading shared libraries: libpng12.so.0: cannot open shared object file: No such file or directory

    at Promise.all.then.arr (/home/hsribei/usr/src/blog/node_modules/execa/index.js:201:11)
    at process._tickDomainCallback (internal/process/next_tick.js:135:7)

Is this something that's missing in the package.json file? For now I just used a jpg image and it worked, but I would like to know how to make a png file work. Thanks!

@KyleAMathews
Copy link
Contributor

KyleAMathews commented Mar 25, 2017 via email

@hsribei
Copy link
Contributor Author

hsribei commented Mar 25, 2017

I tried that, got the same error. Let me know if I can help with more information in case you want to track this. If it seems like I'm the only person having this trouble then no need to worry as I've "solved" it by using a jpg. Thanks for Gatsby btw :)

@KyleAMathews
Copy link
Contributor

KyleAMathews commented Mar 25, 2017 via email

@hsribei
Copy link
Contributor Author

hsribei commented Mar 25, 2017

Yes. This fixed it for me:

sudo apt-get install libpng-dev
npm rebuild

But I was wondering if this dependency could be installed along with the others.

@KyleAMathews
Copy link
Contributor

Seems like it's a problem with the upstream package tcoopman/image-webpack-loader#51

@KyleAMathews
Copy link
Contributor

Closing as it's an upstream issue.

@rmcsharry
Copy link

rmcsharry commented Apr 22, 2020

I just discovered this bug today and the KEY is making sure that the path to your images folder is correct in the gatsby-config (in the plugins array):

My images are in a strange place in the code I inherited!

    {
      resolve: `gatsby-source-filesystem`,
      options: {
        path: `${__dirname}/content/assets`,
        name: `assets`,
      },
    },

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

3 participants