Coder Social home page Coder Social logo

binarypic's Introduction

binarypic

Small program to convert a binary file to grayscale 1-byte-1-pixel png and back using stb_image and stb_image_write.

To allow for converting back the image is padded to a rectangle with some pixel that is different value than last valid one (so the decoding can strip it). Even images of 'nice' size like 16 byte binary file that'd be a 4x4 image with no padding will be padded so decoder always knows that all trailing pixels of same value are padding and not data. This allows for a byte perfect roundtrip.

The idea for this program appeared when I ran across a multi-meg file that had most of its bytes set to 0 but due to its size even tiny font and a fullscreen hex viewer weren't enough to show it. An image generated by this program would make such large swathes of 0s or other patterns easy to see at a glance.

Example of image generated from exe of this very program:

example.png

Go to releases to download a Windows exe compiled with Pelles C with no -O2 to avoid running into any -O2 optimizer bug similar to this one that affected stb_image: Pelles C forum bug report

binarypic's People

Contributors

frex avatar

Watchers

 avatar  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.