Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
crop-image-stream
Advanced tools
Crop an image stream
Crops a raw image stream, returns a cropped raw image stream, compatible with pixel-stream
. Everything is streams, so you can crop giant images without a memory overhead, only one line of the input image is held in memory at a time.
npm i --save crop-image-stream
See examples.
var fs = require('fs')
var path = require('path')
var JPEGDecoder = require('jpg-stream/decoder')
var JPEGEncoder = require('jpg-stream/encoder')
var Crop = require('crop-image-stream')
var inputFilename = path.join(__dirname, 'dramatic_chipmunk.jpg')
var outputFilename = path.join(__dirname, 'dramatic_chipmunk_crop.jpg')
var cropOpts = {
x: 575,
y: 20,
width: 275,
height: 200
}
fs.createReadStream(inputFilename)
.pipe(new JPEGDecoder())
.pipe(Crop(cropOpts))
.pipe(new JPEGEncoder())
.pipe(fs.createWriteStream(outputFilename))
var Crop = require('crop-image-stream')
Where:
opts.x
- X coordinate of left side of crop area, measured from the left of the original image. Default 0
opts.y
- Y coordinate of top of crop area, measured from the top of the original image. Default 0
opts.width
- Width of crop area. Default input image width. If opts.x + opts.width > inputImageWidth
, the crop area width will be inputImageWidth - opts.x
opts.height
- Height of crop area. Default input image height. If opts.y + opts.height > inputImageHeight
, the crop area height will be inputImageHeight - opts.y
You must pipe a stream of raw image data that emits a format
event with format = {height: inputImageHeight, width: inputImageWidth, colorSpace: inputImageColorSpace
. Returns a stream of raw image data which will also emit a format
event. Compatible with pixel-stream
but does not support frames (animated images).
PRs accepted.
Small note: If editing the Readme, please conform to the standard-readme specification.
MIT © Digital Democracy
FAQs
Crop an image stream
The npm package crop-image-stream receives a total of 0 weekly downloads. As such, crop-image-stream popularity was classified as not popular.
We found that crop-image-stream demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.