Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
node-pngquant-native
Advanced tools
node-pngquant-native is an addon of node, support node version v0.8.0 to latest, It compress a buffer
of .png
image, so can't call other processes.
npm install -g node-pngquant-native
if install fail for you. download the source install it.
clone source code
$ git clone https://github.com/xiangshouding/node-pngquant-native.git
invoke npm install -g .
$ cd node-pngquant-native
$ npm install -g .
node-gyp
, you can see detail information https://github.com/TooTallNate/node-gyp#installationwin32
, because VS not support C99.
var pngquant = require('node-pngquant-native');
fs.readFile('./alphatest.png', function (err, buffer) {
if (err) throw err;
var resBuffer = pngquant.compress(buffer, {
"speed": 1 //1 ~ 11
});
fs.writeFile('./alphatest_out.png', resBuffer, {
flags: 'wb'
}, function(err){});
});
compress(buffer, option)
var pngquant = require('node-pngquant-native')
var option = {
speed: 11
//...
}
var resBuffer = pngquant.compress(buffer, option);
option.speed
Speed/quality trade-off from 1 (brute-force) to 11 (fastest). The default is 3. Speed 10 has 5% lower quality, but is 8 times faster than the default. Speed 11 disables dithering and lowers compression level.
var opt = {
speed: 11
}
option.quality = [min, max]
min and max are numbers in range 0 (worst) to 100 (perfect), similar to JPEG. pngquant will use the least amount of colors required to meet or exceed the max quality. If conversion results in quality below the min quality the image won't be saved (if outputting to stdin, 24-bit original will be output) and pngquant will exit with status code 99.
var opt = {
quality: [40, 60]
}
option.iebug
Workaround for IE6, which only displays fully opaque pixels. pngquant will make almost-opaque pixels fully opaque and will avoid creating new transparent colors.
var opt = {
iebug: true
}
FAQs
A pngquant addon of node
The npm package node-pngquant-native receives a total of 160 weekly downloads. As such, node-pngquant-native popularity was classified as not popular.
We found that node-pngquant-native demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.