Creating character sheets using IM
Creating character sheets using IM
Hi!
Is possible and if yes, how i could make a character sheet using a certain font?
I want to recreate the below image using other typeface.
Thanks in advance!
Is possible and if yes, how i could make a character sheet using a certain font?
I want to recreate the below image using other typeface.
Thanks in advance!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Creating character sheets using IM
What is your platform/OS and version of ImageMagick? Please always provide that when asking questions.
Re: Creating character sheets using IM
Sorry, forgot that.
Currently i use IM on my Raspberry pi (Raspbian headless/without DE) and i'm using the latest version available to raspbian via apt (ImageMagick 6.9.7-4 Q16 arm 20170114)
Currently i use IM on my Raspberry pi (Raspbian headless/without DE) and i'm using the latest version available to raspbian via apt (ImageMagick 6.9.7-4 Q16 arm 20170114)
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Creating character sheets using IM
One way would be to use label: with a monospaced font. Then write a script loop over each possible character and create an output for it. Then montage them together into a grid with borders if desired.
See
https://imagemagick.org/Usage/text/#label
https://imagemagick.org/Usage/montage/
See
https://imagemagick.org/Usage/text/#label
https://imagemagick.org/Usage/montage/
Re: Creating character sheets using IM
But what if the font isnt monospaced?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Creating character sheets using IM
Loop over each separate character image and pad it out to the maximum sized character or max width and max height from all the characters.
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: Creating character sheets using IM
I have a Windows script that creates a character display like what you describe. I modified it a bit and tested it with ImageMagick 6.8.9-9 on a bash shell.
The first part of it uses a couple "for" loops and "sed" to create a text file containing a list of all the characters.
Code: Select all
> chars.txt
for x in 2 3 4 5 6 7 8 9 A B C D E F ;
do for y in 0 1 2 3 4 5 6 7 8 9 A B C D E F ;
do echo X | sed "s/.*/label:\x${x}${y}/g" >> chars.txt ;
done ;
done
Code: Select all
label:
label:!
label:"
label:#
label:$
label:%
...
Code: Select all
imfont=Times-Roman
convert -font ${imfont} -pointsize 24 -size 36x36 -gravity center -background none \
label:"\ " @chars.txt +gravity -compose copy -bordercolor blue -shave 1 -border 1 \
+append +repage -crop 360x36 -append +repage charsheet.png
-
- Posts: 10
- Joined: 2019-07-02T18:53:00-07:00
- Authentication code: 1152
Re: Creating character sheets using IM
It's not exactly what you are asking, but often is easy to transform letter by letter and then join them, if needed. In many cases having them separately is more useful. Checkout this live example:https://cancerberosgx.github.io/demos/m ... xuJT4ifQ==
Re: Creating character sheets using IM
Thanks a lot! It was very close of what i need.GeeMack wrote: ↑2019-08-12T20:51:25-07:00I have a Windows script that creates a character display like what you describe. I modified it a bit and tested it with ImageMagick 6.8.9-9 on a bash shell.
The first part of it uses a couple "for" loops and "sed" to create a text file containing a list of all the characters.
The lines in that file look like this...Code: Select all
> chars.txt for x in 2 3 4 5 6 7 8 9 A B C D E F ; do for y in 0 1 2 3 4 5 6 7 8 9 A B C D E F ; do echo X | sed "s/.*/label:\x${x}${y}/g" >> chars.txt ; done ; done
The prefix "label:" on each line lets IM read that file as if it's a long list of individual labels. IM reads that file like this "@chars.txt" to get all the images to create the character sheet. Here is the IM command that works on my bash...Code: Select all
label: label:! label:" label:# label:$ label:% ...
You should be able to make the grid from any installed font by setting the variable "imfont" to your choice.Code: Select all
imfont=Times-Roman convert -font ${imfont} -pointsize 24 -size 36x36 -gravity center -background none \ label:"\ " @chars.txt +gravity -compose copy -bordercolor blue -shave 1 -border 1 \ +append +repage -crop 360x36 -append +repage charsheet.png
But the dimensions of each box (counting the 1px border of top and left) are of 20x26px, and each character are graviting West, but with the bottom offset half of the top (eg. 4px to the bottom of the box, and 8px of the top).
I tried to change the values to suit but i got a disarranged charset.
- GeeMack
- Posts: 718
- Joined: 2015-12-01T22:09:46-07:00
- Authentication code: 1151
- Location: Central Illinois, USA
Re: Creating character sheets using IM
You can easily change the pointsize and the dimensions of the labels, and set the gravity to west or southwest. Each font has somewhat different dimensions from another, even at a given pointsize, so you might have to adjust for that. And with a little modification to how the blue lines are applied, they can be all just one pixel wide. Here's a command that might get you closer...mrvico wrote: ↑2019-08-14T12:25:09-07:00But the dimensions of each box (counting the 1px border of top and left) are of 20x26px, and each character are graviting West, but with the bottom offset half of the top (eg. 4px to the bottom of the box, and 8px of the top).
I tried to change the values to suit but i got a disarranged charset.
Code: Select all
imfont=Helvetica
convert -font ${imfont} -background none -gravity southwest \
-pointsize 16 -size 19x25 label:"\ " @chars.txt +gravity -delete 220--1 \
-background \#1600f3 -splice 1x1 +append +repage -crop 200x26 -append +repage \
-gravity southeast -splice 1x1 -background \#626b62 -flatten charsheet.png
Re: Creating character sheets using IM
Yeah, i think the lack of the red pixels made the screen on the steering wheel render garbled like this:
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Creating character sheets using IM
@mrvico
What does your post have to do with Creating character sheets?
Perhaps you posted to the wrong topic? If so, please delete your post and repost to the correct location. Otherwise, you post may be removed as off-topic.
What does your post have to do with Creating character sheets?
Perhaps you posted to the wrong topic? If so, please delete your post and repost to the correct location. Otherwise, you post may be removed as off-topic.
Re: Creating character sheets using IM
Seriously... I was showing GeeMack the character sheet wasnt being rendered properly ingame, all characters are being squeezed in one place, due possibly to the lack of the red point on top of the sheet image.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Creating character sheets using IM
OK. But you could have explained the connection better.
Re: Creating character sheets using IM
Okay, I'm deeply sorry. I thought i said in OP about for what i needed this sheet, but not. I said it only on my stackoverflow question i made too.