How to use the sharp.simd function in sharp

To help you get started, we’ve selected a few sharp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ivanoff / images-manipulation-performance / modules / sharp.js View on Github external
exports.process = function (fullImagePath, fullImagePathResult, size, callback) {
  // Disable experimental SIMD support - this is the default behaviour
  sharp.simd(false);

  sharp(fullImagePath)
    .resize(size[0], size[1])
    .toFile(fullImagePathResult, callback);
}
github DivanteLtd / storefront-api / src / lib / image.js View on Github external
import sharp from 'sharp';
import rp from 'request-promise-native';
import config from 'config';

sharp.cache(config.imageable.cache);
sharp.concurrency(config.imageable.concurrency);
sharp.counters(config.imageable.counters);
sharp.simd(config.imageable.simd);

export async function downloadImage (url) {
  const response = await rp.get(url, { encoding: null });
  return response
}

export async function identify (buffer) {
  try {
    const transformer = sharp(buffer);

    return transformer.metadata();
  } catch (err) {
    console.log(err);
  }
}
github TryGhost / gatsby-starter-ghost / plugins / gatsby-plugin-ghost-manifest / gatsby-node.js View on Github external
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));

var fs = require("fs");

var path = require("path");

var Promise = require("bluebird");

var sharp = require("sharp");

var _require = require("./common.js"),
    defaultIcons = _require.defaultIcons,
    doesIconExist = _require.doesIconExist;

sharp.simd(true);

function generateIcons(icons, srcIcon) {
  return Promise.map(icons, function (icon) {
    var size = parseInt(icon.sizes.substring(0, icon.sizes.lastIndexOf("x")));
    var imgPath = path.join("public", icon.src);
    return sharp(srcIcon).resize(size).toFile(imgPath).then(function () {});
  });
}

exports.onPostBuild = function _callee(_ref, pluginOptions) {
  var graphql, icon, manifest, _ref2, data, siteTitle, iconPath;

  return _regenerator.default.async(function _callee$(_context) {
    while (1) {
      switch (_context.prev = _context.next) {
        case 0:
github taniarascia / taniarascia.com / gatsby-node.js View on Github external
const path = require('path')
const kebabCase = require('lodash.kebabcase')
const moment = require('moment')
const siteConfig = require('./data/SiteConfig')
const sharp = require('sharp')
sharp.simd(false)
sharp.cache(false)

const postNodes = []

function addSiblingNodes(createNodeField) {
  postNodes.sort(({ frontmatter: { date: date1 } }, { frontmatter: { date: date2 } }) => {
    const dateA = moment(date1, siteConfig.dateFromFormat)
    const dateB = moment(date2, siteConfig.dateFromFormat)

    if (dateA.isBefore(dateB)) return 1
    if (dateB.isBefore(dateA)) return -1

    return 0
  })

  for (let i = 0; i < postNodes.length; i += 1) {

sharp

High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, GIF, AVIF and TIFF images

Apache-2.0
Latest version published 4 months ago

Package Health Score

92 / 100
Full package analysis