https://github.com/cberes/john-hancock
Build images from several customer signature serializations
https://github.com/cberes/john-hancock
library
Last synced: 6 months ago
JSON representation
Build images from several customer signature serializations
- Host: GitHub
- URL: https://github.com/cberes/john-hancock
- Owner: cberes
- License: mit
- Created: 2017-09-11T03:11:51.000Z (almost 9 years ago)
- Default Branch: main
- Last Pushed: 2024-03-03T00:26:51.000Z (over 2 years ago)
- Last Synced: 2024-04-15T04:32:21.189Z (about 2 years ago)
- Topics: library
- Language: Java
- Size: 104 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# john-hancock
Builds images from common customer signature serialization formats

[](https://coveralls.io/github/cberes/john-hancock?branch=main)
[](https://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.spinthechoice%22%20AND%20a%3A%22john-hancock%22)
## 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
```groovy
compile 'com.spinthechoice:john-hancock:1.0.1'
```
### Maven
```xml
com.spinthechoice
john-hancock
1.0.1
```
## Example usage
```java
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](src/main/java/net/seabears/signature/Converter.java) accepts a [Config](src/main/java/net/seabears/signature/Config.java) instance. This allows you to configure
1. background color
2. foreground color
3. padding
## More information
- [3-byte ASCII](https://social.msdn.microsoft.com/Forums/vstudio/en-US/1dc7421a-56dc-4698-ac33-9c79e25fde36/saving-series-of-point-data-in-c)
- [Worldpay/Vantiv points format](https://developer.vantiv.com/thread/1830)
## License
Copyright © 2017, 2019 Corey Beres
Distributed under the MIT license