Giter Club home page Giter Club logo

file2image's Introduction

File2Image

Convert any binary file into an image (using Python 3.8 on Windows 10).

把任意二进制文件转换为一张图片(测试环境为 Python 3.8 和 Windows 10)。

file2img_demo.py

This is a demo for converting files into RGB PNG images. Users should customise the code to meet their needs.

In this demo, he input is defined by variable original_file, with the output image defined by end_file. The size of the output image is 256 * x, where x is the height and is determined by the size of original file.

此代码仅为将文件转换为 PNG 格式的 RGB 图像的示例。使用者需要根据各自不同的需求来重新定制代码。

在本示例中,变量 original_file 是待转换的文件路径,变量 end_file 是转换后的图片路径。输出的图片大小为 256 * x,其中 x 是图片的高度,并由输入文件的大小决定。

img2file_demo.py

In this demo, images are recovered to the original files. Also, further developments are needed to meet different needs.

recovery_img is the image converted from a file, and recovery_file is the output. SHA256 is calculated to check the result.

在本示例中,图片将被恢复为原始文件。同样,使用者需要对代码进行修改,以满足使用需要。

recovery_img 是由文件转换的图片,recovery_file 是从图片中恢复的文件。这里使用 SHA256 来检验恢复是否成功。

dcx.pdf

Demo. The file to be converted into an image. (Photos in pdf are Ding Chengxin.)

样例。将转换为图片的文件。(文中的照片是丁程鑫 。)

dcx2.png

Demo. The output of file2img_demo.py and input of image2file_demo.py.

样例。file2img_demo.py 的输出和 image2file_demo.py 的输入。

file2image's People

Contributors

oicid avatar

Stargazers

 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.