Giter Club home page Giter Club logo

pngcs's Introduction

GOALS: Complete PNG encoding and decoding for Unity engine

  • Simple API to read and write Texture2D objects, raw data
  • Drop "Pngcs" folder in your project, no other dependencies, just works.

API:

  • Texture2D PNG.Read
  • Texture2D PNG.ReadAsync (experimental)
  • Color[] PNG.ReadColors
  • Color[] PNG.ReadColorsAsync (experimental)
  • PNG.Write
  • PNG.WriteAsync (experimental)
  • PNG.WriteLargeAsync (experimental)
  • PNG.WriteGrayscaleAsync (experimental)

TODO:

  • PNG.Read creating Texture2D in every useful TextureFormat, infered from file (partially done already)
  • Improve READ/WRITE speeds
  • PNG.Read/Write byte[]
  • PNG.Read with target width and height arguments (to preview bigger image etc.)
  • PNG.Read with image rect argument (read texture atlas region)

HOW TO USE:

using UnityEngine;
using Pngcs.Unity;
public class PngcsTest : MonoBehaviour
{
    void Awake ()
    {
        // THIS IS HOW YOU READ:
        Texture2D texture = PNG.Read( @"D:/input.png" );

        // THIS IS HOW YOU WRITE:
        PNG.Write( texture , @"D:/output.png" );
    }
    
    void OnDestroy ()
    {
        //remember to always release memory when texture is not needed anymore:
        Destroy( texture );
    }
}

REQUIREMENTS:

  • Unity 2017.1
  • Scripting runtime version: C# 4.x

This window is available under top menu bar/Test/Pngcs Load Pngcs test window Note: Alpha8 images appear inverted here but aren't - it's due to no color info but black fill and transparency.

pngcs's People

Contributors

andrew-raphael-lukasik avatar leonbloy avatar sungiant avatar

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.