Giter VIP home page Giter VIP logo

ductr's Introduction

๐ŸŽจ Ductr

a small struct crate for reading, writing, and simple manipulation of the portable pixelmap format family

๐Ÿง  Design

This crate was made with the focus of quick and easy debugging as its main goal. Printing byte arrays quickly to a visual file can be great when debugging basic graphics and image manipulation algorithms, and the Portable pixelmap family format is one of the quickest to set up.

In the future this crate may extend to other raster file formats, such as JPEG or BMP

๐Ÿ–ฅ๏ธ How to use:

The following crate can be used by entering the following in your project's Cargo.toml file:

[dependencies]
ductr = "0.0.1"

โš™๏ธ Examples

use ductr::AnymapImage;

// Creating a 100x100 black pbm image

// Prepare buffer to be written to pbm format
let buffer = vec![1; 100*100];
 
// Create AnymapImage object with pbm constructor
let pbm_black = AnymapImage::pbm(buffer, 100, 100).unwrap();

// Write pbm as binary file 
pbm_black.write_as_binary("pbm_black_binary.pbm").expect("Error: could not to binary file.");
use ductr::AnymapImage;

// Inverting the colors of a given ppm image

// Create AnymapImage object from binary ppm image file
let mut cat = AnymapImage::read_from_binary("tests/images/cat_binary.ppm").expect("Error: could not read from binary file");

// Invert the image
cat.invert();

// Write ppm as binary file
cat.write_as_binary("tests/images/cat_inverted.pnm").expect("Error: could not write to binary file");

๐Ÿ“Œ Other Information on the format

๐Ÿ‘ค Authored by

Jonathan Kocevar

๐Ÿ“ License

This project is licensed under the terms of the GNU General Public License v3.0.

ductr's People

Contributors

kairosjk avatar

Stargazers

 avatar

Watchers

 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.