npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pixelfiddler/next

v1.0.5

Published

Next.js image component and loader for PixelFiddler image transformation SDK

Readme

@pixelfiddler/next

Next.js image component for PixelFiddler image transformations. A drop-in wrapper around next/image with automatic optimization through PixelFiddler CDN.

Installation

npm install @pixelfiddler/next
# or
pnpm add @pixelfiddler/next
# or
yarn add @pixelfiddler/next

Note: This package requires next >= 13.0.0 and react >= 18.2.0 as peer dependencies.

Quick Start

import { PixelFiddlerImage } from '@pixelfiddler/next';

function App() {
  return (
    <PixelFiddlerImage
      src="https://example.com/photo.jpg"
      alt="A beautiful photo"
      width={800}
      height={600}
      transformations={{ format: 'WEBP', quality: 80 }}
    />
  );
}

Components

PixelFiddlerImage

A wrapper around Next.js Image component that uses PixelFiddler as the image loader for automatic optimization.

import { PixelFiddlerImage } from '@pixelfiddler/next';

// Basic usage with dimensions
<PixelFiddlerImage
  src="https://example.com/photo.jpg"
  alt="Profile photo"
  width={400}
  height={300}
/>

// Fill container
<PixelFiddlerImage
  src="https://example.com/photo.jpg"
  alt="Hero image"
  fill
  sizes="(max-width: 768px) 100vw, 50vw"
/>

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | src | string | required | URL of the image (relative or absolute). Relative paths are attached to baseUrl | | baseUrl | string | - | Base URL endpoint from PixelFiddler Dashboard. Can be set via PixelFiddlerProvider | | sizes | string | - | Sizes attribute for responsive images (e.g., "(max-width: 768px) 100vw, 50vw") | | responsive | boolean | true | Enable automatic srcset generation via PixelFiddler loader | | transformations | TransformationOptions | - | Image transformation options |

All standard Next.js Image props (width, height, fill, quality, priority, placeholder, unoptimized, className, etc.) are also supported.

PixelFiddlerProvider

A context provider for sharing configuration across all PixelFiddlerImage components.

import { PixelFiddlerProvider, PixelFiddlerImage } from '@pixelfiddler/next';

function App() {
  return (
    <PixelFiddlerProvider config={{ baseUrl: 'https://cdn.example.com' }}>
      <PixelFiddlerImage src="/photos/hero.jpg" alt="Hero" fill sizes="100vw" />
      <PixelFiddlerImage src="/photos/thumb.jpg" alt="Thumbnail" width={200} height={200} />
    </PixelFiddlerProvider>
  );
}

Props

| Prop | Type | Description | |------|------|-------------| | config | PixelFiddlerConfig | Configuration object with baseUrl and optional maxDpr | | children | ReactNode | Child components |

Usage Examples

Basic Transformations

<PixelFiddlerImage
  src="https://example.com/photo.jpg"
  alt="Transformed image"
  width={800}
  height={600}
  transformations={{
    format: 'WEBP',
    quality: 85,
    blur: 10,
  }}
/>

Fill Container

Use fill prop for images that should fill their parent container:

<div style={{ position: 'relative', width: '100%', height: '400px' }}>
  <PixelFiddlerImage
    src="https://example.com/hero.jpg"
    alt="Hero banner"
    fill
    sizes="100vw"
    style={{ objectFit: 'cover' }}
    transformations={{ format: 'WEBP' }}
  />
</div>

Priority Loading

For above-the-fold images, use priority to preload:

<PixelFiddlerImage
  src="https://example.com/hero.jpg"
  alt="Hero image"
  width={1200}
  height={600}
  priority
  transformations={{ format: 'WEBP' }}
/>

Disable Responsive Behavior

When responsive is false, the image URL is built with exact transformations and no srcset is generated:

<PixelFiddlerImage
  src="https://example.com/photo.jpg"
  alt="Non-responsive"
  width={400}
  height={300}
  responsive={false}
  transformations={{ width: 400, height: 300, format: 'WEBP' }}
/>

Unoptimized Images

Skip the PixelFiddler loader entirely:

<PixelFiddlerImage
  src="https://example.com/photo.jpg"
  alt="Unoptimized"
  width={400}
  height={300}
  unoptimized
/>

With Quality Override

The quality prop is passed to transformations:

<PixelFiddlerImage
  src="https://example.com/photo.jpg"
  alt="High quality"
  width={800}
  height={600}
  quality={95}
/>

Responsive Sizes

<PixelFiddlerImage
  src="https://example.com/photo.jpg"
  alt="Responsive image"
  fill
  sizes="(max-width: 640px) 100vw, (max-width: 1024px) 50vw, 33vw"
  transformations={{ format: 'WEBP' }}
/>

How It Works

The component uses a custom Next.js image loader that:

  1. Receives width requests from Next.js's responsive image system
  2. Builds PixelFiddler transformation URLs with the requested width
  3. Applies any additional transformations you specify

This means Next.js handles the responsive srcset generation while PixelFiddler handles the actual image transformations and delivery.

TypeScript

Full TypeScript support with exported types:

import type {
  PixelFiddlerImageProps,
  PixelFiddlerContextValue,
  TransformationOptions,
  ResizeOptions,
  FormatOptions,
  EffectOptions,
  CropOptions,
  BorderOptions,
  TextOptions,
  WatermarkOptions,
  PixelFiddlerConfig,
} from '@pixelfiddler/next';

Related

License

MIT