Skip to content

Mohid123/ngx-blurhash-render

Folders and files

NameName
Last commit message
Last commit date

Latest commit

022e559 Β· Jan 7, 2025

History

45 Commits
Dec 29, 2024
Jan 7, 2025
Dec 29, 2024
Dec 29, 2024

Repository files navigation

NgxBlurhashRender

This is a simple lighweight library that renders the blurhash of a provided image. For Angular 15+.

Note: Requires blurhash as a dependency.

Warning: Not available for versions older than Angular 15. Currently supports Versions 15-18.

Features

  • Smooth animation for transition from canvas to image πŸ’–
  • Auto decoding of provided blurhash string and rendering to canvas πŸ’ͺ
  • Customisable for images and containers of all sizes πŸ€–
  • Blazingly fast and easy on your bundle size πŸš€

Example

Import the package directly as a standalone component.

import { NgxBlurhashComponent } from 'ngx-blurhash-render';

@Component({
  selector: 'app-root',
  standalone: true,
  imports: [CommonModule, NgxBlurhashComponent],
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})

In your HTML file simply add the following code snippet:

  <ngx-blurhash-render
    [blurHash]="'L38gy-00~qIUIUt7M{RjM{j[t7of'"
    [imageSrc]="'https://api.animetography-blog.com/api/media-upload/mediaFiles/test/31146bc10b344cdb90a13eae66102953f7.jpg'"
    [width]="'100px'"
    [height]="'100px'"
    [borderRadius]="'12px'"
  >
  </ngx-blurhash-render>

Options

Input Value Description
[blurHash] 'string' The blurhash string
[imageSrc] 'string' The actual image path or url
[width] 'string' The width of the image
[height] 'string' The height of the image
[borderRadius] 'string' The border radius of the image