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.
glaciall-bitmap
Advanced tools
Manipulate bitmap image with pure JavaScript, and can be base64 format to display on web
基于Javascript的bitmap处理,并且将位图输出为base64编码以便于浏览器进行显示,代码超精简,低内存占用。
npm install --save glaciall-bitmap
import {
BitMap,
} from 'glaciall-bitmap';
export class YourReactClass extends React.PureComponent {
constructor(props, ctx) {
super(props, ctx);
this.bmp = new BitMap();
this.bmp.fromBase64(props.base64Bmp.replace(/^data:image\/bmp;base64,/, ''));
}
}
一、Bitmap.create(width, height, bgcolor)
创建一个width x height像素大小的位图,底色为bgcolor所代表的颜色。
如:bitmap.create(10, 10, 0xff0000); // 创建一个10 x 10像素的底色为红色的位图
二、Bitmap.toBase64()
将位图输出为base64编码的带datauri头(data:image/bmp;base64,)的字符串,以便于在浏览器里显示。
如:document.getElementById('img1').src = bitmap.toBase64();
三、Bitmap.fromBase64()
自图像的BASE64编码中恢复位图数据,目前只支持24位色的BMP位图数据。
如:bitmap.fromBase64('Qk06AAAAAAAAADYAAAAoAAAAAQAAAAEAAAABABgAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==');
四、Bitmap.setBitmapBytes(val, idx, length)
修改bitmap位图数据的第idx位置起的length字节为val值。
五、Bitmap.getBitmapBytes(idx, length)
获取bitmap位图数据的第idx位置起的length个字节的值,返回值为数组。
六、Bitmap.setHeaderValue(attribute, headerValue)
设置attribute头属性的值为headerValue,attribute必须为BitMapFormat的成员属性,需要提供offset、length等属性值。
如:bitmap.setHeaderValue(BitmapFormat.biWidth, 500); // 设置位图的宽度为500像素值
七、Bitmap.getHeaderValue(attribute)
获取位图attribute头属性的值,attribute必须为BitmapFormat的成员属性,需要提供offset、length等属性值,返回的是经过Endian转换后的实际整数值。
八、Bitmap.setPixel(x, y, color)
设置位图的(x, y)位置的像素值为color。
九、Bitmap.getPixel(x, y)
获取位图的(x, y)位置的RGB值,返回的内容为[ rr, gg, bb ]的数组内容
glaciall authorized flyskywhy to publish glaciall-bitmap on npm.
FAQs
Manipulate bitmap image with pure JavaScript, and can be base64 format to display on web
The npm package glaciall-bitmap receives a total of 8 weekly downloads. As such, glaciall-bitmap popularity was classified as not popular.
We found that glaciall-bitmap 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.