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

@expo/image-utils

Package Overview
Dependencies
Maintainers
16
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@expo/image-utils

A package used by Expo CLI for processing images

  • 0.2.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
947K
decreased by-3.36%
Maintainers
16
Weekly downloads
 
Created

What is @expo/image-utils?

@expo/image-utils is a utility package for image processing tasks such as resizing, compressing, and converting images. It is particularly useful in the context of Expo and React Native applications.

What are @expo/image-utils's main functionalities?

Resize Image

This feature allows you to resize an image to specified dimensions. The code sample demonstrates how to read an image from the file system, resize it to 100x100 pixels, and save the resized image back to the file system.

const { resizeImage } = require('@expo/image-utils');
const fs = require('fs');

async function resize() {
  const imageBuffer = fs.readFileSync('path/to/image.jpg');
  const resizedImage = await resizeImage(imageBuffer, { width: 100, height: 100 });
  fs.writeFileSync('path/to/resized-image.jpg', resizedImage);
}
resize();

Compress Image

This feature allows you to compress an image to reduce its file size. The code sample demonstrates how to read an image from the file system, compress it with a quality setting of 0.8, and save the compressed image back to the file system.

const { compressImage } = require('@expo/image-utils');
const fs = require('fs');

async function compress() {
  const imageBuffer = fs.readFileSync('path/to/image.jpg');
  const compressedImage = await compressImage(imageBuffer, { quality: 0.8 });
  fs.writeFileSync('path/to/compressed-image.jpg', compressedImage);
}
compress();

Convert Image Format

This feature allows you to convert an image from one format to another. The code sample demonstrates how to read a JPEG image from the file system, convert it to PNG format, and save the converted image back to the file system.

const { convertImageFormat } = require('@expo/image-utils');
const fs = require('fs');

async function convert() {
  const imageBuffer = fs.readFileSync('path/to/image.jpg');
  const convertedImage = await convertImageFormat(imageBuffer, { format: 'png' });
  fs.writeFileSync('path/to/converted-image.png', convertedImage);
}
convert();

Other packages similar to @expo/image-utils

Keywords

FAQs

Package last updated on 20 Sep 2019

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