probably should be text/label_multiline.jpg since the line above it saves it to the text folder.
yes, but you have to manually copy the code and paste into the other window.
kcolorchooser --paste means you don’t have to copy the code and it will be written directly into the script variables for use in the imagemagick commands, saves a step.
and as far as i can tell my use of the kdialog --getcolor does exactly the same thing, just with a more descriptive title.
when the color picker dialog eventually gets fixed for wayland, then you will be able to pick from the screen, which will be nice, but in the meantime you can at least eyeball it.
see the attachment to this bug report @hech made
I am now in Manjaro because I built Imagemagick myself in Tuxedo OS and may have done something wrong.
Here in Manjaro it looks much better with the last script from @hech.
- opens image in Gwenview
- initial dialog appears
- kcolorchooser appears (complete!)
- color code dialog appears
- text and pictures with label are created in the Birds folder
- the original photo is no longer in pictures folder.
Unfortunately, the labeled photo is also nowhere.
Again this error message
magick: unable to open image 'text/label_multiline.jpg': Datei oder Verzeichnis nicht gefunden @ error/blob.c/OpenBlob/3596
can you copy and past the last two imagemagick lines you are currently using into a text box here to make sure we are all talking about the same code?
you can use three backtick characters on a separate line to start a text block for easy reading
like this, and then follow it with a blank line and another set of three backticks to close it out
like this.
Run this only, where you have 1.jpg
Open konsole in the folder with 1.jpg
magick -background "#8f9f3c" -fill black -font Roboto-Bold -pointsize 20 label:"This is it" label_multiline.jpg
Hit “Enter”
Do you then get label_multiline.jpg?
TO ALL!
EVERYTHING WORKS, REALLY EVERYTHING - YOU CAN SEE IT IN THE PICTURE
It was magick’s fault that it didn’t recognize the Roboto-Bold font or that the one I used had a fixed size.
I AM SO HAPPY!!! YOU ARE TRUE WORLD CHAMPIONS!
I still have one question or request - could you move the inserted text 3px to the right and 3 px up? Only if it is easy.
change the +3+3 to +6+6
Full new updated script.
Backup the one you have and use this:
Change Roboto-Bold to the font you want to use
and change fontsize to the one you want.
#!/bin/bash
ft=Roboto-Bold
fontsize=20
if [ ! -d pictures ]; then
mkdir pictures
fi
if [ ! -d text ]; then
mkdir text
fi
if [ ! -d pictures-with-label ]; then
mkdir pictures-with-label
fi
for files in pictures/*; do
n=$(echo "$files" | sed -e "s|pictures/||" | sed -e "s/\..*//")
if [ ! -f text/"$n".txt ]; then
gwenview "$files" &
gw=$!
kdialog --textinputbox "About the Bird" >text/"$n"-text.txt
kc=$(pidof kcolorchooser)
if [ "$kc" == "" ]; then
kcolorchooser &
fi
kdialog --inputbox "Please paste the HTML background color here:" >"$n".tmp
cat "$n".tmp | sed -e "s/^/colorcode=/" | sed -e "s|$|\n|" >text/"$n".txt
kdialog --menu "Text Color" 1 "Black" 2 "White" >"$n".tmp
cat "$n".tmp | sed -e "s/1/textcolor=Black/" | sed -e "s/2/textcolor=White/" >>text/"$n".txt
rm "$n".tmp
if [ ! "$gw" == "" ]; then
kill $gw
fi
fi
t=$(cat text/"$n"-text.txt)
c=$(cat text/"$n".txt | grep "colorcode=" | sed -e "s/colorcode=//")
tc=$(cat text/"$n".txt | grep "textcolor=" | sed -e "s/textcolor=//")
magick -background "$c" -fill $tc -font $ft -pointsize $fontsize label:"$t" text/label_multiline.jpg
magick "$files" text/label_multiline.jpg -gravity Southwest -geometry +6+6 -composite pictures-with-label/"$n".jpg
done
you can change the values for the -geometry +3+3 option to meet your needs
i changed mine to +6+6 to move it away from the corner a bit more.
if you want them in the lower right use -gravity Southeast instead… i may add the option choose the placement for two different text blocks on my copy
i also added a -bordercolor "$c" -border 10x3 section to put a bit of padding on the text block as well as interline-spacing -8 to squeeze the lines closer together… and you may need to play with those values based on your font choice and picture size.
but those switches work on the version 6, i haven’t looked up if they also work on version 7, but i would assume so.
If you make an error, open text/
Edit the txt file for the photo that has the error
Then just run the script again.
When done you should remove the text/ folder and the pictures in pictures/ folder so that it’s empty for next time.
Good morning,
I tried out the new script. In Tuxedo OS the Colorchooser does not open - otherwise everything works. In Manjaro everything works fine.
I took 12 photos in 27 minutes; that’s terrific! (At least twice as fast as with Xnview).
One more request: Can the background field be a little higher and wider so that the font doesn’t look so squeezed in?
Please also tell me where and how to insert it.
I have learned a lot!
TUXEDO OS
Terminal: 28: [: unexpected operator
Read what skyfishgoo writes in
https://discuss.kde.org/t/so-many-issues-with-wayland/36125/132
so that you know what it does.
exchange first magick with
magick -background "$c" -fill $tc -font $ft -pointsize $fontsize -interline-spacing -4 label:"$t" -bordercolor "$c" -border 10x3 text/label_multiline.jpg
and test it on your Manjaro.
You do NOT have to start from scratch every time.
As long as you have all the text files in text/ and all of the pictures in pictures/
If you make a mistake in the “about the bird” just edit the name-from-picture-text.txt
If you change anything in the magick commands, just run the script again and all the changes will be applied without you having to do anything else.
For the record:
As long as you have all the text files in text/ and all of the pictures in pictures/
Go test it!
I just have 11 photos in my pictures folder that I want to edit before lunchtime. Probably enough opportunities to test it out.
Delete the second == in the two places they are, so that there is only one = in those two line.
Save the script and test it in TUXEDO OS
Does that work?
once you have gone thru all the prompts the script crates a text file record in the text folder.
when you re-run the script with all the text files created, then it just applies them to the picture output without further prompting.
if you make a spelling error or forget something you can just edit the -text.txt file for that picture and re-run the script to apply the changes.
you can even tweak the color codes and change the text color by editing the picture’s .txt file.


