
Security News
Static vs. Runtime Reachability: Insights from Latioβs On the Record Podcast
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
ngx-image-compression
Advanced tools
A lightweight Angular image compression and conversion library
A lightweight image compression and conversion library for Angular. Ideal for optimizing large images (like 10MB+) before uploading to S3 or a server. Supports format conversion (e.g., JPG β WebP), resizing, quality tuning, and base64 or Blob output.
webp
, jpeg
, png
)npm install ngx-image-compression
import { compressImage } from 'ngx-image-compression';
const result = await compressImage(file, {
maxWidth: 800,
maxHeight: 800,
quality: 0.7,
format: 'webp', // optional: 'jpeg', 'png', or 'webp'
returnType: 'file', // 'file' | 'base64' | 'blob'
fileName: 'output' // only for returnType: 'file'
});
Option | Type | Default | Description |
---|---|---|---|
maxWidth | number | 800 | Max width of output image |
maxHeight | number | 800 | Max height of output image |
quality | number | 0.7 | Compression quality (0 to 1) |
format | string | 'webp' | Output format: 'webp', 'jpeg', 'png' |
returnType | string | 'file' | 'file', 'base64', or 'blob' |
fileName | string | 'output' | File name (if returnType is file) |
returnType = 'file'
β returns a File
objectreturnType = 'blob'
β returns a Blob
returnType = 'base64'
β returns a string
(base64)const result = await compressImage(file, {
maxWidth: 1024,
maxHeight: 1024,
quality: 0.6,
format: 'jpeg',
returnType: 'base64'
});
this.previewUrl = result; // Display in
angular, image compression, image conversion, webp, optimize image, resize, compress, image, s3 upload, ngx, frontend compression
FAQs
A lightweight Angular image compression and conversion library
We found that ngx-image-compression demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.