Socket
Book a DemoInstallSign in
Socket

pixel-serve-client

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pixel-serve-client

The `Pixel Serve` component is a powerful and flexible React component designed to handle dynamic image rendering with support for multiple formats, lazy loading, and additional customization options.

0.0.5
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

Pixel Serve Client Component

The Pixel Serve component is a powerful and flexible React component designed to handle dynamic image rendering with support for multiple formats, lazy loading, and additional customization options.

Features

  • Multi-format support: Automatically generates image sources for AVIF, WebP, and other formats.
  • Lazy Loading: Loads images only when they come into view, improving performance.
  • Dynamic Dimensions: Allows for responsive width and height.
  • Customizable: Supports styles, classes, and multiple use cases (e.g., background images, avatars).
  • Placeholder Skeletons: Displays a loading skeleton until the image is ready.

Installation

To use this component in your project, install it via npm:

npm install pixel-serve-client

Usage

Basic Example

import Pixel from "pixel-serve-client";

const App = () => (
  <Pixel
    src="/path/to/image.jpg"
    alt="Example Image"
    width={300}
    height={200}
  />
);

export default App;

Props

PropTypeDefaultDescription
srcstringRequiredThe source URL of the image.
classNamestringundefinedCustom CSS class for the component.
altstring'image'Alt text for the image.
styleCSSProperties{}Inline styles for the image.
backgroundbooleanfalseWhether the image is used as a background.
lazybooleantrueEnables lazy loading for the image.
widthnumberundefinedWidth of the image in pixels.
heightnumberundefinedHeight of the image in pixels.
qualitynumberundefinedImage quality for compression (if applicable).
userIdstringundefinedID of the user who owns the image (used in dynamic image paths).
avifbooleantrueWhether to generate an AVIF source for the image.
webpbooleantrueWhether to generate a WebP source for the image.
mimeTypestring'jpeg'MIME type of the image (e.g., 'jpeg', 'png').
directbooleanfalseLoads the image directly without generating multiple formats.
loaderbooleantrueDisplays a skeleton loader while the image is loading.
dynamicDimensionbooleanfalseDynamically adjusts dimensions based on the width and height provided.
backendUrlstring/api/v1/pixel/serveThe backend URL for the image.
folder'public' | 'private''public'Specifies whether the image is in a public or private folder.
type'normal' | 'avatar''normal'Specifies the type of image (e.g., normal image or avatar).

Other Examples

Using Pixel Serve as a background image:

<Pixel
  src="/path/to/background.jpg"
  background={true}
  style={{ borderRadius: "10px" }}
  width={500}
  height={300}
/>

License

This project is licensed under the MIT License. See the LICENSE file for details.

Author

Developed by Hiprax.

Keywords

Pixel Serve

FAQs

Package last updated on 10 May 2025

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.