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

marvin-ts

v1.1.0

Published

typescript image processing framework

Downloads

13

Readme

Marvin-TS

Marvin-TS is Typescript version of Marvin Image Processing Framework with some more features and updates.

Tutorial

Install

You can install from npm or yarn

NPM

npm i marvin-ts

Yarn

yarn add marvin-ts

Image Loading

The first step to use Marvin-TS is load a image.

   import { MarvinImage } from "marvin-ts"

   // load from remote image
   let url = "http://ww.exemple.com/image.jpg";
   const image = await new MarvinImage().load(url);

   // or load from local image
   let url2 = fs.readSyncFile("image.png");
   const image2 = await new MarvinImage().loadFromBase64(url2);

Marvin instance

Before load image you need create a new Marvin instance

   import Marvin, { MarvinImage } from "marvin-ts"
   ...
   ...
   // image is the MarvinImage instance the you create before
   const marvin = new Marvin(image);

   // Now you can use all features of Marvin-TS

Features

Blur

   // gaussian blur
   marvin.gaussianBlur(10)

Color

   // Average color
   marvin.averageColor()

   // Black and white
   marvin.blackAndWhite(50)

   // Brightness and Contrast
   marvin.brightnessAndContrast(50, 50)

   // Emboss
   marvin.emboss()

   // Gray scale
   marvin.grayScale()

   // Heat map
   marvin.heatMap(10)

   // invert colors
   marvin.invertColors()

   // Posterization
   marvin.posterize(10);

   // Thresholding
   marvin.thresholding(10);

   // Serpia
    marvin.sepia(5);

   // Color channels
   marvin.colorChannel("#fefc58", 20);

Combine

   // Combine by alpha
   marvin.combineByAlpha(image3, 10, 20)

   // Merge photos
   marvin.mergePhotos([image3], 10);

Corner

   // Moravec corner detector
   marvin.moravec(5, 500);

Draw

   // Circle
   marvin.drawCircle(10, 10, 20);

   // Regular curve
   marvin.drawCurve(10, 10, 20, 20, 30);

   // Quadratic curve
   marvin.drawQuadraticCurve(10, 10, 20, 20, 30, 30);

   // Cubic curve
   marvin.drawCubicCurve(10, 10, 20,20, 25,35, 30,30);

   // Ellipse
   marvin.drawEllipse(10, 10, 20, 20);

   // Line
   marvin.drawLine(10, 10, 20, 20);

   // Rectangle
   marvin.drawRect(10, 10, 20, 20);

   // Star
   marvin.drawStar(10, 10, 20, 20);

   // Start path
   marvin.pathStart(10, 10);

   // Line to
   marvin.lineTo(10, 10);

   // Quadratic curve to
   marvin.quadraticCurveTo(10, 10, 20, 20);

   // Cubic curve to
   marvin.cubicCurveTo(10, 10, 20, 20, 30, 30);

   // Regular curve to
   marvin.curveTo(10, 10, 20, 20);

Edge

   // Prewitt edge detector
   marvin.prewitt(1);

   // Sobel edge detector
   marvin.sobel(1);

   // Canny edge detector
   marvin.canny(100, 500);

Text

   // Find text
   marvin.findTextRegions(10, 20, 5, 40);

   // Write text on image
   marvin.write("Exemple", 10, 20);

Restoration

   // Noise reduction
   marvin.noiseReduction(10);

Segment

   // Crop image
   marvin.crop(10, 20, 30, 40); 

Transform

   // Flip horizontal
   marvin.flipHorizontal();

   // Flip vertical
   marvin.flipVertical();

   // Flip horizontal and vertical
   marvin.flipBoth();

   // Rotate
   marvin.rotate(90);

   // Scale
   marvin.scale(2, 2);

Get or save

   // Get back Marvin image after process
   marvin.flipVertical().output();

   // Save image as JPEG or PNG
   marvin.save("output/image.png");   

Chains

   // Easily run as many functions as you want with function chains
   marvin.flipBoth()
   .scale(2, 2)
   .noiseReduction(10)
   .drawRect(10, 10, 20, 20)
   .save("out")

IMPORTANT! Chains run only in functions that return a marvin instance

This project is a fork of MarvinJ