Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

Use Sharp To Process An Image

Code

si

sharp("input.jpg")
  .resize({ width: 1024, height: 768 })
  .toFile("output.jpg")

More details here: https://sharp.pixelplumbing.com/api-resize

Installation is done with:

Install with:

Code

npm install sharp
# or
yarn add sharp