Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
gm-image-tile
Advanced tools
Creates image tiles in Node.js using GraphicsMagick.
First, install GraphicsMagick. This is part of requirement for gm package.
Then, install this package by npm install gm-image-tile --save
.
To create image tiles from file otters.jpg
with tile size of 512 pixels. Call imageTile
in a Promise-fashion. By default, the output is in PNG format of type Buffer.
const imageBuffer = fs.readFileSync('otters.jpg');
imageTile(imageBuffer, 512).then(result => {
// Further processing here
});
imageTile
callAssumes the input image is 1024x768 and tile size is set to 512 pixels. After calling imageTile
, the result will be returned as Buffer, as follow. Notes the bottommost tiles are truncated and height is 256 pixels.
[
[
{ buffer: <Buffer>, x: 0, y: 0, width: 512, height: 512 },
{ buffer: <Buffer>, x: 512, y: 0, width: 512, height: 512 }
], [
{ buffer: <Buffer>, x: 0, y: 512, width: 512, height: 256 },
{ buffer: <Buffer>, x: 512, y: 512, width: 512, height: 256 }
]
]
By default, the output tiles are in PNG format. To output in JPEG format of quality level 80, you can call imageTile
as below.
const options = {
format: 'JPG',
quality: 80
}
imageTile(imageBuffer, 512, options).then(result => {
// Output buffers will be JPEG images of quality level 80
});
Like us? Please star us in GitHub and npm.
Bugs or suggestions? Please file us an issue.
FAQs
Creates image tiles in Node.js using GraphicsMagick.
We found that gm-image-tile 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 researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.