Jump to content

ChrisFhey

Tierparkzone

Kotone

puxlavoix

Chiakisenpai

BeyondTime

Deyja

Monty

MADh Vinyl

Testament

Yami Usagi

Archeotype

Kizuna & Chitose

Anouc

Anna-neko

archangeli

Juu Yuki

Baldylox

Salica

Tierparkzone

Forum Signature Generator

Recommended Posts

Tierparkzone

Not really sure where to put this, but technically coding is kinda like a handicraft, so I put it here for now. Feel free to move it somewhere else, if you think it fits better there.

So, @Poofiemus suggested some kind of automatic signature generator and I thought that's actually a pretty clever idea.

And while I am by no means computer savvy enough to know how to implement this into the forum software, I managed to conjure up an ImageMagick script that folks can run on their own Computers to generate a signature from a set of images.

So feel free to try it out yourself. If you read up a bit about ImageMagick you can also try and change the style yourself, for more personalization.

 

Requirements:

Make sure ImageMagick is installed on your machine.

If you run Linux or Mac, you need BASH (Bourne Again Shell) - which should be the standard terminal in most cases anyway. (Any infos specifically for the BASH script will be in red.)

If you run Windows, you need PowerShell - this should come default with most installations or can be added easily. (Any infos speciffically for the PowerShell script will be in blue.)

Disclaimer (just to be safe):

The scripts provided below are free software and come without any warranty.

You are free to distribute and/or modify them however you like.

How to use:

  1. Create an empty folder (name doesn't matter).
  2. Copy the images you want to include in your signature (and only them) into the folder. For now, only .jpg files will work. This script should not alter your original images - but to be safe, keep a backup copy of your images in a different folder in case something goes wrong.
  3. Create an empty text file in the folder.
  4. Copy one of the scripts below (depending on your operating system) into the text file and save it. Make sure you didn't miss anything.
  5. You may change the style of your signature by swapping in one of the Alphamap Options below.
  6. Linux&Mac: Rename the text file to "siggen.sh". - Windows: Rename the text file to "siggen.ps1" (the extension ends in the number one, not in the letter L).
  7. Linux&Mac: Open your terminal from within the folder and run the script with "bash siggen.sh" (if you have issues try "/bin/bash siggen.sh"). - Windows: Launch PowerShell from within the folder and  run the script with "siggen.ps1".
  8. If everything worked, the shell should output "Done!" and the completed signature image should appear as a file called "sig.png".

After you have done this once, you only need to repeat steps 2 and 7 to update / create a new signature.

If you have issues with the script, feel free to use this thread to ask questions.

The script is set to output a signature image at maximum 550 by 200 pixels, which is the size limit for our forum. The initial images are cropped to squares and are arranged so they have the biggest possible size within the signature, given the total amount of images provided.

I have not set a limit for how many images you can use, but with more than 16 it gets awfully small and more than 27 really doesn't look good anymore.

 

Script (BASH):

If you have access to a bash console (Linux or Mac), use this.

# This is a BASH/ImageMagick script to generate a forum signature from a set of images.
# Intended for the users of dolldreaming.com.
# v2.1 by Tierparkzone

rm sig.png

## ALPHAMAP OPTIONS
# you may replace the following line with other alphamap options
convert -size 200x200 xc:black -fill white -draw "circle 100,100 100,9" -blur 9x4 alphamap.png


## IMPORT NAMES (ADVANCED)
# code for importing names from a .txt file goes here


## APPLY APLHAMAP
for i in *.jpg
do
convert "$i" -auto-orient -filter Lanczos -resize 200x200^ -gravity North \
-crop 200x200+0+0 +repage "tmp_$i.png"
convert "tmp_$i.png" alphamap.png -alpha Off -compose CopyOpacity -composite "tmp_$i.png"

## APPLY NAMES (ADVANCED)
# code for generating name tags from imported names goes from here


# ...until here
done

## ARRANGE IMAGES
## depending on the number of images, they will be arranged across multiple lines
files=(tmp_*.png)
if (( "${#files[@]}" > 16 )); then
montage "tmp_*.png" -tile x3 -geometry 200x200+0+0 -background none sig.png
elif (( "${#files[@]}" > 5 )); then
montage "tmp_*.png" -tile x2 -geometry 200x200+0+0 -background none sig.png
else
montage "tmp_*.png" -tile x1 -geometry 200x200+0+0 -background none sig.png
fi

## FIT TO FORUM SIZE
convert sig.png -filter Lanczos -resize 550x200 sig.png

## CLEANUP
rm tmp_*.png
rm alphamap.png

echo "Done!"

 

Script (PowerShell):

If you have acess to PowerShell (Windows), use this.

# This is a PowerShell/ImageMagick script to generate a forum signature from a set of images.
# Intended for the users of dolldreaming.com.
# v2.1 by Tierparkzone

Remove-Item 'sig.png'

## ALPHAMAP OPTIONS
# you may replace the following line with other alphamap options
convert -size 200x200 xc:black -fill white -draw "circle 100,100 100,9" -blur 9x4 alphamap.png


## IMPORT NAMES (ADVANCED)
# code for importing names from a .txt file goes here


## APPLY APLHAMAP
$files = dir -File -Filter *.jpg
$files = $files.name
foreach($i in $files){
$j="tmp_"+$i+".png"
convert $i -auto-orient -filter Lanczos -resize 200x200^ -gravity North `
-crop 200x200+0+0 +repage $j
convert $j alphamap.png -alpha Off -compose CopyOpacity -composite $j

## APPLY NAMES (ADVANCED)
# code for generating name tags from imported names goes from here


# ...until here
}

## ARRANGE IMAGES
## depending on the number of images, they will be arranged across multiple lines
$filecount= @(dir -File -Filter tmp_*.png).Count
if ($filecount -gt 16){
montage tmp_*.png -tile x3 -geometry 200x200+0+0 -background none sig.png
}elseif ($filecount -gt 5 ){
montage tmp_*.png -tile x2 -geometry 200x200+0+0 -background none sig.png
}else{
montage tmp_*.png -tile x1 -geometry 200x200+0+0 -background none sig.png
}

## FIT TO FORUM SIZE
convert sig.png -filter Lanczos -resize 550x200 sig.png

## CLEANUP
Remove-Item 'tmp_*.png'
Remove-Item 'alphamap.png'

write-host("Done!")

 

Script (barebones) :

Pure ImageMagick script - This is not really needed anymore.

Spoiler

 

This one will work everywhere (any shell), provided you have ImageMagick installed - but it's not as elegant. For certain amounts of images it will not necessarily give you an arrangement that uses the 550x200 space of the signature image optimally. It will also not clean up any temporary images it has created (you will notice alphamap.png, spread.png and several tmp...png after running it). You can delete them yourself (otherwise they will just get overwritten once you run the script again).

You are still able to use the other alphamap options provided below - just replace the first line with one of the other versions.


convert -size 200x200 xc:black -fill white -draw "circle 100,100 100,9" -blur 9x4 alphamap.png
convert -size 3600x200 tile:alphamap.png alphamap.png
convert *jpg -auto-orient -filter Lanczos -resize 200x200^ -gravity North -crop 200x200+0+0 +repage +append spread.png
convert spread.png alphamap.png -alpha Off -compose CopyOpacity -composite spread.png
convert spread.png -crop 200x200 +repage +adjoin tmp_sig.png
montage tmp_*.png -geometry 200x200+0+0 -background none sig.png
convert sig.png -filter Lanczos -resize 550x200 sig.png

 

 

Examples / Alphamap Options:

I tried it out with the profile fotos of my girls and this is what you can expect. Alphamap options are identical for all script versions.

Default alphamap will give you this style:

softcircle.png.ab97cddecfa70ea64bc9d208ba667cd9.png

 

If you don't want the soft edges use this instead:

convert -size 200x200 xc:black -fill white -draw "circle 100,100 100,2" alphamap.png

hardcircle.png.305ec39f4c14e418fb5649cc8c826b45.png

 

Of course squares are also possible:

convert -size 200x200 xc:black -fill white -draw "rectangle 9,9 191,191" -blur 9x4 alphamap.png

softsquare.png.e12563f2e63cdf7dde789b359a74042d.png

 

And if your motto is "Simple is best!", we got you covered as well:

convert -size 200x200 xc:white alphamap.png

hardsquare.png.93f6527a31a02c9ef8d7ece5a92a6024.png

 

Advanced Options:

Of course, you can customize your signature further, by modifying / adding commands. Feel free to play around youself!

I plan to post some additional customization options in this thread as well, but these are more involved so I won't put them up in the opening post. Here are the ones so far:

 

Edited by Tierparkzone
  • Like 3
  • Thanks 2

Share this post


Link to post
Share on other sites
Poofiemus

This is awesome! When I made my comment I wasn't expecting anything like a forum member taking it into their own hands!

Personally I only have access to Windows. . .  wondering if there's somw kind of emulator to use as a workaround, now!


Home: Agatha Heterodyne (DDDy with Option Head 03), Nanoha Takamachi, Akemi Homura (Azone), Hatsune Miku, Abby Normal (Out of Base M02), Fate T. Harlaown, Yuuri Katsuki (DDB Kirito), Viktor Nikiforov (Smart Doll Eiji 2.0) Working on: Asphodel (MDD modded 01) and Baxter (MDD modded 01)

Share this post


Link to post
Share on other sites
Tierparkzone
On 11/4/2020 at 10:18 PM, Poofiemus said:

Personally I only have access to Windows. . . 

Okay, I cooked up a "barebones" version that uses only ImageMagick commands and thus doesn't require bash. You should be able to use it on Windows as well. I updated the main post accordingly.

  • Like 1

Share this post


Link to post
Share on other sites
Poofiemus
2 hours ago, Tierparkzone said:

Okay, I cooked up a "barebones" version that uses only ImageMagick commands and thus doesn't require bash. You should be able to use it on Windows as well. I updated the main post accordingly.

Omg thank you so much, I'll try to take it for a spin this weekend! Then once I get a feel for it I should probably do a new photoshoot so everyone's pics are consistent lol


Home: Agatha Heterodyne (DDDy with Option Head 03), Nanoha Takamachi, Akemi Homura (Azone), Hatsune Miku, Abby Normal (Out of Base M02), Fate T. Harlaown, Yuuri Katsuki (DDB Kirito), Viktor Nikiforov (Smart Doll Eiji 2.0) Working on: Asphodel (MDD modded 01) and Baxter (MDD modded 01)

Share this post


Link to post
Share on other sites
Tierparkzone

Turns out Microsoft's PowerShell is available for Mac and several Linux distributions as well. As this allows me to test the (Windows compatible) script, we now have both a Linux&Mac (BASH) and a Windows (PowerShell) version of the signature generator available (see updated opening post).

The PowerShell script works not just on Windows, but wherever you can install PowerShell. However, the bash version should still be simpler for Linux and Mac users, as their OS usually has BASH preinstalled.

Share this post


Link to post
Share on other sites
Tierparkzone
Posted (edited)

Advanced Options: Ordering Images and Adding Text Labels

Okay, lets try out a few things you can do with the Signature generator. However, make sure the basic code from the opening post is producing a proper signature before you try the following stuff.

 

Ordering Images:

When running the script, the observant user may have realized that images in the signature are ordered by the filenames of the initial images. - That is, the "true" alphanumeric order (the order any OS actually sorts files)

01.jpg
1.jpg
11.jpg
2.jpg
A.jpg
...

and not the "natural" order (the order that is displayed by most file explorers)

1.jpg
01.jpg
2.jpg
11.jpg
A.jpg
...

This is just the way that scrips usually operate.

So if you want to have the images of your sig in a particular order, it's easiest by renaming the initial images. I recommend something like A.jpg, B.jpg, ... because if you don't use numbers, you don't have to worry about the differences between "true" and "natural" order.

 

Adding Doll Names as Text Labels:

Likely you want to add the names of your dolls to their respective picture in the signature. This can easily be done in a few steps.

Basic Text Labels

sigBasicstyle.png.3914e497b73d44b8b3941b7f9e2f4ca4.png

 

1) First you need to create a text file "names.txt" that provides the names of your dolls. Enter the names in the same order as you have sorted the initial images (see above) and put each name on a new line. The content of the "names.txt" file used for the example above is for instance

Kizuna
Saki
Ellie
Kyrie

Put "names.txt" into the same folder where you have your ("siggen.sh"/"siggen.ps1") script.

2) Next we need the script to load the information from "names.txt". Open your script ("siggen.sh"/"siggen.ps1") with a text editor and in the block "IMPORT NAMES" add the following lines

BASH (Linux/Mac):

IFS=$'\n' read -d '' -r -a lines < names.txt
n=0

PowerShell (Windows):

$lines = Get-Content names.txt
$n=0

3) Now we have to provide a font (the style the text will appear in). You can either copy any font file you from your OS' "fonts" folder or download one of the many fonts you can find on the internet. Put the font file (usually a ".ttf" file) into the same folder as your script. In the example above I used the font "OldNewspaperTypes.ttf"

4) Finally we need to command ImageMagick to add the imported names as labels. For this, again open your script and add the following to the block "APPLY NAMES"

BASH (Linux/Mac):

convert "tmp_$i.png" -background none -fill black -font "OldNewspaperTypes.ttf" -pointsize 34 \
label:"${lines[$n]}" -gravity South -composite "tmp_$i.png"
n=$((n+1))

PowerShell (Windows):

$line=$lines[$n]
convert $j -background none -fill black -font "OldNewspaperTypes.ttf" -pointsize 34 `
label:$line -gravity South -composite $j
$n+=1

Note that this bit of code contains the name of the font file (in our case "OldNewspaperTypes.ttf"). So change the bit inside the quotation marks to the name of the font file that you are using.

Further note the -fill option is set to black. By replacing the word black with any of these color names, you can change the color of the text accordingly. Of course you can also use hex-codes like "#ff6065" (including quotation marks) as the color name.

The number following -pointsize defines the text size so feel free to change that as well. (Make sure you don't accidentally delete the \ or ` characters in the process.)

And that's it. Run the script as usual, and you should get a result similar to the example above.

Text with Outlines

sigBasicOutline.png.b00bacc52f0798c7101e65602a9964ab.png

Depending on the initial images, text of a solid color may be difficult to read. - Not to worry, as adding an outline to your text is very simple. Instead of the the code provided in step 4) above, put the following into the block "IMPORT NAMES" of the script

BASH (Linux/Mac):

convert "tmp_$i.png" -background none -fill SteelBlue1 -stroke black -strokewidth 1 \
-font "OldNewspaperTypes.ttf" -pointsize 34 label:"${lines[$n]}" -gravity South -composite "tmp_$i.png"
n=$((n+1))

PowerShell (Windows):

$line=$lines[$n]
convert $j -background none -fill SteelBlue1 -stroke black -strokewidth 1 `
-font "OldNewspaperTypes.ttf" -pointsize 34 label:$line -gravity South -composite $j
$n+=1

Note that this is basically the same as before, but amended with the -stroke and -strokewidth options. -stroke takes the same color names as -fill and defines the outline color, whereas the value set for -strokewidth defines the thickness of the outline (using decimals like 0.5, 1.2, etc. is possible).

Japanese Characters

sigBasicJP.png.e9906673985fb4a0c30f87c719bcc72c.png

If you want the names of your dolls to be displayed in Japanese (or any other non roman characters), that is totally possible. Enter the names as you like inside "names.txt". In the example here it's

きずな
咲
エリー
霧枝

Now, make sure the .txt file is saved in UTF-8 format (Unicode). This guarantees that the characters don't get garbled by the script.

Finally, you need to use a font file that supports Japanese characters (or any oher characters you want to use). So "OldNewspaperTypes.ttf" would not be usable this time. In the example I use a Japanese compatible font that goes by the handy name of "851CHIKARA-DZUYOKU_kanaA_004.ttf".

Most people probably have fonts with "Gothic" or "Mincho" in their name installed - these should have complete Japanese support, but they are not very interesting. If you look for something more playful, this listing of Japanese fonts may be worth a look (I found the font for the example on this site as well).

The example above uses the color name coral for the filling and black for the outline with a stroke width of 0.5 and a text size of 44.

Getting Extravagant

 

sigExtravagant.png.da60194cfa7f4dddda36c37dbde61d32.png

The settings shown above should already provide you with a lot of room to play around, but if you want more you can create multiple instances of the same label, shift them (-geometry option), blur them (-blur option) and stack them on top of each other to crate stuff like shadows, more complex outlines or a glow effect. This is a tad bit more complicated, but I provide you with the code I use for my sig as a starting point. It uses three layers: black for the shadow, white for a slight glow and "#ff6065" (seems to be closest to the color of our forum logo) for the main text. Use this code inside the "APPLY NAMES" block

BASH (Linux/Mac):

convert -size 200x200 -gravity center -background none -fill black -font "erasbd.ttf" -pointsize 34 label:"${lines[$n]}" -blur 6x3 label_A.png
convert -size 200x200 -gravity center -background none -fill white -font "erasbd.ttf" -pointsize 34 label:"${lines[$n]}" -blur 3x2 label_B.png
convert -size 200x200 -gravity center -background none -fill "#ff6065" -font "erasbd.ttf" -pointsize 34 label:"${lines[$n]}" label_C.png
convert -size 200x200 xc:none label_A.png -geometry +6+6 -composite label_B.png -composite label_C.png -geometry +1+1 -composite -trim +repage label_F.png
convert tmp_$i.png label_F.png -gravity South -composite tmp_$i.png
n=$((n+1))

PowerShell (Windows):

$line=$lines[$n]
convert -size 200x200 -gravity center -background none -fill black -font "erasbd.ttf" -pointsize 34 label:$line -blur 6x3 label_A.png
convert -size 200x200 -gravity center -background none -fill white -font "erasbd.ttf" -pointsize 34 label:$line -blur 3x2 label_B.png
convert -size 200x200 -gravity center -background none -fill "#ff6065" -font "erasbd.ttf" -pointsize 34 label:$line label_C.png
convert -size 200x200 xc:none label_A.png -geometry +6+6 -composite label_B.png -composite label_C.png -geometry +1+1 -composite -trim +repage label_F.png
convert $j label_F.png -gravity South -composite $j
$n+=1

The font I use here is "erasbd.ttf", which you likely have if you run Windows or have Microsoft Office installed.

This code additionaly produces temporary "label_*.png" files. We don't want those to sit around after the signature is done, so add the following line to the "CLEANUP" block of the script

BASH (Linux/Mac):

rm label_*.png

PowerShell (Windows):

Remove-Item 'label_*.png'

Now you can run the code as is to get a sig that's similar to mine or adapt it to your liking.

 

This may look intimidating at first, but the cool thing is, once you have a design that's to your liking you can swap images in and out (adjusting "names.txt" accordingly) and generate new signatures by just running the script again. No need to match the style for every individual image one by one.

So have fun trying this stuff out - and why not show, what you came up with.

Edited by Tierparkzone
Added paragraph about Text with Outlines, provided link to a database of Japanese fonts.

Share this post


Link to post
Share on other sites
Tierparkzone

Advanced Options: Rows of Doll Pictures and Multi-Image Signatures

Time to talk about a few more things that are possible. This time's tips are most useful if you want to put pictures of many dolls into one single signature. Again, make sure the basic code from the opening post is producing a proper signature before you try the following stuff.

 

Adjusting the Number of Picture Rows in a Signature:

How it Usually Works

The script works in the way, that it first prepares every doll image you provide on its own. Only at the end everything gets patched together into a single signature image with ImageMagick's montage command. However if we look at the code in the block "ARRANGE IMAGES", there's a lot more going on. This is because the default montage command will try to arrange all pictures into a (roughly) square final image. - Which wouldn't be all that helpful if we want to optimally use a 550 by 200 pixel space.

Therefore, the script uses the

files=(tmp_*.png)files=(tmp_*.png)   # (for BASH)
# or
$filecount= @(dir -File -Filter tmp_*.png).Count   # (for PowerShell)

commands, to count the number of doll photos that need to be arranged. With a simple if/elseif/else condition, the script then picks the montage command that is appropriate for this number. 

One row for up to five pictures:

sig_onerow.png.12951ae2df42d1f65585f1e93cd5053e.png

Two rows for between six and 16 pictures:

sig_tworow.png.ba9a0f94fe0ee0222a19c458982a8a16.png

And three rows for 17 and more pictures:

sig_threerow.png.1e04ece52eadc1b3dcaecab0b9d6afe9.png

 

Technically, if you have more than 27 images, switching to four rows would be most efficient, but there aren't THAT many people on this forum who should run into this issue. And they can use the same method to manually adjust the number of rows, that I'm about to tell you here, anyway.

You should also note that montage will distribute the number of pictures evenly across all available rows, but if it isn't an even division, the final row will contain fewer pictures.

Manual Setting

Now, if you want a specific aesthetic for your signature, you may want to set the number of rows (or columns) yourself. For this, replace the whole "ARRANGE IMAGES" block of the script with a single montage command like

BASH (Linux/Mac):

montage "tmp_*.png" -tile x1 -geometry 200x200+0+0 -background none sig.png

PowerShell (Windows):

montage tmp_*.png -tile x1 -geometry 200x200+0+0 -background none sig.png

The interesting part is the "x1" for the "-tile" option that forces everything into a single row. By setting this to "x2", "x4", "x5" ... you can force the final image to contain 2, 4, 5, ... rows of pictures. In the same way you can set it to "1x", "2x", "5x" ... to force everything into 1, 2, 5, ... columns instead. - Here an example with four columns:

sig_fourcolumn.png.f353f26c2d42662f81c0803baef2f6a5.png

Though, with a height limit of 200 pixels for the signature images, I can't see much practical use for setting columns in this context. - If you remove the contents of the block "FIT TO FORUM SIZE" the final image won't be scaled down anymore. Then it won't be usable as a signature, but maybe you have an idea to use it for something else?

 

Spreading a Signature Across Multiple Images:

If you have several dolls but don't like how small their pictures get when crammed into a single signature image, why not spread them out across multiple images then? After all, the forum rules allow for a signature to contain up to two images (550 by 200 pixels each).

If you have replaced the "ARRANGE IMAGES" block with a single montage command as described above, this is very easy! The "-tile" option is not just able to be set to a specific number of rows or columns, but to a specific combination of rows (R) and columns (C) as well. The syntax is "CxR" so, for instance "4x1" will produce an image with one row of pictures that is four columns long.

The cool thing about this is, if you have more photos than would fit inside your combination of columns and rows, the montage command will create multiple images until every photo has been processed. So in case of our 4 by 1 setting - if we have 10 photos, we would get two images with four pictures and one image with two pictures (but the same dimensions).

sig-0.png.e9bb264f93ddf376227eb400b8e59d72.pngsig-1.png.073491b6561d08fece42b4ed0cdd887f.pngsig-2.png.07296499f30e951553493525bc387147.png

Of course, this is just to illustrate how it works. For generating a proper signature, make sure your combination of columns and rows allows for everything to fit inside two images. (In our example something like "5x1" or "3x2" would have been a better choice.)

The only further change you have to make, is replacing the block "FIT TO FORUM SIZE" with

BASH (Linux/Mac) and PowerShell (Windows):

convert sig*.png -filter Lanczos -resize 550x200 sig.png

The added "*" in the first sig.png allows to work with the slightly different filenames, the multi-image signature gets saved to.

 

And that's it for now. Have fun playing around a bit!

Edited by Tierparkzone

Share this post


Link to post
Share on other sites
Veravey

This is so thorough! Thank you for all the effort put into this. ;;)


1170566833_DarkerThanBlackYinbannerv2.png.00494620f57f854f2be78f0f2f9c89d6.png

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

I have read and agree to the Privacy Policy.