@uploadcare/image-shrink
v6.21.0
Published
@uploadcare/image-shrink is a browser-based image compression library that shrinks images to a target resolution while preserving aspect ratios, EXIF metadata, and ICC color profiles. Outputs JPEG with configurable quality and automatically switches to PN
Downloads
474,458
Readme
Uploadcare Image Shrink
@uploadcare/image-shrink is a browser-based image compression library that shrinks images to a target resolution while preserving aspect ratios, EXIF metadata, and ICC color profiles. Outputs JPEG with configurable quality and automatically switches to PNG for images with transparency. Uses native canvas scaling with intelligent multi-pass fallback for iOS. Designed for pre-upload image optimization in web applications. See docs here.
Install
npm install @uploadcare/image-shrinkUsage
import { shrinkFile } from '@uploadcare/image-shrink'
const shrinkedBlob = shrinkImage(blob, {
size: number,
quality?: number
})Security issues
If you think you ran into something in Uploadcare libraries that might have security implications, please hit us up at [email protected] or Hackerone.
We'll contact you personally in a short time to fix an issue through co-op and prior to any public disclosure.
Feedback
Issues and PRs are welcome. You can provide your feedback or drop us a support request at [email protected].
