Skip to content

LordDeatHunter/Imaginenc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Imaginenc

PyPI Versions License Build

Convert any file into an image, and images back to files.

Source Code Image

Installation

Imaginenc is available on PyPI:

$ python -m pip install imaginenc

Imaginenc requires Python 3.8+.

Usage

usage: imaginenc [-h] (-e | -d) -i INPUT [-o OUTPUT] [-s SIGN]

Convert any file into an image, and images back to files. Run without args for interactive input mode.

optional arguments:
  -h, --help            show this help message and exit
  -e, --encode          encode file to image
  -d, --decode          decode image to file
  -i INPUT, --input INPUT
                        input file
  -o OUTPUT, --output OUTPUT
                        output folder
  -s SIGN, --sign SIGN  sign the encoded image (max 50 characters)

Examples of imaginenc command

Encode

imaginenc -e -i imaginenc\imaginenc.py -o images -s "Thank you for using this tool!"

Decode

imaginenc -d -i images\imaginenc.py.png -o output

Examples of imaginenc module

Import

import imaginenc

Encode file name and save as image

imaginenc.encode_file_name(
    input_file_path='imaginenc/imaginenc.py',
    output_file_path='images',
    sign='signature'
)

Encode file bytes and return image

with open('imaginenc/imaginenc.py') as f:
    image = imaginenc.encode_bytes_to_image(
        input_file_bytes=f.read(),
        file_name=f.name(),
        sign='signature'
    )

Decode image name and save as original file

metadata = imaginenc.decode_image_name(
    input_file_path='images/imaginenc.py.png',
    output_file_path='output'
)

Decode PIL image to original file bytes

from PIL import Image

image = Image.open('images/imaginenc.py.png')
file_bytes, metadata = imaginenc.decode_image_to_bytes(
    image=image
)

Planned Features

  • Encryption.
  • Converting by segments (for large files)

About

File to Image

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages