
Security News
OWASP 2025 Top 10 Adds Software Supply Chain Failures, Ranked Top Community Concern
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.
image-shader
Advanced tools
Tool to simplify writing shaders for HTML Image and Canvas elements.
This class class creates a webgl context and texture from a given HTMLImageElement or HTMLCanvasElement as
well as a fragment shader.
The shader is wrapped with the necessery definitions and functions to render the image.
import { ShaderImage } from "shader-image";
const source = new Image();
source.src = "some/url.png";
// only render the red channel of the image.
const shader = `
void main() {
vec4 pixel = getImagePixel();
gl_FragColor = vec4( pixel.r, 0, 0, 1 );
}
`;
const image = new ShaderImage( source, shader );
document.body.appendChild( image.domElement );
new ShaderImage( source, shader ) where source is either a HTMLImageElement or a HTMLCanvasElement and the
shader is a string in form of webgl shader. This means it has to include a void main() method in which or
subsequently from which the gl_FragColor is set.
Within the shader, these extra values are accessable:
vec4 getImagePixel(): Returns a vec4 of the current pixel in the fragment.vec2 uv: The UV Coordinates of the current pixel.domElement Returns a HTMLCanvasElement in the size of the source image containing the shaded image.width Returns the width of the content.height Returns the height of the content.dispose() Releases all memory. Since it uses WebGL internally, simply losing the reference will not clear
all memory.FAQs
Run WebGL shaders on an image or canvas.
We found that image-shader 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.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.