Scripting token creation

Thoughts, Help, Feature Requests

Moderators: dorpond, trevor, Azhrei

Post Reply
Red
Kobold
Posts: 9
Joined: Tue May 27, 2014 4:13 am

Scripting token creation

Post by Red »

Hello everyone,

I'm currently managing a website for sharing an amateur role-playing game (that I won't post here because it's a french website, furthermore I wouldn't like to look like an advertiser ;) ), and as I have a HUGE collection of images that I would like to use as tokens in a new framework that I'm building with friends for MapTool, I would like to know if there are scripting capabilities for TokenTool.

I already managed to make system shortcuts for TokenTool and MapTool for Debian/Ubuntu, if anyone is interested I could make tutorials for launching these programs from a terminal :)

OK, let's go to the main question:

In Unix/Linux shell language, I would like to know if there is a way to give arguments to TokenTool so that it could create a token from an image. E.g.:

Code: Select all

tokentool --image=foo.png --output=bar.png
Thank you for giving me pointers :)

~Red

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: Scripting token creation

Post by wolph42 »

im definately not an expert in this area, but AFAIK: no. no arguments. You could dig around on this forum a bit for more info.

User avatar
RPTroll
TheBard
Posts: 3159
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Re: Scripting token creation

Post by RPTroll »

I don't know of any command line tools but you could always add that functionality via patch and submit it.

Also, the rptok files are compressed XML. You could also write a XML utility to for existing rptok files.

Lastly, ImageMagick is a command line utility for manipulating images
http://www.imagemagick.org/

Here are some of the capabilities
Here are just a few examples of what ImageMagick can do:
Format conversion: convert an image from one format to another (e.g. PNG to JPEG).
Transform: resize, rotate, crop, flip or trim an image.
Transparency: render portions of an image invisible.
Draw: add shapes or text to an image.
Decorate: add a border or frame to an image.
Special effects: blur, sharpen, threshold, or tint an image.
Animation: create a GIF animation sequence from a group of images.
Text & comments: insert descriptive or artistic text in an image.
Image identification: describe the format and attributes of an image.
Composite: overlap one image over another.
Hope that helps.
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

Red
Kobold
Posts: 9
Joined: Tue May 27, 2014 4:13 am

Re: Scripting token creation

Post by Red »

Yeah, so I finally ended up using ImageMagick to create token-like objects and the result is not so bad.
Here is the script I wrote and ran:

Code: Select all

#!/bin/bash
mkdir out
for f in *.png
do
 convert -geometry x256 $f out/$f
done
cd out
mkdir out
for f in *.png
do
 convert $f -scale 256x256 -background transparent -gravity center -extent 256x256 out/$f
done
cd out
mkdir out
for f in *.png
do
 convert -size 256x256 xc:transparent -fill $f -strokewidth 10 -stroke gray -draw "circle 128,128 128,5" +repage out/$f
done 

User avatar
RPTroll
TheBard
Posts: 3159
Joined: Tue Mar 21, 2006 7:26 pm
Location: Austin, Tx
Contact:

Re: Scripting token creation

Post by RPTroll »

Good deal. Thanks for sharing.
ImageImage ImageImageImageImage
Support RPTools by shopping
Image
Image

Post Reply

Return to “TokenTool”