Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Snazzyham committed Feb 27, 2018
0 parents commit 0f04887
Show file tree
Hide file tree
Showing 10 changed files with 684 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#Credit Me
Easily add accreditation to a bunch of images

## About the project
Initially built for internal use at Goodstuph, **credit-me** lets you batch add names to photos. Mostly useful if you're using photos from instagram and want to embed the picture takers instagram handle on to the image. Rather than individually opening up each image with an image manipulation program and adding in the name, a simple for-loop and [jimp](https://github.com/oliver-moran/jimp) can get the job done way quicker.

# Usage

## Using the provided binary

Head to the releases page and download the right binary for your OS, which has been packaged using ZEIT's [pkg](https://github.com/zeit/pkg).

Put the binary in the same folder as your images.

Create a text file called `names.txt` (or whatever you want to name it) in the same directory, put the name of the file first, followed by 1 space, and the text (name) you want to embed. Each line identifies 1 image.

For example

```
# names.txt
image-1.jpg @selenagomez
image-2.jpg @emrata
```

then, navigate to the directory in your terminal and run the binary.

### On Mac / Linux
```
./credit-me-macos names.txt
# or
./credit-me-linux names.txt
```

_note: if you get a permissions error, you might have to run `chmod +x credit-me-*` to give it executable permissions._

### On Windows

```
credit.me.windows.exe names.txt
```

# Extending / Modifying

Clone / Fork this repo and edit the code in `index.js`. For a list of what all you can change (fonts, position of text, font color, etc.), check out the documentation on [Jimp's repo.](https://github.com/oliver-moran/jimp)
Binary file added credit-me-linux
Binary file not shown.
Binary file added credit-me-macos
Binary file not shown.
Binary file added credit-me-windows.exe
Binary file not shown.
92 changes: 92 additions & 0 deletions font/font.fnt
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<font>
<info face="font" size="26" bold="0" italic="0" charset="" unicode="" stretchH="100" smooth="1" aa="1" padding="2,2,2,2" spacing="0,0" outline="0"/>
<common lineHeight="32" base="26" scaleW="141" scaleH="512" pages="1" packed="0"/>
<pages>
<page id="0" file="font.png"/>
</pages>
<chars count="80">
<char id="97" x="2" y="2" width="14" height="15" xoffset="1" yoffset="11" xadvance="14" page="0" chnl="15"/>
<char id="98" x="2" y="19" width="16" height="22" xoffset="0" yoffset="4" xadvance="17" page="0" chnl="15"/>
<char id="99" x="18" y="2" width="12" height="15" xoffset="1" yoffset="11" xadvance="14" page="0" chnl="15"/>
<char id="100" x="2" y="43" width="16" height="22" xoffset="1" yoffset="4" xadvance="18" page="0" chnl="15"/>
<char id="101" x="2" y="67" width="13" height="15" xoffset="1" yoffset="11" xadvance="15" page="0" chnl="15"/>
<char id="102" x="2" y="84" width="13" height="22" xoffset="1" yoffset="4" xadvance="11" page="0" chnl="15"/>
<char id="103" x="2" y="108" width="15" height="21" xoffset="1" yoffset="11" xadvance="16" page="0" chnl="15"/>
<char id="104" x="17" y="67" width="17" height="22" xoffset="1" yoffset="4" xadvance="18" page="0" chnl="15"/>
<char id="105" x="20" y="19" width="8" height="21" xoffset="1" yoffset="4" xadvance="9" page="0" chnl="15"/>
<char id="106" x="30" y="19" width="10" height="28" xoffset="-4" yoffset="4" xadvance="8" page="0" chnl="15"/>
<char id="107" x="2" y="131" width="16" height="22" xoffset="0" yoffset="4" xadvance="16" page="0" chnl="15"/>
<char id="108" x="20" y="42" width="8" height="22" xoffset="1" yoffset="4" xadvance="8" page="0" chnl="15"/>
<char id="109" x="32" y="2" width="27" height="14" xoffset="1" yoffset="11" xadvance="28" page="0" chnl="15"/>
<char id="110" x="17" y="91" width="17" height="14" xoffset="1" yoffset="11" xadvance="18" page="0" chnl="15"/>
<char id="111" x="30" y="49" width="15" height="15" xoffset="1" yoffset="11" xadvance="17" page="0" chnl="15"/>
<char id="112" x="19" y="107" width="16" height="21" xoffset="0" yoffset="11" xadvance="18" page="0" chnl="15"/>
<char id="113" x="42" y="18" width="16" height="21" xoffset="1" yoffset="11" xadvance="17" page="0" chnl="15"/>
<char id="114" x="36" y="66" width="12" height="14" xoffset="1" yoffset="11" xadvance="12" page="0" chnl="15"/>
<char id="115" x="47" y="41" width="9" height="15" xoffset="2" yoffset="11" xadvance="12" page="0" chnl="15"/>
<char id="116" x="36" y="82" width="9" height="17" xoffset="1" yoffset="9" xadvance="10" page="0" chnl="15"/>
<char id="117" x="2" y="155" width="17" height="14" xoffset="1" yoffset="11" xadvance="17" page="0" chnl="15"/>
<char id="118" x="20" y="130" width="16" height="14" xoffset="0" yoffset="11" xadvance="16" page="0" chnl="15"/>
<char id="119" x="37" y="101" width="22" height="14" xoffset="0" yoffset="11" xadvance="22" page="0" chnl="15"/>
<char id="120" x="47" y="82" width="16" height="14" xoffset="0" yoffset="11" xadvance="16" page="0" chnl="15"/>
<char id="121" x="50" y="58" width="17" height="21" xoffset="0" yoffset="11" xadvance="17" page="0" chnl="15"/>
<char id="122" x="58" y="41" width="13" height="14" xoffset="0" yoffset="11" xadvance="14" page="0" chnl="15"/>
<char id="65" x="60" y="18" width="21" height="20" xoffset="0" yoffset="5" xadvance="20" page="0" chnl="15"/>
<char id="66" x="2" y="171" width="18" height="20" xoffset="1" yoffset="5" xadvance="20" page="0" chnl="15"/>
<char id="67" x="21" y="146" width="18" height="21" xoffset="2" yoffset="5" xadvance="21" page="0" chnl="15"/>
<char id="68" x="38" y="117" width="21" height="20" xoffset="1" yoffset="5" xadvance="23" page="0" chnl="15"/>
<char id="69" x="2" y="193" width="17" height="20" xoffset="1" yoffset="5" xadvance="19" page="0" chnl="15"/>
<char id="70" x="2" y="215" width="16" height="20" xoffset="1" yoffset="5" xadvance="17" page="0" chnl="15"/>
<char id="71" x="2" y="237" width="21" height="21" xoffset="2" yoffset="5" xadvance="23" page="0" chnl="15"/>
<char id="72" x="20" y="215" width="22" height="20" xoffset="1" yoffset="5" xadvance="24" page="0" chnl="15"/>
<char id="73" x="21" y="193" width="9" height="20" xoffset="1" yoffset="5" xadvance="11" page="0" chnl="15"/>
<char id="74" x="32" y="169" width="12" height="27" xoffset="-3" yoffset="5" xadvance="10" page="0" chnl="15"/>
<char id="75" x="41" y="139" width="20" height="20" xoffset="1" yoffset="5" xadvance="20" page="0" chnl="15"/>
<char id="76" x="61" y="98" width="18" height="20" xoffset="1" yoffset="5" xadvance="19" page="0" chnl="15"/>
<char id="77" x="69" y="57" width="26" height="21" xoffset="1" yoffset="5" xadvance="28" page="0" chnl="15"/>
<char id="78" x="83" y="2" width="22" height="21" xoffset="1" yoffset="5" xadvance="23" page="0" chnl="15"/>
<char id="79" x="83" y="25" width="22" height="21" xoffset="1" yoffset="5" xadvance="25" page="0" chnl="15"/>
<char id="80" x="2" y="260" width="16" height="20" xoffset="1" yoffset="5" xadvance="18" page="0" chnl="15"/>
<char id="81" x="2" y="282" width="23" height="27" xoffset="2" yoffset="5" xadvance="25" page="0" chnl="15"/>
<char id="82" x="20" y="260" width="20" height="20" xoffset="1" yoffset="5" xadvance="20" page="0" chnl="15"/>
<char id="83" x="25" y="237" width="14" height="21" xoffset="2" yoffset="5" xadvance="17" page="0" chnl="15"/>
<char id="84" x="41" y="237" width="20" height="20" xoffset="1" yoffset="5" xadvance="21" page="0" chnl="15"/>
<char id="85" x="44" y="198" width="21" height="21" xoffset="1" yoffset="5" xadvance="22" page="0" chnl="15"/>
<char id="86" x="46" y="161" width="21" height="21" xoffset="0" yoffset="5" xadvance="20" page="0" chnl="15"/>
<char id="87" x="63" y="120" width="31" height="21" xoffset="0" yoffset="5" xadvance="31" page="0" chnl="15"/>
<char id="88" x="81" y="80" width="22" height="20" xoffset="0" yoffset="5" xadvance="21" page="0" chnl="15"/>
<char id="89" x="97" y="48" width="20" height="20" xoffset="0" yoffset="5" xadvance="19" page="0" chnl="15"/>
<char id="90" x="107" y="2" width="19" height="20" xoffset="0" yoffset="5" xadvance="20" page="0" chnl="15"/>
<char id="33" x="22" y="169" width="4" height="21" xoffset="2" yoffset="5" xadvance="8" page="0" chnl="15"/>
<char id="8470" x="2" y="311" width="13" height="32" xoffset="3" yoffset="0" xadvance="20" page="0" chnl="15"/>
<char id="59" x="107" y="24" width="4" height="17" xoffset="2" yoffset="14" xadvance="8" page="0" chnl="15"/>
<char id="37" x="113" y="24" width="16" height="21" xoffset="1" yoffset="5" xadvance="17" page="0" chnl="15"/>
<char id="58" x="46" y="184" width="4" height="12" xoffset="2" yoffset="14" xadvance="7" page="0" chnl="15"/>
<char id="63" x="2" y="345" width="7" height="21" xoffset="2" yoffset="5" xadvance="10" page="0" chnl="15"/>
<char id="42" x="32" y="198" width="10" height="12" xoffset="2" yoffset="5" xadvance="13" page="0" chnl="15"/>
<char id="40" x="2" y="368" width="7" height="27" xoffset="1" yoffset="4" xadvance="9" page="0" chnl="15"/>
<char id="41" x="2" y="397" width="7" height="27" xoffset="0" yoffset="4" xadvance="9" page="0" chnl="15"/>
<char id="95" x="73" y="48" width="15" height="2" xoffset="2" yoffset="27" xadvance="19" page="0" chnl="15"/>
<char id="43" x="65" y="81" width="13" height="13" xoffset="1" yoffset="10" xadvance="14" page="0" chnl="15"/>
<char id="45" x="73" y="40" width="8" height="3" xoffset="2" yoffset="17" xadvance="12" page="0" chnl="15"/>
<char id="61" x="97" y="70" width="12" height="6" xoffset="2" yoffset="13" xadvance="16" page="0" chnl="15"/>
<char id="46" x="90" y="48" width="4" height="4" xoffset="2" yoffset="22" xadvance="7" page="0" chnl="15"/>
<char id="44" x="52" y="184" width="4" height="8" xoffset="1" yoffset="22" xadvance="7" page="0" chnl="15"/>
<char id="47" x="128" y="2" width="11" height="20" xoffset="1" yoffset="5" xadvance="12" page="0" chnl="15"/>
<char id="124" x="2" y="426" width="2" height="28" xoffset="3" yoffset="4" xadvance="8" page="0" chnl="15"/>
<char id="34" x="58" y="184" width="7" height="7" xoffset="2" yoffset="4" xadvance="10" page="0" chnl="15"/>
<char id="39" x="61" y="2" width="3" height="7" xoffset="2" yoffset="4" xadvance="6" page="0" chnl="15"/>
<char id="64" x="2" y="456" width="24" height="24" xoffset="1" yoffset="5" xadvance="27" page="0" chnl="15"/>
<char id="35" x="6" y="426" width="16" height="20" xoffset="1" yoffset="5" xadvance="17" page="0" chnl="15"/>
<char id="36" x="2" y="482" width="14" height="28" xoffset="1" yoffset="2" xadvance="16" page="0" chnl="15"/>
<char id="94" x="61" y="11" width="9" height="5" xoffset="2" yoffset="15" xadvance="12" page="0" chnl="15"/>
<char id="38" x="18" y="482" width="21" height="21" xoffset="1" yoffset="5" xadvance="23" page="0" chnl="15"/>
<char id="123" x="11" y="345" width="7" height="26" xoffset="1" yoffset="4" xadvance="9" page="0" chnl="15"/>
<char id="125" x="17" y="311" width="7" height="26" xoffset="1" yoffset="4" xadvance="9" page="0" chnl="15"/>
<char id="91" x="11" y="373" width="7" height="26" xoffset="3" yoffset="4" xadvance="10" page="0" chnl="15"/>
<char id="93" x="20" y="339" width="7" height="26" xoffset="1" yoffset="4" xadvance="10" page="0" chnl="15"/>
<char id="32" x="0" y="0" width="0" height="0" xoffset="1" yoffset="4" xadvance="7" page="0" chnl="15"/>
</chars>
<kernings count="0">
</kernings>
</font>
Binary file added font/font.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
var Jimp = require("jimp");

var lineReader = require("readline").createInterface({
input: require("fs").createReadStream(process.argv[2])
});

lineReader.on("line", function(line) {
let arr = line.split(" ");
console.log("image name: " + arr[0]);
console.log("user name: " + arr[1]);

var loadedImage;
let imageHeight = 0;

Jimp.read(arr[0])
.then(function(image) {
loadedImage = image;
imageHeight = loadedImage.bitmap.height;
return Jimp.loadFont("font/font.fnt");
})
.then(function(font) {
console.log(imageHeight);
loadedImage.print(font, 25, imageHeight - 50, arr[1]).write(arr[0]);
})
.catch(function(err) {
console.error(err);
});
});
15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "test-jimp",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"jimp": "^0.2.28"
}
}
Loading

0 comments on commit 0f04887

Please sign in to comment.