Skip to content
forked from yig/yimg

A tiny, portable image class that can read and write PNGs (with the help of libpng), set color-plane layout (at compile-time), and resize/flip/mirror/greyscale.

License

Notifications You must be signed in to change notification settings

alecjacobson/yimg

 
 

Repository files navigation

Author: Yotam Gingold <yotam (strudel) yotamgingold.com>
License: Public Domain [CC0](http://creativecommons.org/publicdomain/zero/1.0/)
GitHub: https://github.com/yig/yimg

YImage:
    A simple pixel buffer class that can
        - save and load itself as a PNG (preserving alpha channel) among other formats
        - set color-plane layout (compile-time)
        - resize/flip/mirror/greyscale
    Simply include `YImage.hpp` in your program and compile `YImage.cpp` in it, too.

showpng:
    An example GLUT application using YImage that takes a PNG file as
    argument and displays it over a horrible green background.
    If no argument given loads included "sakura.png" file.
    Clicking inside the window displays a menu of commands.
    Keys are:
        - f: flip()
        - m: mirror()
        - g: greyscale()
        - s: save( "output.png" ).
        - c: captures current window backbuffer into "screen-capture.png"
        - q: quit
    Compile either with the one-liner at the top of `showpng.cpp`: `c++ -o showpng showpng.cpp YImage.cpp -I/usr/local/include -L/usr/local/lib -lGL -lGLUT`
    or use `cmake`: `mkdir build; cd build; cmake ..; make; ./showpng`

transparent.html:
    A basic web page to test the transparency of a PNG named "output.png".
    Try with the "output.png" generated by pressing 's' in showpng.

Version History:
    - 2006-04-08:
        initial release
    - 2007-11-13:
        Option to save PNG with less compression, but faster.
        Added methods (same() and same_rgb()) to test if two images are the same.
    - 2012-01-09:
        No longer generate warnings about non-string literals being used in fprintf.
        No longer generate warning about unused return value.
        Now includes <cstdio> for platforms that need it.
        Switched OS X libpng include/library paths from fink to macports.
    - 2015-12-22:
        Replaced libpng dependency with public domain stb_image* implementations (included).
        Now many more formats can be loaded (PNG,JPEG,TGA,BMP,PSD,GIF,PIC,PNM) and saved (PNG,BPM,TGA).
        Added a rescale() function.
        Switched to cmake.

About

A tiny, portable image class that can read and write PNGs (with the help of libpng), set color-plane layout (at compile-time), and resize/flip/mirror/greyscale.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 95.5%
  • C++ 4.3%
  • Other 0.2%