Git Product home page Git Product logo

imagelib's Introduction

imageLib.js

Module for processing and manipulation images on pure JavaScript

npm install imagelib -g

Install zlib:

npm install zlib -g

Example

var imageLib = require('./imageLib.js');

imageLib(200, 200).create(function() {
    var x, y;

	for(x=20; x < 180; x++) {
		for(y=20; y < 40; y++) {
			this.setPixel(x, y, 255, 0, 0, 255); // black
		}
	}
	
	for(y=0; y < this.height; y++) {
		this.setPixel(0, y, 255, 0, 0, 255);
		this.setPixel(this.width-1, y, 255, 0, 0, 255);
	}

	for(x=0; x < this.width; x++) {
		this.setPixel(x, 0, 255, 0, 0, 255);
		this.setPixel(x, this.height-1, 255, 0, 0, 255);
	}
	
	this.toPng('./images/simple.png');
	this.toJpeg('./images/simple.jpg');
});

API

imagelib's People

Contributors

lampaa avatar

Stargazers

 avatar Aram Rafeq avatar  avatar Makarov Anton avatar  avatar  avatar Andrey Kernichnyy (eXlight) avatar Artyom Chernyaev avatar Marat Nagayev avatar Meowu avatar Diego Cardoso avatar boeinfo avatar Erop avatar D0Gmatist avatar Luís Rodrigues avatar tian avatar weifeng avatar Nicolas Froidure avatar Nikita Skazki avatar Vitaliy avatar Alex Zet avatar coderaiser avatar Артём Пендюрин avatar  avatar Phil Pirozhkov avatar  avatar Ax avatar Max D avatar Valerii Baleiko avatar Dmitry Bolgov avatar Alex Havrylov avatar  avatar RN avatar Roman Bazhin avatar  avatar Ucovo Technologies avatar  avatar Konstantin avatar Iaroslav Voloshchuk avatar Oleksandr Kaleniuk avatar

Watchers

Rostyslav Bryzgunov avatar Sergey Poterianski avatar James Cloos avatar  avatar  avatar Erop avatar  avatar

imagelib's Issues

Copy partly-transparent images to white canvas

Hi! Great work :-) Is there any way to copy (party) transparent icons to a white canvas? Either its milky or its transparent :-(

var img = require('./libs/image-lib/imageLib.js')

img('./demo-app/images/icon.png').pngToData(function () {
  this.resize(160, 160, true)
  var icon = this
  
  img(180, 180).create(function () {
    
    for(x=0; x <= 180; x++) {
      for(y=0; y <= 180; y++) {
        this.setPixel(x, y, 255, 255, 255, 1);
      }
    }
    
    var canvas = this
    
    icon.pasteTo(canvas, 10, 10, false)
    
    canvas.toPng('./test.png')
    
  })  
  
})

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.