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

vue-image-alpha

v0.1.4

Published

vue-image-alpha is a Vue component allowing to use light-weight transparent images on a website.

Downloads

8

Readme

vue-image-alpha

vue-image-alpha is a Vue component allowing to use light-weight transparent images on a website.

It is a remastered version of imgAlpha.js I ceated a few years ago. This Vue version has a more efficient code and a faster image processing running in the background using Web Workers and buffer images.

preview

Suggestions are more than welcome, not only for feature requests but also for coding style improvements 😃

How it Works

vue-image-alpha uses 2 compressed images such as jpeg format to build a light-weight transparent image. No more ugly GIF and no more heavy PNG!!

Simply save your image in 2 regular jpeg files:

  1. The color image (on a plain color background)
  2. The alpha image (black is transparent and white is opaque)

Alpha image

Installation

vue-image-alpha is a Vue component that can be installed as dependency in you Vue CLI project.

The easiest way to install it is using NPM:

npm install --save vue-image-alpha

Usage

Component Initialization

All you need to do is to import vue-alpha-image in your Vue code

import ImgAlpha from 'vue-image-alpha'
...

export default {
    name: 'MyApp',
    components: {
        ImgAlpha,
        ...
    },
    ...
},

Component Use

Use the component in your html or template code

<img-alpha src="/path/to/myImage.jpg" src-alpha="/path/to/myImage-alpha.jpg" bg-color="#FFFFFF"></img-alpha>

or with data binding

<img-alpha :src="require('/path/to/myImage.jpg')" :src-alpha="require('/path/to/myImage-alpha.jpg')" bg-color="#FFFFFF"></img-alpha>

Props

Attribute | Type | Default | Description ------ | ---- | ------- | ----------- src | string | null | Color image URL src-alpha | string | null | Alpha image URL bg-color | string | #FFFFFF | The background color of the src image (optional)

scr

The src defines the color image source.

src-alpha

The src-alpha defines the alpha image used to make the color image transparent.

If the alpha image is not provided, the image transparency processing will be skipped and the image will be displayed as a regular image.

bg-color (optional)

The bg-color defines the background color of the color image.

By default, the bg-color is white (#FFFFFF)

This prop is used to provide a better alpha blending accuracy if you use a background color in the color image different than white.

License

MIT License

Copyright (c) 2019 Yann Masoch

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.