
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
@ysfe/watermark
Advanced tools
描述: 通用水印插件
yarn add @ysfe/watermarkconst outImage: string = await watermark(sourceImage, watermarkImage, {
/* options|可选 */
}) // return base64
参数及用法, 请看
./src或 单测用例
| 参数 | 描述 | 类型 | 是否必填 | 其他说明 |
|---|---|---|---|---|
| sourceImage | 原始图片 | HTMLImageElement/File/string | [x] | |
| watermarkImage | 水印图片 | HTMLImageElement/File/string | [x] | |
| options | 可选参数 | IOptions | | [] |
{
size?: 'origin' | 'fill'
align?: 'center' | 'lt' | 'lb' | 'rt' | 'rb'
alpha?: number
dataUrlType?: string
quality?: number
}
原理: 基于 canvas 图层叠加实现水印效果.
FileRender()读取文件 buffer 流, 然后转化 Image 对象.ctx.drawImage()进行图片绘制.
关键点在于 canvas 尺寸设置和不同定位方式的定位计算公式.
每次绘制完成后, 要通过 ctx.store() 还原画笔位置image/png
导出后, 需要额外补充 data:image/png;base64, Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Headers "referer, range, accept-encoding, x-requested-with"
[其他说明事项]
FAQs
We found that @ysfe/watermark demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.