instagram-image-resizer
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Instagram Image Resizer

Resize and optimise images for Instagram post sizes.

This library can take a single image path or a folder containing multiple images and create images ready to be publish as Instagram posts.

Examples

TYPE SOURCE IMAGE OUTPUT IMAGES INSTAGRAM POST
Horizontal
Image


Square
Image
Vertical
Image

How it works

Resize a single image

To resize a single image src/image.jpg and save new images in the folder output, you can use it from the command line:

# npx instagram-image-resizer (sourceImagePath) (destinationPath)
npx instagram-image-resizer src/image.jpg output

or in your code:

npm install instagram-image-resizer
import resizer from "instagram-image-resizer";

// resizer(sourceImagePath, destinationPath)
const destinationFilesPaths = await resizer("src/image.jpg", "output");

// destinationFilesPaths will be an array containing the new file/files' paths

For example, for the horizontal image src/image.jpg, it will create 3 new images: output/image-1.jpg, output/image-2.jpg, output/image-3.jpg.

Resize a folder containing multiple images

To resize multiple images contained in a folder src, and save new images in the folder output, you can use it from the command line:

# npx instagram-image-resizer (sourceImagesFolderPath) (destinationPath)
npx instagram-image-resizer src output

or in your code:

npm install instagram-image-resizer
import resizer from "instagram-image-resizer";

// resizer(sourceImagePath, destinationPath)
const destinationFilesPaths = await resizer("src", "output");

// destinationFilesPaths will be an array containing the new files' paths

For example, if the source folder src will contain 2 vertical images src/cat.jpg and src/dog.jpg, it will create 2 new images: output/cat-1.jpg, output/dog-1.jpg.

Contribute

Do you want to contribute to this library? Read its CONTRIBUTE file.

Thanks

Thanks to:

Next Steps

  • Add logs for the CLI usage;
  • resize images for Instagram Stories.

Package Sidebar

Install

npm i instagram-image-resizer

Weekly Downloads

2

Version

1.0.1

License

MIT

Unpacked Size

8.2 MB

Total Files

23

Last publish

Collaborators

  • aureliome