Jump to content

puxlavoix

Politely Nefarious

AnnaNeko

Xiongmao

Mandie

BeyondTime

DesertPhantom51

F-15

sunlightandtea

ateliervanilla

The Ecchizonans

Zoom Meetup

Tierparkzone

Frollywog

Veravey

MagicalRozen

Baldylox

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 4

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!


In this household, sanity is considered a tresspasser.

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


In this household, sanity is considered a tresspasser.

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

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. ;;)


ftRtwRu9355h.gif.886b75a4e71a6125e1f5c114f2fd2e47.gif

Share this post


Link to post
Share on other sites
Resilient

Hi !

I'm having difficulty following your directions. I saved my picture in a folder I newly created then opened a text file. I renamed it ''siggen.ps1'' (I'm using Windows) and saved it. Then I double-click on the Powershell file but it's a text file with nothing in it. I'm using Notepad, should I try another software ? I think I'm doing as it says in your post but it's not working. What should I do ? Also, how do I add the newly-created image signature I'm creating to my posts on the website ?

Thanks for helping me.

Here are some pictures to illustrate how I'm going through your steps.

1- Renaming the text file:

image.png.58082cb6a22fd6f586d7703e1ea68593.png

2- Result of my failed attempts at following your instructions:

 

image.png.3e7d3d0dc7456b05e0b5009f9b1c84c3.png

Edited by Resilient

sig.png

Share this post


Link to post
Share on other sites
BeyondTime
4 hours ago, Resilient said:

Then I double-click on the Powershell file but it's a text file with nothing in it.

In the OP there is a script you need to copy into the file, then you save it. Look for the following text in the post:

 

On 11/4/2020 at 5:06 AM, Tierparkzone said:

Script (PowerShell):

The script is in a box right under it.

Things like adding names are in another post farther down. 


The difference between Dollfie Dreams and Heroin? Heroin is illegal, Dollfie Dreams probably should be.

“Empty wallets, full hearts.” That’s probably an apt description for the effects of DD addiction

Share this post


Link to post
Share on other sites
Tierparkzone
7 hours ago, Resilient said:

I saved my picture in a folder I newly created then opened a text file. I renamed it ''siggen.ps1'' (I'm using Windows) and saved it. Then I double-click on the Powershell file but it's a text file with nothing in it. I'm using Notepad, should I try another software ?

Nice to see someone trying out the script. Let's get this running on your machine!

First of all, Notepad should work just fine.

As @BeyondTime mentioned, it looks like you skipped step 4: You'll have to copy the Power Shell script into the file before saving it. Even after saving it as a .ps1 script, it will technically remain a text file that you can open and edit with Notepad (scripts are just text files with executable text commands inside them after all). However, after following all the steps, the file should not be empty when re-opening it.
(You can ignore step 5 "alphamap options" for now until everything is running properly.)

Edit: Now that I'm taking a closer look: Btw, what's this?
eee.jpg.339b8848a48a89acd272f6d10c52706f.jpg

Did you perhaps save the script in one text file and then created a separate file that you renamed into siggen.ps1? 🙃
The text file that contains the script needs to be renamed instead.

 

7 hours ago, Resilient said:

Then I double-click on the Powershell file...

To actually execute the script, you don't run it via double click. Instead, do the following:
- While in the folder with the siggen.ps1 and your image(s), click inside the address bar of your file explorer, type powershell and hit enter.
ddd.jpg.43a951fcc2d99a9dfc53518c19b93d42.jpg
This will bring up the Power Shell command prompt.
- Inside Power Shell, you now type siggen.ps1 and hit enter to execute the script.

 

Some other things to note:

a) It looks like you're using Windows 10 or 11?
If I'm not mistaken, since Windows 10, the convert command is now reserved for a native windows command. Newer versions of ImageMagick therefore use the magick command instead. - When executing the script, if you get weird error messages regarding the convert command, try adding a magick before every convert and every montage command inside the script. For your convenience, I adapted the script from the opening post accordingly (see next post).

b) While Windows should not be case sensitive, if you get an error like "*.jpg - no such file ...", check if your picture is actually called filename.jpg and not filename.JPG. If necessary, rename your image file(s), so that the file suffix is completely lower case.

 

7 hours ago, Resilient said:

Also, how do I add the newly-created image signature I'm creating to my posts on the website ?

The script will create a sig.png image that you can upload as an image for your signature in your forum account settings. - Just as you must have uploaded your current "The Tea Party" signature image.

 

If you have further questions or run into more issues, feel free to post here again or drop by in the Zoom meet and I'll try to help you out.

Edited by Tierparkzone
had to split post - internal server error again...

Share this post


Link to post
Share on other sites
Tierparkzone

For Power Shell on Windows 10 and above with ImageMagick 7 and above:

# This is a PowerShell/ImageMagick script to generate a forum signature from a set of images.
# For ImageMagick version 7 and above.
# Intended for the users of dolldreaming.com.
# v2.2 by Tierparkzone

Remove-Item 'sig.png'

## ALPHAMAP OPTIONS
# you may replace the following line with other alphamap options
magick 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"
magick convert $i -auto-orient -filter Lanczos -resize 200x200^ -gravity North `
-crop 200x200+0+0 +repage $j
magick 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){
magick montage tmp_*.png -tile x3 -geometry 200x200+0+0 -background none sig.png
}elseif ($filecount -gt 5 ){
magick montage tmp_*.png -tile x2 -geometry 200x200+0+0 -background none sig.png
}else{
magick montage tmp_*.png -tile x1 -geometry 200x200+0+0 -background none sig.png
}

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

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

write-host("Done!")
Edited by Tierparkzone
had to split post - internal server error again...

Share this post


Link to post
Share on other sites
Resilient

Thanks for trying to help me. I followed your instructions and this is what happens.

I copied the script in the text file and then prompted Power Shell by typing 'powershell' in the address bar of the 'save as' dialog box. 

I try to enter 'siggen.ps1' and this is what I get.

What should I do ?

 

 

 

Thanks for helping me.

 

 

Edited by Resilient

sig.png

Share this post


Link to post
Share on other sites
Tierparkzone
48 minutes ago, Resilient said:

I copied the script in the text file and then prompted Power Shell by typing 'powershell' in the address bar of the 'save as' dialog box. 

I try to enter 'siggen.ps1' and this is what I get.

Oh no, sorry! I didn't mean for you to start Power Shell from the "save as" dialog. 😳   Even though, that already sort of worked...

First, save the script normally as the siggen.ps1 file. Then, when you are back in your regular file explorer window, in the folder with the siggen.ps1 and the images, the file explorer window should have a similar address bar as the "save as" dialog right? You enter powershell into this address bar, and then it should work.

 

I marked the picture above just because it was showing the address bar (not specifically because it was the save as dialog).

Share this post


Link to post
Share on other sites
Resilient

Hi,

Okay, I created the text file with the script in it and saved it as 'siggen.ps1'.

I typed 'powershell' in the Windows explorer pathway (address bar) and I still get this after entering the script ('siggen.ps1').

 

 

What am I doing wrong ?

Edited by Resilient

sig.png

Share this post


Link to post
Share on other sites
Tierparkzone
17 minutes ago, Resilient said:

I typed 'powershell' in the Windows explorer pathway (address bar) and I still get this after entering the script ('siggen.ps1').

Hmm... that is a bit odd.

In Power Shell, try .\siggen.ps1 (including the first dot and the backslash) then enter instead of just siggen.ps1 and then enter.

Edit: It should work this way - see the text below your error message. It seems Power Shell on Windows is behaving a little bit different from the Unix version.

 

If that doesn't work either, type ls (this time it's the lower case letter L) then enter and post the output here (in case the script got saved as a weird siggen.txt.ps1 or something).

Edited by Tierparkzone

Share this post


Link to post
Share on other sites
Resilient

Hi,

I managed to have results. I was wondering how I could make the pictures look like tilted rectangles like in your signature. My picture is round like with the default alphamap.

Thanks for showing me how to do so.

Edited by Resilient

sig.png

Share this post


Link to post
Share on other sites
Tierparkzone
28 minutes ago, Resilient said:

I managed to have results.

Great to hear!

Now you can start to play around with the imagemagic commamds.

I'll post the code for the slanted rectangle alpha map once I'm back home - which will not be for a couple more hours. (Should've been something with rounded rectangle and distort.)

Share this post


Link to post
Share on other sites
Starwaia

This looks really useful and I might try it once I get a bunch of more recent pics of my doll family.

Question, though- do the images have to all be the same size/aspect ratio at the start? Or can I take, say, square images from my older posts on instagram that I may not have saved on my phone, and put them next to rectangular phone pictures? And if so, would there be a way to make them all consistent size wise using the script itself?

Thanks so much for providing this resource, it will definitely make things a lot easier than manually editing images together via paint.net which is what I currently have.


Currently watching BNHA, 1-2 episodes behind on the anime rn and absolutely obsessed! (being in a fandom late has made dodging spoilers an issue tho :()

More into Nendoroids and my resin BJDs rn- including some BNHA character shells hehehe :)- my Smartdolls are boxed up at the moment but I'm still happy to talk dolls and doll plans!

Share this post


Link to post
Share on other sites
Tierparkzone
On 3/26/2023 at 6:44 PM, Starwaia said:

Question, though- do the images have to all be the same size/aspect ratio at the start? Or can I take, say, square images from my older posts on instagram that I may not have saved on my phone, and put them next to rectangular phone pictures? And if so, would there be a way to make them all consistent size wise using the script itself?

Yes, the script automatically works with any image size and aspect ratio (with many large images it just takes a few seconds longer).

In the default settings, every image will be cropped into a square (top part of portrait images, center part of landscape images), then scaled to 200x200 pixels (can't go taller in the signature anyway). So square images won't get cropped at all, just rescaled. The final image shape is then achieved by the alphamap just turning parts of the image edge transparent.

 

On 3/26/2023 at 2:08 PM, Resilient said:

I was wondering how I could make the pictures look like tilted rectangles like in your signature. My picture is round like with the default alphamap.

Here is the code for the slanted rectangles (works for Bash and Power Shell)

convert -size 200x200 xc:black -fill white -draw "roundrectangle 9,9 171,191 20,20" -blur 9x4 -distort Affine ' 0,0 20,0
180,200 180,200
0,200 0,200' alphamap.png

sig_slanted.png.5996c75053aec77aec6ca89504bc2866.png

Replace the current line in the alphamap options with these three lines. Also remember to add a magick in front of the convert, if you had to use that in your script until now.

 

Edited by Tierparkzone
Added sample image
  • Thanks 1

Share this post


Link to post
Share on other sites
Tierparkzone

For fun, here is the complete script that I use for my current signature.

Note that I'm doing some things different, because I know beforehand how many and which images I'll feed into the script. (Whereas the general script has to work for everyone instead.) Prominent changes are (but not limited to):

  • I crop my images into rectangles to use space more effectively for 10 dolls
  • I pull names from a names.txt (Latin) and a namesJ.txt (Japanese) to have the doll names written in both English and Japanese
  • I use the -tile option for montage as described above to split the signature over multiple images

I will not go into detail about the specifics of this code, but if you've read the above posts about the advanced options, you should be able to figure out what most of this stuff does.

My script (BASH):

# This my personal BASH/ImageMagick script to generate a DollDreaming forum signature.
# v4.1 by Tierparkzone

rm sig*.png

## ALPHAMAP OPTIONS
# you may replace the following line with other alphamap options
convert -size 200x300 xc:black -fill white -draw "roundrectangle 9,9 171,291 20,20" -blur 9x4 -distort Affine ' 0,0 20,0
180,300 180,300
0,300 0,300' alphamap.png

## IMPORT NAMES (ADVANCED)
# code for importing names from a .txt file goes here
IFS=$'\n' read -d '' -r -a lines < names.txt
IFS=$'\n' read -d '' -r -a linesJ < namesJ.txt
n=0

## APPLY APLHAMAP
for i in *.jpg
do
convert $i -auto-orient -filter Lanczos -resize 200x300^ -gravity North -crop 200x300+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
convert -size 200x200 -gravity center -background none -fill black -font 851CHIKARA-DZUYOKU_kanaA_004.ttf -pointsize 65 label:"${linesJ[$n]}" -blur 6x3 label_A.png
convert -size 200x200 -gravity center -background none -fill white -font 851CHIKARA-DZUYOKU_kanaA_004.ttf -pointsize 65 label:"${linesJ[$n]}" -blur 3x2 label_B.png
convert -size 200x200 -gravity center -background none -fill "SteelBlue" -font 851CHIKARA-DZUYOKU_kanaA_004.ttf -pointsize 65 label:"${linesJ[$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 Southeast -composite tmp_$i.png

convert -size 200x200 -gravity center -background none -fill black -font ERASBD.TTF -pointsize 30 label:"${lines[$n]}" -blur 6x3 label_A.png
convert -size 200x200 -gravity center -background none -fill white -font ERASBD.TTF -pointsize 30 label:"${lines[$n]}" -blur 3x2 label_B.png
convert -size 200x200 -gravity center -background none -fill "#ff6065" -font ERASBD.TTF -pointsize 30 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 Southeast -composite tmp_$i.png

n=$((n+1))
# ...until here
done

## ARRANGE IMAGES
montage tmp_*.png -tile 5x1 -geometry 200x300+0+0 -background none sig.png

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

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

echo "Done!"

 

My script (Power Shell):

# This my personal PowerShell/ImageMagick script to generate a DollDreaming forum signature.
# v4.1 by Tierparkzone

Remove-Item 'sig*.png'

## ALPHAMAP OPTIONS
# you may replace the following line with other alphamap options
convert -size 200x300 xc:black -fill white -draw "roundrectangle 9,9 171,291 20,20" -blur 9x4 -distort Affine ' 0,0 20,0
180,300 180,300
0,300 0,300' alphamap.png

## IMPORT NAMES (ADVANCED)
# code for importing names from a .txt file goes here
$lines = Get-Content names.txt
$linesJ = Get-Content namesJ.txt
$n=0

## 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 200x300^ -gravity North -crop 200x300+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
$line=$lines[$n]
$lineJ=$linesJ[$n]
convert -size 200x200 -gravity center -background none -fill black -font 851CHIKARA-DZUYOKU_kanaA_004.ttf -pointsize 65 label:$lineJ -blur 6x3 label_A.png
convert -size 200x200 -gravity center -background none -fill white -font 851CHIKARA-DZUYOKU_kanaA_004.ttf -pointsize 65 label:$lineJ -blur 3x2 label_B.png
convert -size 200x200 -gravity center -background none -fill "SteelBlue" -font 851CHIKARA-DZUYOKU_kanaA_004.ttf -pointsize 65 label:$lineJ 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 Southeast -composite $j

convert -size 200x200 -gravity center -background none -fill black -font ERASBD.TTF -pointsize 30 label:$line -blur 6x3 label_A.png
convert -size 200x200 -gravity center -background none -fill white -font ERASBD.TTF -pointsize 30 label:$line -blur 3x2 label_B.png
convert -size 200x200 -gravity center -background none -fill "#ff6065" -font ERASBD.TTF -pointsize 30 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 Southeast -composite $j

$n+=1
# ...until here
}

## ARRANGE IMAGES
montage tmp_*.png -tile 5x1 -geometry 200x300+0+0 -background none sig.png

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

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

write-host("Done!")
Edited by Tierparkzone
  • Thanks 2

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.