Giter VIP home page Giter VIP logo

pytextcodifier's Introduction

pytextcodifier

Codify your text files or Python strings.

You can simply:

pip install pytextcodifier

Or you can also:

  1. Clone the repository to your local machine.
  2. Enter the directory.
  3. Download necessary modules/libraries.
git clone https://github.com/gabrielstork/pytextcodifier.git
cd pytextcodifier
pip install -r requirements.txt

About

pytextcodifier allows you transform Python strings or text files (check example.txt and see the text file used to generate the image below) into encoded images like this:

Example

Every image matrix has two 8 digit arrays called stop and identifier (to be precise, the first 16 pixel values in the flattened image matrix). The identifier tells how the code should read the image, showing where the correct characters are located in the matrix. A private image requires a key to correctly extract the text in it, on the other side, if it is a non-private image, the text is extracted directly.

Examples

Public Encoding

Importing Encoder class.

from pytextcodifier import Encoder

Using the content of example.txt.

text = Encoder('example.txt', is_file=True)

Using encode() method with default arguments to actually encode it.

text.encode(size=(250, 250), private=False)

Seeing the generated encoded image (a new window will pop up).

text.show()

Saving it.

text.save('images/public_example.png')

Public Decoding

Importing Decoder class.

from pytextcodifier import Decoder

Instantiating the class passing an image as argument.

image = Decoder('example.png')

Decoding the image.

image.decode()

Seeing the text.

image.show()

Saving the text.

image.save('example.txt')

Private Encoding

Importing Encoder class.

from pytextcodifier import Encoder

Using the content of example.txt.

text = Encoder('example.txt', is_file=True)

Using encode() method setting the private parameter to True.

text.encode(size=(250, 250), private=True)

Saving it. This will save an extra image named 'key_private_example.png', you must use this to get the text correctly when decoding it.

text.save('images/private_example.png')

Private Decoding

Importing Decoder class.

from pytextcodifier import Decoder

Instantiating the class passing an image as argument.

image = Decoder('example.png')

Decoding the image.

image.decode(key='key_private_example.png')

Seeing the text.

image.show()

Saving the text.

image.save('example.txt')

forthebadge forthebadge

pytextcodifier's People

Contributors

gabrielstork avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

jhonnig simrit1

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.