Skip to main content

Convert any file into an image

Project description

Imaginenc

Convert any file into an image, and images back to files. Currently, there is no built-in way of knowing the file type of the converted image.
Linux users can use the file command.
Windows doesn't have anything by default, so users would need to download a Terminal Emulator.

Source Code Image

Installation

Install Python 3.8+ and add it to the system path.
Run pip install -r requirements.txt inside the folder and wait for the installation to finish.
Run python imaginenc.py

Usage

usage: imaginenc.py [-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

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

Decode

python imaginenc\imaginenc.py -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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imaginenc-1.0.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

imaginenc-1.0.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file imaginenc-1.0.0.tar.gz.

File metadata

  • Download URL: imaginenc-1.0.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.11

File hashes

Hashes for imaginenc-1.0.0.tar.gz
Algorithm Hash digest
SHA256 253a1152605b5a670d43a08c8e0144a99c080b9dc135406fa59328c7fc047fc2
MD5 5f9a343b6dcd4c8f268f3fc4000aca3c
BLAKE2b-256 875d4141dc39f8c5ada2326a93359155ec26b4385cbd7ece7f5ace024f1c7f61

See more details on using hashes here.

File details

Details for the file imaginenc-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: imaginenc-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.11

File hashes

Hashes for imaginenc-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c018721d9d4bc99ba1a145fda587bc4b0ba2e39abf1404d4f7718666e5754e31
MD5 57a6e83834ad5b4b02a9b547e125fc1a
BLAKE2b-256 87f5e767f9d98c08e717fc9129aa92baa7c4cae0b7b879020836e1070fd42c04

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page