Giter Site home page Giter Site logo

ppm-image-depreciated's Introduction

PPM Image

Easily load, save, stream, create, and edit ppm images.

using namespace ppm;

// Create a 600 by 400 PPM image
image<600, 400> img;

// Set the pixel at (555, 369) to red
img.at(555, 369) = color::red;

// Set the pixel at (123, 456) to dark magenta using rgb
img.at(123, 456) = color(127, 0, 127);

// Save the image as "out.ppm"
std::ofstream os("out.ppm");
os << img;

// Load an image from "in.ppm"
std::ifstream is("in.ppm");
is >> img;

ppm-image-depreciated's People

Contributors

wesofx avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ppm-image-depreciated's Issues

file not in binary mode

Very nice lib you got here but you forgot to set the mode to binary therefore ofstream translated every "\n" to "\r\n" (on windows). Also there was an std::endl in there which isn't a good idea either.

I changed it to:

std::ofstream file(filename, std::ios_base::binary);
//Write PPM header
file << "P6" << "\n"
     << std::to_string(width) << ' ' << std::to_string(height) << "\n"
     << "255\n"; // 24 bit

and now it works fine.

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.