Skip to content

prokop321/lost-compressor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image Compression Function

This function compresses an image to a specified maximum dimension and quality. It also allows you to specify the format of the compressed image.

Parameters

  • image: The image file to be compressed.
  • maxDimension: The maximum dimension (width or height) for the compressed image.
  • quality: The quality of the compressed image. It should be a number between 0 and 1. Default is 0.7.
  • format: The format of the compressed image. It can be "webp", "jpeg", or "png". Default is "jpeg".

Returns

This function returns a Promise that resolves to a File object representing the compressed image.

Example

const compressedImage = await compressImage(imageFile, 800, 0.8, "jpeg");

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published