gatsby-transformer-sharp
Gatsby transformer plugin for images using Sharp
Last updated 11 days ago by wardpeet .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install gatsby-transformer-sharp 
SYNC missed versions from official npm registry.

gatsby-transformer-sharp

Creates ImageSharp nodes from image types that are supported by the Sharp image processing library and provides fields in their GraphQL types for processing your images in a variety of ways including resizing, cropping, and creating responsive images.

Live demo (source)

Install

npm install --save gatsby-transformer-sharp gatsby-plugin-sharp

How to use

// In your gatsby-config.js
module.exports = {
  plugins: [`gatsby-plugin-sharp`, `gatsby-transformer-sharp`],
}

Please note that you must have a source plugin (which brings in images) installed in your project. Otherwise, no ImageSharp nodes can be created for your files. Examples would be gatsby-source-filesystem or source plugins for (headless) CMSs like gatsby-source-wordpress.

Note: An exception to this is when using gatsby-source-contentful, as the source plugin and the assets are not downloaded to the local filesystem. By default, the gatsby-source-contentful plugin creates a ContentfulAsset node for every image with links to Contentful’s CDN, therefore it is not necessary to use gatsby-transformer-sharp together with gatsby-source-contentful.

Parsing algorithm

It recognizes files with the following extensions as images.

  • jpeg
  • jpg
  • png
  • webp
  • tif
  • tiff

Each image file is parsed into a node of type ImageSharp.

Configuration options

checkSupportedExtensions [boolean][optional]

Sharp only supports certain image formats (see the Parsing algorithm section above) and hence throws a warning when you e.g. use a .gif in an ImageSharp query. You'll need to use publicURL instead. With this option you can disable the warning behavior.

// In your gatsby-config.js
module.exports = {
  plugins: [
    `gatsby-plugin-sharp`,
    {
      resolve: `gatsby-transformer-sharp`,
      options: {
        // The option defaults to true
        checkSupportedExtensions: false,
      },
    },
  ],
}

Troubleshooting

Incompatible library version: sharp.node requires version X or later, but Z provides version Y

This means that there are multiple incompatible versions of the sharp package installed in node_modules. The complete error typically looks like this:

Something went wrong installing the "sharp" module

dlopen(/Users/misiek/dev/gatsby-starter-blog/node_modules/sharp/build/Release/sharp.node, 1): Library not loaded: @rpath/libglib-2.0.dylib
  Referenced from: /Users/misiek/dev/gatsby-starter-blog/node_modules/sharp/build/Release/sharp.node
  Reason: Incompatible library version: sharp.node requires version 6001.0.0 or later, but libglib-2.0.dylib provides version 5801.0.0

To fix this, you'll need to update all Gatsby plugins in the current project that depend on the sharp package. Here's a list of official plugins that you might need to update in case your projects uses them:

  • gatsby-plugin-sharp
  • gatsby-plugin-manifest
  • gatsby-remark-images-contentful
  • gatsby-source-contentful
  • gatsby-transformer-sharp
  • gatsby-transformer-sqip

To update these packages, run:

npm install gatsby-plugin-sharp gatsby-plugin-manifest gatsby-remark-images-contentful gatsby-source-contentful gatsby-transformer-sharp gatsby-transformer-sqip

If updating these doesn't fix the issue, your project probably uses other plugins from the community that depend on a different version of sharp. Try running npm list sharp or yarn why sharp to see all packages in the current project that use sharp and try updating them as well.

Current Tags

  • 2.5.15                                ...           latest (11 days ago)
  • 2.2.13-otp-test.31                                ...           otp-test (a year ago)
  • 2.4.6-unifiedroutes.76                                ...           unifiedroutes (3 months ago)
  • 2.4.6-unifiedroutes-v2.135                                ...           unifiedroutes-v2 (2 months ago)

289 Versions

  • 2.5.15                                ...           11 days ago
  • 2.5.14                                ...           a month ago
  • 2.5.13                                ...           a month ago
  • 2.4.6-unifiedroutes-v2.135                                ...           2 months ago
  • 2.5.12                                ...           2 months ago
  • 2.5.11                                ...           3 months ago
  • 2.5.10                                ...           3 months ago
  • 2.5.9                                ...           3 months ago
  • 2.4.6-unifiedroutes.76                                ...           3 months ago
  • 2.5.7                                ...           3 months ago
  • 2.5.6                                ...           3 months ago
  • 2.5.5                                ...           4 months ago
  • 2.5.4                                ...           4 months ago
  • 2.5.3                                ...           4 months ago
  • 2.5.2                                ...           5 months ago
  • 2.5.1                                ...           5 months ago
  • 2.5.0                                ...           5 months ago
  • 2.4.7                                ...           5 months ago
  • 2.4.6                                ...           5 months ago
  • 2.4.5                                ...           5 months ago
  • 2.4.4                                ...           6 months ago
  • 2.4.3                                ...           6 months ago
  • 2.4.2                                ...           6 months ago
  • 2.4.1                                ...           6 months ago
  • 2.4.0                                ...           6 months ago
  • 2.3.19                                ...           6 months ago
  • 2.3.18                                ...           7 months ago
  • 2.3.17                                ...           7 months ago
  • 2.3.16                                ...           7 months ago
  • 2.3.15                                ...           7 months ago
  • 2.3.14                                ...           8 months ago
  • 2.3.13                                ...           8 months ago
  • 2.3.12                                ...           9 months ago
  • 2.3.11                                ...           9 months ago
  • 2.3.9                                ...           10 months ago
  • 2.3.7                                ...           10 months ago
  • 2.3.6                                ...           10 months ago
  • 2.3.5                                ...           10 months ago
  • 2.3.4                                ...           10 months ago
  • 2.3.3                                ...           10 months ago
  • 2.3.2                                ...           a year ago
  • 2.3.1                                ...           a year ago
  • 2.3.0                                ...           a year ago
  • 2.2.23                                ...           a year ago
  • 2.2.22                                ...           a year ago
  • 2.2.21                                ...           a year ago
  • 2.2.20                                ...           a year ago
  • 2.2.19                                ...           a year ago
  • 2.2.17                                ...           a year ago
  • 2.2.16                                ...           a year ago
  • 2.2.15                                ...           a year ago
  • 2.2.14                                ...           a year ago
  • 2.2.13                                ...           a year ago
  • 2.2.13-otp-test.31                                ...           a year ago
  • 2.2.12                                ...           a year ago
  • 2.2.11                                ...           a year ago
  • 2.2.10                                ...           a year ago
  • 2.2.9                                ...           a year ago
  • 2.2.8                                ...           a year ago
  • 2.2.7                                ...           a year ago
  • 2.2.6                                ...           a year ago
  • 2.2.5                                ...           a year ago
  • 2.2.4                                ...           a year ago
  • 2.2.3                                ...           a year ago
  • 2.2.2                                ...           a year ago
  • 2.2.1                                ...           a year ago
  • 2.2.0                                ...           a year ago
  • 2.1.21                                ...           a year ago
  • 2.1.20                                ...           a year ago
  • 2.1.19                                ...           a year ago
  • 2.1.18                                ...           a year ago
  • 2.1.17                                ...           2 years ago
  • 2.1.16                                ...           2 years ago
  • 2.1.16-alpha.0                                ...           2 years ago
  • 2.1.15                                ...           2 years ago
  • 2.1.14                                ...           2 years ago
  • 2.1.13                                ...           2 years ago
  • 2.1.12                                ...           2 years ago
  • 2.1.10                                ...           2 years ago
  • 2.1.9                                ...           2 years ago
  • 2.1.8                                ...           2 years ago
  • 2.1.7                                ...           2 years ago
  • 2.1.6                                ...           2 years ago
  • 2.1.5                                ...           2 years ago
  • 2.1.4                                ...           2 years ago
  • 2.1.3                                ...           2 years ago
  • 2.1.2                                ...           2 years ago
  • 2.1.1                                ...           2 years ago
  • 2.1.1-rc.3                                ...           2 years ago
  • 2.1.1-rc.2                                ...           2 years ago
  • 2.1.1-rc.1                                ...           2 years ago
  • 2.1.1-rc.0                                ...           2 years ago
  • 2.1.1-beta.7                                ...           2 years ago
  • 2.1.1-beta.6                                ...           2 years ago
  • 2.1.1-beta.5                                ...           2 years ago
  • 2.1.1-beta.4                                ...           2 years ago
  • 2.1.1-beta.3                                ...           2 years ago
  • 2.1.1-beta.2                                ...           2 years ago
  • 2.1.1-beta.1                                ...           2 years ago
  • 2.1.1-beta.0                                ...           2 years ago
  • 1.6.27                                ...           2 years ago
  • 2.1.1-alpha.2                                ...           2 years ago
  • 2.2.0-alpha.80a21f04                                ...           2 years ago
  • 2.0.1-16                                ...           2 years ago
  • 2.0.1-15                                ...           2 years ago
  • 2.0.1-14                                ...           2 years ago
  • 2.0.1-13                                ...           2 years ago
  • 1.6.26                                ...           2 years ago
  • 2.0.1-12                                ...           2 years ago
  • 2.0.1-11                                ...           2 years ago
  • 2.0.1-10                                ...           2 years ago
  • 1.6.25                                ...           2 years ago
  • 2.0.1-9                                ...           2 years ago
  • 2.0.1-8                                ...           2 years ago
  • 1.6.24                                ...           2 years ago
  • 2.0.1-5                                ...           2 years ago
  • 2.0.1-4                                ...           2 years ago
  • 2.0.1-3                                ...           2 years ago
  • 2.1.0-alpha.e9c3027b                                ...           2 years ago
  • 2.1.0-alpha.5421f383                                ...           2 years ago
  • 2.1.0-alpha.523a4286                                ...           2 years ago
  • 2.1.0-alpha.5c9569c0                                ...           2 years ago
  • 1.6.23                                ...           2 years ago
  • 2.1.0-alpha.76793cd8                                ...           2 years ago
  • 2.1.0-alpha.4a09f745                                ...           2 years ago
  • 2.1.0-alpha.20252dc3                                ...           2 years ago
  • 2.1.0-alpha.95fcd4af                                ...           2 years ago
  • 2.0.1-2                                ...           3 years ago
  • 2.1.0-alpha.5f47082e                                ...           3 years ago
  • 2.1.0-alpha.6ad61a13                                ...           3 years ago
  • 2.1.0-alpha.84bd71b4                                ...           3 years ago
  • 2.1.0-alpha.12622d64                                ...           3 years ago
  • 2.1.0-alpha.34eda94b                                ...           3 years ago
  • 2.1.0-alpha.9fe50b00                                ...           3 years ago
  • 2.1.0-alpha.f98688ee                                ...           3 years ago
  • 2.0.1-1                                ...           3 years ago
  • 2.1.0-alpha.2cbec6d6                                ...           3 years ago
  • 1.6.22                                ...           3 years ago
  • 2.1.0-alpha.e66c6c9c                                ...           3 years ago
  • 1.6.21                                ...           3 years ago
  • 1.6.20                                ...           3 years ago
  • 2.0.1-0                                ...           3 years ago
  • 2.1.0-alpha.d0b8dd9e                                ...           3 years ago
  • 2.1.0-alpha.067e672c                                ...           3 years ago
  • 2.1.0-alpha.e28a1c8e                                ...           3 years ago
  • 2.1.0-alpha.bb258cb5                                ...           3 years ago
  • 2.1.0-alpha.b68b7f5c                                ...           3 years ago
  • 2.1.0-alpha.dd504153                                ...           3 years ago
  • 2.1.0-alpha.9d4de2a6                                ...           3 years ago
  • 2.1.0-alpha.6ab84875                                ...           3 years ago
  • 1.6.19                                ...           3 years ago
  • 2.1.0-alpha.5182142b                                ...           3 years ago
  • 2.1.0-alpha.32ef58da                                ...           3 years ago
  • 2.1.0-alpha.2b695217                                ...           3 years ago
  • 2.1.0-alpha.53bbd4cd                                ...           3 years ago
  • 1.6.18                                ...           3 years ago
  • 1.6.17                                ...           3 years ago
  • 1.7.0-alpha.d1544e1b                                ...           3 years ago
  • 1.7.0-alpha.3f307d61                                ...           3 years ago
  • 1.7.0-alpha.926cb6da                                ...           3 years ago
  • 1.7.0-alpha.f5c1df61                                ...           3 years ago
  • 1.7.0-alpha.7b47e00d                                ...           3 years ago
  • 1.7.0-alpha.aeb05561                                ...           3 years ago
  • 1.7.0-alpha.9da1bca1                                ...           3 years ago
  • 1.7.0-alpha.e5586916                                ...           3 years ago
  • 1.7.0-alpha.8c822451                                ...           3 years ago
  • 1.7.0-alpha.e9df8e57                                ...           3 years ago
  • 1.7.0-alpha.03b9df85                                ...           3 years ago
  • 1.7.0-alpha.b50f2063                                ...           3 years ago
  • 1.7.0-alpha.a0a09c94                                ...           3 years ago
  • 1.7.0-alpha.f20ac0ed                                ...           3 years ago
  • 1.6.16                                ...           3 years ago
  • 1.6.15                                ...           3 years ago
  • 1.6.14                                ...           3 years ago
  • 1.6.13                                ...           3 years ago
  • 1.6.12                                ...           3 years ago
  • 1.6.11                                ...           3 years ago
  • 1.6.10                                ...           3 years ago
  • 1.6.8                                ...           3 years ago
  • 1.6.7                                ...           3 years ago
  • 1.6.6                                ...           3 years ago
  • 1.7.0-alpha.1460dad9                                ...           3 years ago
  • 1.7.0-alpha.5db7a275                                ...           3 years ago
  • 1.7.0-alpha.93f2e2a2                                ...           3 years ago
  • 1.7.0-alpha.76b32701                                ...           3 years ago
  • 1.6.5                                ...           3 years ago
  • 1.6.4                                ...           3 years ago
  • 1.6.3                                ...           3 years ago
  • 1.6.2                                ...           3 years ago
  • 1.7.0-alpha.22c8a6f1                                ...           3 years ago
  • 1.6.1                                ...           3 years ago
  • 1.6.0                                ...           3 years ago
  • 1.5.0                                ...           3 years ago
  • 1.4.0                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 1.0.0-beta.7-alpha.594d939c                                ...           3 years ago
  • 1.0.0-beta.7-alpha.7dc2afa2                                ...           3 years ago
  • 1.0.0-beta.7-alpha.60d2ce84                                ...           3 years ago
  • 1.0.0-beta.7                                ...           3 years ago
  • 1.0.0-beta.6-alpha.320adb17                                ...           3 years ago
  • 1.0.0-beta.6                                ...           3 years ago
  • 1.0.0-beta.5-alpha.dfde8a10                                ...           3 years ago
  • 1.0.0-beta.5-alpha.c16c2913                                ...           3 years ago
  • 1.0.0-beta.5-alpha.08bddd92                                ...           3 years ago
  • 1.0.0-beta.5-alpha.fb30fcd6                                ...           3 years ago
  • 1.0.0-beta.5-alpha.1a65ba72                                ...           3 years ago
  • 1.0.0-beta.5-alpha.c64a932e                                ...           3 years ago
  • 1.0.0-beta.4-alpha.83182d4c                                ...           3 years ago
  • 1.0.0-beta.3-alpha.9451bcd6                                ...           3 years ago
  • 1.0.0-beta.3-alpha.590c01b7                                ...           3 years ago
  • 1.0.0-beta.3-alpha.a694e4ac                                ...           3 years ago
  • 1.0.0-beta.3-alpha.15f49df0                                ...           3 years ago
  • 1.0.0-beta.3-alpha.1cb4cf8b                                ...           3 years ago
  • 1.0.0-beta.3-alpha.404a27c8                                ...           3 years ago
  • 1.0.0-beta.2-alpha.38d760b4                                ...           3 years ago
  • 1.0.0-beta.2-alpha.a1195641                                ...           3 years ago
  • 1.0.0-beta.2-alpha.4bef9d1e                                ...           3 years ago
  • 1.0.0-beta.1-alpha.82c23a65                                ...           3 years ago
  • 1.0.0-beta.1                                ...           3 years ago
  • 1.0.0-alpha.23                                ...           3 years ago
  • 1.0.0-alpha.22-alpha.18f02e94                                ...           3 years ago
  • 1.0.0-alpha.22-alpha.2d2aa0ef                                ...           3 years ago
  • 1.0.0-alpha.22-alpha.96b0b727                                ...           3 years ago
  • 1.0.0-alpha.22-alpha.0be09b66                                ...           3 years ago
  • 1.0.0-alpha.22-alpha.acbc22e8                                ...           3 years ago
  • 1.0.0-alpha.22-alpha.19f7c727                                ...           3 years ago
  • 1.0.0-alpha.22                                ...           3 years ago
  • 1.0.0-alpha19-alpha.0ae0ee2a                                ...           3 years ago
  • 1.0.0-alpha19-alpha.dcf76508                                ...           3 years ago
  • 1.0.0-alpha19-alpha.62172e76                                ...           3 years ago
  • 1.0.0-alpha19-alpha.3c6183a4                                ...           3 years ago
  • 1.0.0-alpha19-alpha.a2f3e881                                ...           3 years ago
  • 1.0.0-alpha19-alpha.81f2510a                                ...           3 years ago
  • 1.0.0-alpha17                                ...           3 years ago
  • 1.0.0-alpha16-alpha.4482ff94                                ...           3 years ago
  • 1.0.0-alpha16-alpha.7b3bcd50                                ...           3 years ago
  • 1.0.0-alpha16-alpha.d918ccdc                                ...           3 years ago
  • 1.0.0-alpha16-alpha.102adc51                                ...           3 years ago
  • 1.0.0-alpha16-alpha.a48b771d                                ...           3 years ago
  • 1.0.0-alpha16-alpha.b47e49cb                                ...           3 years ago
  • 1.0.0-alpha16-alpha.0e39282b                                ...           3 years ago
  • 1.0.0-alpha16-alpha.c28a693a                                ...           3 years ago
  • 1.0.0-alpha16                                ...           3 years ago
  • 1.0.0-alpha15-alpha.4784b06f                                ...           3 years ago
  • 1.0.0-alpha15-alpha.330d917d                                ...           3 years ago
  • 1.0.0-alpha15-alpha.94fac7a9                                ...           3 years ago
  • 1.0.0-alpha15-alpha.14012332                                ...           3 years ago
  • 1.0.0-alpha15-alpha.6ffaa855                                ...           3 years ago
  • 1.0.0-alpha15-alpha.336b6aa8                                ...           3 years ago
  • 1.0.0-alpha15-alpha.62fcc2e1                                ...           3 years ago
  • 1.0.0-alpha15-alpha.11f194aa                                ...           3 years ago
  • 1.0.0-alpha15-alpha.7211d781                                ...           3 years ago
  • 1.0.0-alpha15-alpha.17ca92e9                                ...           3 years ago
  • 1.0.0-alpha15-alpha.6c40594a                                ...           3 years ago
  • 1.0.0-alpha15                                ...           3 years ago
  • 1.0.0-alpha14-alpha.ac7022a4                                ...           3 years ago
  • 1.0.0-alpha14-alpha.6611f24e                                ...           3 years ago
  • 1.0.0-alpha14-alpha.a4a50ee4                                ...           3 years ago
  • 1.0.0-alpha14-alpha.1ebda6e4                                ...           3 years ago
  • 1.0.0-alpha14-alpha.42f0e16a                                ...           3 years ago
  • 1.0.0-alpha14-alpha.48e2735c                                ...           3 years ago
  • 1.0.0-alpha14-alpha.5f9232df                                ...           3 years ago
  • 1.0.0-alpha14-alpha.e5097827                                ...           3 years ago
  • 1.0.0-alpha14-alpha.3145bea2                                ...           3 years ago
  • 1.0.0-alpha14                                ...           3 years ago
  • 1.0.0-alpha13-alpha.43a3774e                                ...           3 years ago
  • 1.0.0-alpha13-alpha.e4457d15                                ...           3 years ago
  • 1.0.0-alpha13-alpha.435e0178                                ...           3 years ago
  • 1.0.0-alpha13-alpha.7efda7f0                                ...           3 years ago
  • 1.0.0-alpha13-alpha.84bd4b24                                ...           3 years ago
  • 1.0.0-alpha13-alpha.a3ef328b                                ...           3 years ago
  • 1.0.0-alpha13-alpha.7d186994                                ...           3 years ago
  • 1.0.0-alpha13-alpha.0f0222b8                                ...           3 years ago
  • 1.0.0-alpha13-alpha.526805ab                                ...           3 years ago
  • 1.0.0-alpha13-alpha.215cabc2                                ...           3 years ago
  • 1.0.0-alpha13-alpha.0189ea42                                ...           3 years ago
  • 1.0.0-alpha13-alpha.537d11c6                                ...           3 years ago
  • 1.0.0-alpha13-alpha.ec011f40                                ...           3 years ago
  • 1.0.0-alpha13-alpha.91dbde54                                ...           3 years ago
  • 1.0.0-alpha13-alpha.c6e3cbb2                                ...           3 years ago
  • 1.0.0-alpha13                                ...           3 years ago
  • 1.0.0-alpha12-alpha.8370739a                                ...           3 years ago
  • 1.0.0-alpha12-alpha.577b9e82                                ...           3 years ago
  • 1.0.0-alpha12-alpha.b66dd8d3                                ...           3 years ago
  • 1.0.0-alpha12-alpha.89d880ee                                ...           3 years ago
  • 1.0.0-alpha12-alpha.c0bba969                                ...           3 years ago
  • 1.0.0-alpha12-alpha.571b4bbd                                ...           3 years ago
  • 1.0.0-alpha12-alpha.51e1923f                                ...           3 years ago
Downloads
Today 7
This Week 523
This Month 1,449
Last Day 63
Last Week 385
Last Month 1,849
Dependencies (7)
Dev Dependencies (4)
Dependents (654)

Copyright 2014 - 2016 © taobao.org |