Research
Security News
Malicious PyPI Package ‘pycord-self’ Targets Discord Developers with Token Theft and Backdoor Exploit
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
@akabeko/svg2png
Advanced tools
Create PNG file from SVG file with puppeteer-core. Use the specified revision or installed Chromium for PNG file creation.
$ npm install @akabeko/svg2png
svg2png(options: SVG2PNGOptions): Promise<string[]>
Create the PNG file from the SVG file.
SVG2PNGOptions
Options.
String
Path of the input SVG file.String
Path of the output PNG file.Size[]
Sizes of the output PNG files.
Number
Width (px).Number
Height (px).String (Optional)
If use Chromium installed, specify the path of the executable file. If this is specified, fetcher
will be ignored.Object
Information for downloading and using Chromium.
String
Revision of the download Chromium. see: http://omahaproxy.appspot.com/String
Path of the directory to download. If not specified, it will be selected in the puppeteer-core directory of node_moduels
.Returns: Promise<string[]>
Path collection of the output PNG files.
If there is a single sizes
element, it will be output with the file name specified in output
.
When multiple sizes are specified, the size is specified in prefix like sample-256.png
. If there are multiple sizes and the width and heigth are different, it becomes like sample-24x32.png
.
Elements of sizes
with width
or height
less than or equal to 0
are ignored. Also, if elements with the same width
/height
are duplicated (e.g. [[24, 24], [24, 24]]
to [[24, 24]]
), only one of them will be processed.
import { svg2png } from '@akabeko/svg2png'
// Fetch Chromium
svg2png({
input: './sample.svg',
output: './sample.png',
sizes: [{ width: 256, height: 256 }],
fetcher: {
revision: '782078',
path: './renderer'
}
})
.then((results) => {
console.log(results)
console.log('Completed!!!')
})
.catch((err) => {
console.log(err)
})
// Use installed Chrome (Chromium) on macOS and multiple sizes
svg2png({
input: './sample.svg',
output: './sample.png',
sizes: [
{ width: 256, height: 256 },
{ width: 48, height: 64 }
],
executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
})
.then((results) => {
console.log(results)
console.log('Completed!!!')
})
.catch((err) => {
console.log(err)
})
Usage: svg2png [options]
Create PNG file from SVG file with puppeteer-core. Use the specified revision or installed Chromium for PNG file creation.
Options:
-i, --input <String> Path of the input SVG file. (default: "")
-o, --output <String> Path of the output PNG file. (default: "")
--sizes <Size[]> Sizes array of the output PNG file. Specify one element for the array if it is a square, and specify [width,height]
for a rectangle. e.g. [256,[256,128],...]
--executable-path <String> If use Chromium installed, specify the path of the executable file. If this is specified, `--fetcher-*` will be
ignored. (default: "")
--fetcher-revision <String> Revision of the download Chromium. see: http://omahaproxy.appspot.com/ (default: "")
--fetcher-path <String> Path of the directory to download. If not specified, it will be selected in the puppeteer-core directory of
`node_moduels`. (default: "")
-v, --version output the version number
-h, --help display help for command
Examples:
$ svg2png -i sample.svg -o sample.png --sizes [256] --executable-path "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
$ svg2png -i sample.svg -o sample.png --sizes [[24,32],256] --executable-path "C:\Program Files (x86)\Google\Chrome\Application\Chrome.exe"
$ svg2png -i sample.svg -o sample.png --sizes [256] --fetcher-revision 782078 --fetcher-path ./renderer
See also:
https://github.com/akabekobeko/npm-svg2png
FAQs
Create PNG file from SVG file with puppeteer-core
The npm package @akabeko/svg2png receives a total of 5 weekly downloads. As such, @akabeko/svg2png popularity was classified as not popular.
We found that @akabeko/svg2png 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 the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.