Code Monkey home page Code Monkey logo

image-frame's Introduction

Image Frame Banner

Add colorful frames to your images and gifs.


GitHub last commit GitHub license


Image Frame is a simple command line script that allows you to add borders to your image file.


Table of contents


What it does

Image Frame takes any image file (including gifs) and adds a customizable colored frame/border around it. This is a technique that I personally use in a few of my readme files (see my ManyMiles repository) to add a bit of personality and color.

This is something that can be achieved through image editing software like Photoshop or other online services, but nearly all of them require payment to remove a watermark, work with certain file types like gifs, or remove file size limitations. This project aims to make the process as simple and painless as possible, and most importantly, free.

Getting set up

The source code can be viewed on Github here.

It is also assumed that Python is already installed on your machine.

Cloning the repository

The first step to using Image Frame is to clone this repository. To do this, open a command line instance and change your working directory to the directory you'd like to clone the repository to.

cd "path/to/clone/repository/to"

Then, use the following command to clone the repository.

git clone https://github.com/jakebrehm/image-frame.git

Once that's done, change your working directory to the directory you just cloned.

cd "image-frame"

Creating the virtual environment

Now, you can optionally create a virtual environment to run the project in. This will keep all of the dependencies for this project neatly tucked away from your system installation of Python, allowing for easy organization and uninstallation.

python3 -m venv env

If you chose to create the virtual environment, you need to activate it using source env/bin/activate (Unix) or .\env\Scripts\activate (Windows). You can deactivate the environment using deactivate whenever you'd like, but you'll need to reactive it if you use the project again.

Installing dependencies

Now you can install all of the dependencies required to properly get the project up and running.

pip3 install -r requirements.txt

How to use it

Start with your command line open and the cloned repository as your working directory. Then, simply run the add_border.py script as you would any other Python script, except with the extra -i argument: the filepath to the source image.

python3 add_border.py -i "path/to/image.png"

Some other optional arguments are also available, and can be listed using the help argument.

python3 add_border.py -h

If you'd rather use the code directly, you're also able to simply import the add_border function from the module.

from add_border import add_border
help(add_border)

Example usage

To add a border to test.png with an orange border and 5 pixels of padding with the progress bar disabled, and save the output as test-bordered.png:

python3 add_border.py -i "test.png" -o "test-bordered.png" -c "orange" -p 5 --disable-progress

To add a border to test.gif with a custom hex color #035851, 20 pixels of padding, and 80 milliseconds between each frame, and save with the auto-generated name test-out.gif:

python3 add_border.py -i "test.gif" -c "#035851" -p 20 -d 80

Contributors

image-frame's People

Contributors

jakebrehm avatar

Watchers

 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.