john-hancock

Build images from common customer-signature data serialization formats.

License

License

Categories

Categories

Net
GroupId

GroupId

net.seabears
ArtifactId

ArtifactId

john-hancock
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

john-hancock
Build images from common customer-signature data serialization formats.
Project URL

Project URL

https://github.com/cberes/john-hancock
Source Code Management

Source Code Management

https://github.com/cberes/john-hancock.git

Download john-hancock

How to add to project

<!-- https://jarcasting.com/artifacts/net.seabears/john-hancock/ -->
<dependency>
    <groupId>net.seabears</groupId>
    <artifactId>john-hancock</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/net.seabears/john-hancock/
implementation 'net.seabears:john-hancock:1.0.1'
// https://jarcasting.com/artifacts/net.seabears/john-hancock/
implementation ("net.seabears:john-hancock:1.0.1")
'net.seabears:john-hancock:jar:1.0.1'
<dependency org="net.seabears" name="john-hancock" rev="1.0.1">
  <artifact name="john-hancock" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.seabears', module='john-hancock', version='1.0.1')
)
libraryDependencies += "net.seabears" % "john-hancock" % "1.0.1"
[net.seabears/john-hancock "1.0.1"]

Dependencies

test (3)

Group / Artifact Type Version
junit : junit jar 4.12
commons-codec : commons-codec jar 1.10
commons-io : commons-io jar 2.5

Project Modules

There are no modules declared in this project.

john-hancock

Builds images from common customer signature serialization formats

Build Status Coverage Status Maven Central

Supported formats

Worldpay (Vantiv)

  1. Points, big-endian
  2. Points, little-endian
  3. 3-byte ASCII

Cayan

  1. Vector text

Requirements

Requires JDK 1.7 or greater

Installation

john-hancock is available as a Maven artifact from Maven Central.

Gradle

compile 'com.spinthechoice:john-hancock:1.0.1'

Maven

<dependency>
  <groupId>com.spinthechoice</groupId>
  <artifactId>john-hancock</artifactId>
  <version>1.0.1</version>
</dependency>

Example usage

import java.awt.image.RenderedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.spinthechoice.signature.Converter;
import com.spinthechoice.signature.Format;

public class Main {
    static class Signature {
        public byte[] data;
    }

    public static void main(final String[] args) throws IOException {
        final String json = "{\"data\":\"/////wAAAAAAAAAUAAoAFP////8AAAAAAAoAAP////8AAAAKAAcACv//" +
                "//8AFAAAABQAFP////8AFAAAAB4AAAAeAAoAFAAK/////wAyAAAAKAAAACgACgAyAAoAMgAUACgAFP//" +
                "//8AUAAAAFAAFP////8AWgAAAFoAFP////8AUAACAFoAEv////8AZAAAAGQAFABuABQAbgAA/////wB4" +
                "AAAAeAAUAIIAFP////8AjAAAAIwAFACWABT/////\"}";
        final Signature signature = new ObjectMapper().readValue(json, Signature.class);
        final Converter converter = new Converter();
        final RenderedImage image = converter.convert(signature.data, Format.POINTS_BIG_ENDIAN);
        ImageIO.write(image, "png", new File("example.png"));
    }
}

Configuration

Converter accepts a Config instance. This allows you to configure

  1. background color
  2. foreground color
  3. padding

More information

License

Copyright © 2017, 2019 Corey Beres

Distributed under the MIT license

Versions

Version
1.0.1
1.0.0