Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-transformer-sharp

Package Overview
Dependencies
Maintainers
0
Versions
569
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-transformer-sharp

Gatsby transformer plugin for images using Sharp

  • 5.15.0-next.0
  • next
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
95K
decreased by-36.13%
Maintainers
0
Weekly downloads
 
Created

What is gatsby-transformer-sharp?

The gatsby-transformer-sharp package is a Gatsby plugin that allows you to transform images using the Sharp image processing library. It provides a variety of image processing functionalities such as resizing, cropping, and creating responsive images.

What are gatsby-transformer-sharp's main functionalities?

Resize Images

This feature allows you to resize images to specified dimensions. The code sample demonstrates how to resize images to 200x200 pixels using the resize method.

exports.createPages = ({ graphql }) => {
  return graphql(`
    {
      allFile {
        edges {
          node {
            childImageSharp {
              resize(width: 200, height: 200) {
                src
              }
            }
          }
        }
      }
    }
  `).then(result => {
    console.log(result.data.allFile.edges);
  });
};

Generate Thumbnails

This feature allows you to generate fixed-size thumbnails. The code sample demonstrates how to create thumbnails of 125x125 pixels using the fixed method.

exports.createPages = ({ graphql }) => {
  return graphql(`
    {
      allFile {
        edges {
          node {
            childImageSharp {
              fixed(width: 125, height: 125) {
                src
              }
            }
          }
        }
      }
    }
  `).then(result => {
    console.log(result.data.allFile.edges);
  });
};

Create Responsive Images

This feature allows you to create responsive images that adapt to different screen sizes. The code sample demonstrates how to create fluid images with a maximum width of 800 pixels using the fluid method.

exports.createPages = ({ graphql }) => {
  return graphql(`
    {
      allFile {
        edges {
          node {
            childImageSharp {
              fluid(maxWidth: 800) {
                ...GatsbyImageSharpFluid
              }
            }
          }
        }
      }
    }
  `).then(result => {
    console.log(result.data.allFile.edges);
  });
};

Other packages similar to gatsby-transformer-sharp

Keywords

FAQs

Package last updated on 07 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc