Git Product home page Git Product logo

capthis's Introduction

CapThis

Build Status

CapThis allows you to give it an image, some text along with various other options and then it overlays that text onto the image, like a caption.

It runs with a HTTP interface, a server is started and image / text data is then sent to allow CapThis to process everything and output the final result.

This project is still in development and while it may work currently, there is still a lot of work to be done that will soon allow you to configure the way it works in a lot more detail.

Using an image of a sunset and a cartoon styled font CapThis generated this:

An example

Prerequisites

You will need:

  • Git
  • Go (versions 1.1 or 1.2)
  • Make
  • Imagick

Installing Imagick

OS X

Homebrew

$ brew install imagemagick

MacPorts

$ sudo port install ImageMagick
Ubuntu / Debian
$ sudo apt-get install libmagickwand-dev

Installing

$ git clone https://github.com/GroundSix/capthis.git
$ cd capthis
$ make
$ sudo make install

Running

You can start the server like so:

$ capthis

By default CapThis will run on port 8080. You can change this by specifying:

$ capthis 2020

Http API

At the moment CapThis by default runs on port 8080. Below are the post fields you must populate:

  • image_name - The full path to the original image you need to process
  • text - The text you are going to overlay the image with
  • font - The full path to a ttf font file of your choice
  • font_size - The font size (int) in pixels
  • fill_color - The fill colour of your text (e.g. 'black')
  • stroke_color - The stroke color of your text (e.g. 'black')
  • output - The full path of the output (e.g. 'my_image.png')

An example request:

Headers

  • URL: http://localhost:8080/
  • Accept: /
  • Accept-Encoding: gzip, deflate, compress
  • Content-Length: 179
  • Content-Type: application/x-www-form-urlencoded

Paramaters

  • fill_color: black
  • font: /path/to/my/font.ttf
  • font_size: 32
  • image_name: /path/to/my/image.png
  • output: /path/to/output.png
  • stroke_color: black
  • text: Hello, World!
image_name=%2Fpath%2Fto%2Fmy%2Fimage.png&text=Hello%2C+World%21&fill_color=black&font_size=32&font=%2Fpath%2Fto%2Fmy%2Ffont.ttf&output=%2Fpath%2Fto%2Foutput.png&stroke_color=black

Tests

$ make test

License

MIT

capthis's People

Stargazers

Peter Lu avatar Rogerio Marques avatar  avatar Andrew Nesbitt avatar  avatar Harry Lawrence avatar

Watchers

Harry Lawrence avatar Michael Peacock avatar 2bard avatar James Cloos avatar  avatar  avatar  avatar James Fenwick avatar  avatar

capthis's Issues

Server configuration file is needed.

There are a few things I'd like to do to the server, change the port, who has access to it etc...

There should be a config file. JSON would be an easy way to do this.

Validation / Error handling over Http

If fields have not been submitted we need valid error messages to be sent back as a response. Currently it will probably just sort of break. There is no output on success either.

Add some output to the web server

The sever doesn't have any form of output, not in the console or even the http writer. This needs adding, along with basic error handling.

Tests!

Write some tests man.

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.