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 🙏

© 2024 – Pkg Stats / Ryan Hefner

img-magik

v1.0.2

Published

A simple image resizer component for React

Downloads

6

Readme

img-magik

Streamline image uploads and dynamic resizing effortlessly with the simple-image-resizer library. High-performance resizing, easy integration, and customizable options make your React apps shine with stunning visuals. Resize, upload, impress—simple as that!

img-magik is a lightweight React library that simplifies image uploading and resizing in web applications. It leverages the powerful Sharp library to provide efficient image processing while offering a user-friendly component for image uploads.

Table of Contents

Features

  • Efficient Image Resizing: Utilizes Sharp for high-quality and efficient image resizing.
  • User-Friendly Image Upload: Provides a simple React component (ImageUploader) for seamless image uploads.
  • Customizable Dimensions: Allows users to specify the desired width and height for resized images.
  • Optional Quality Control: Users can control the quality of resized images to balance file size and visual fidelity.
  • Compression Level Adjustment: Provides an option to adjust compression levels for optimized image sizes.
  • Support for Multiple Image Formats: Supports various formats (JPEG, PNG, WebP) for flexibility.
  • Intersection Observer for Lazy Loading: Implements lazy loading of images for enhanced performance.
  • Error Handling: Robust error handling for a smooth user experience.

Installation

npm install img-magik

usage

-this is an example of usage in react

import React from 'react';
import ImageUploader from 'img-magik';

const MyComponent = () => {
  return (
    <div>
      <h1>My Web Application</h1>
      <ImageUploader width={300} height={200} />
    </div>
  );
};

export default MyComponent;

configuration-options

-width (number): Desired width for the resized image. -height (number): Desired height for the resized image. -quality (number, optional): Image quality (1 to 100, default is 80). -compressionLevel (number, optional): Compression level for the chosen format (0 to 9, default is 9). -format (string, optional): Desired image format (e.g., 'jpeg', 'png', 'webp', default is 'jpeg').

EVENTS

onChange (function, optional): Triggered when a new image is selected.

##Common issues Error Handling: The library handles errors during the resizing process. Developers can use a try/catch block to handle custom errors.

##contribution Contributions are welcome! If you encounter issues or have ideas for improvements, please open an issue or submit a pull request on the GitHub repository.