Help with batch watermarking jpg after photobooth
-
- Posts: 17
- Joined: 2018-12-31T12:49:38-07:00
- Authentication code: 1152
Help with batch watermarking jpg after photobooth
Hello, I would like to add a watermark to all images generated from a photobooth program stored in a folder on my raspberry pi. Could someone please guide me to creating the script and the folder? I've been searching everywhere but I can't seem to run the program successfully on my raspberry pi. thank you.
I want to do something that was written on this website: https://www.xoogu.com/2013/how-to-autom ... /#comments
for i in ./*.jpg ./*.jpeg
do
if [ ! -d "./watermarked" ]; then mkdir "./watermarked"; fi
filename=$(basename "$i")
~/apps/ImageMagick/bin/convert \
-filter Lanczos \
"$i" \
-set option:filter:filter Lanczos \
-set option:filter:blur 0.8 \
-resize 500x500 \
-quality 80 \
../watermark-small.png -gravity SouthEast -geometry +30 -composite \
"./watermarked/$filename"
done
I've created a .sh file with those parameters, and placed it in the folders containing the images, but when I ran the program it says:
watermark.sh: 11: watermark.sh: /home/pi/apps/ImageMagick/bin/convert: not found
watermark.sh: 13: watermark.sh: -filter: not found
watermark.sh: 15: watermark.sh: ./photobooth00001.jpg: Permission denied
watermark.sh: 17: watermark.sh: -set: not found
watermark.sh: 19: watermark.sh: -set: not found
watermark.sh: 21: watermark.sh: -resize: not found
watermark.sh: 23: watermark.sh: -quality: not found
watermark.sh: 25: watermark.sh: ../borders.png: not found
watermark.sh: 27: watermark.sh: ./watermarked/photobooth00001.jpg: not found
watermark.sh: 11: watermark.sh: /home/pi/apps/ImageMagick/bin/convert: not found
watermark.sh: 13: watermark.sh: -filter: not found
watermark.sh: 15: watermark.sh: ./*.jpeg: not found
watermark.sh: 17: watermark.sh: -set: not found
watermark.sh: 19: watermark.sh: -set: not found
watermark.sh: 21: watermark.sh: -resize: not found
watermark.sh: 23: watermark.sh: -quality: not found
watermark.sh: 25: watermark.sh: ../borders.png: not found
watermark.sh: 27: watermark.sh: ./watermarked/*.jpeg: not found
pi@raspnode:~/Desktop/PHOTOBOOTH PICTURES $
I want to do something that was written on this website: https://www.xoogu.com/2013/how-to-autom ... /#comments
for i in ./*.jpg ./*.jpeg
do
if [ ! -d "./watermarked" ]; then mkdir "./watermarked"; fi
filename=$(basename "$i")
~/apps/ImageMagick/bin/convert \
-filter Lanczos \
"$i" \
-set option:filter:filter Lanczos \
-set option:filter:blur 0.8 \
-resize 500x500 \
-quality 80 \
../watermark-small.png -gravity SouthEast -geometry +30 -composite \
"./watermarked/$filename"
done
I've created a .sh file with those parameters, and placed it in the folders containing the images, but when I ran the program it says:
watermark.sh: 11: watermark.sh: /home/pi/apps/ImageMagick/bin/convert: not found
watermark.sh: 13: watermark.sh: -filter: not found
watermark.sh: 15: watermark.sh: ./photobooth00001.jpg: Permission denied
watermark.sh: 17: watermark.sh: -set: not found
watermark.sh: 19: watermark.sh: -set: not found
watermark.sh: 21: watermark.sh: -resize: not found
watermark.sh: 23: watermark.sh: -quality: not found
watermark.sh: 25: watermark.sh: ../borders.png: not found
watermark.sh: 27: watermark.sh: ./watermarked/photobooth00001.jpg: not found
watermark.sh: 11: watermark.sh: /home/pi/apps/ImageMagick/bin/convert: not found
watermark.sh: 13: watermark.sh: -filter: not found
watermark.sh: 15: watermark.sh: ./*.jpeg: not found
watermark.sh: 17: watermark.sh: -set: not found
watermark.sh: 19: watermark.sh: -set: not found
watermark.sh: 21: watermark.sh: -resize: not found
watermark.sh: 23: watermark.sh: -quality: not found
watermark.sh: 25: watermark.sh: ../borders.png: not found
watermark.sh: 27: watermark.sh: ./watermarked/*.jpeg: not found
pi@raspnode:~/Desktop/PHOTOBOOTH PICTURES $
Last edited by photoboothnwb on 2018-12-31T13:03:45-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Help with batch watermarking jpg after photobooth
Do you have Imagemagick installed? What version?
What does that report?
Do you have Imagick installed?
Can you do
or the Imagick equivalent?
_____________________
Please, always provide your IM version and platform when asking questions, since syntax may differ.
Also provide your exact command line and your images, if possible.
See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620
If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli
For novices, see
http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown
https://imagemagick.org/script/porting.php#cli
Code: Select all
convert -version
Do you have Imagick installed?
Can you do
Code: Select all
convert logo: logo.gif
_____________________
Please, always provide your IM version and platform when asking questions, since syntax may differ.
Also provide your exact command line and your images, if possible.
See the top-most post in this forum "IMPORTANT: Please Read This FIRST Before Posting" at http://www.imagemagick.org/discourse-se ... f=1&t=9620
If using Imagemagick 7, then see http://imagemagick.org/script/porting.php#cli
For novices, see
http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown
https://imagemagick.org/script/porting.php#cli
-
- Posts: 17
- Joined: 2018-12-31T12:49:38-07:00
- Authentication code: 1152
Re: Help with batch watermarking jpg after photobooth
Yes, it is installed:
Version: ImageMagick 6.9.7-4 Q16 arm 20170114 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib
I edited my original post with the method I'm trying and the errors I've received.
Version: ImageMagick 6.9.7-4 Q16 arm 20170114 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib
I edited my original post with the method I'm trying and the errors I've received.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Help with batch watermarking jpg after photobooth
Try your command with one image and one watermark and not in a loop. What is that command and does it work?
Your code had nothing to do with Imagick? Why did you post in this forum?
Your code had nothing to do with Imagick? Why did you post in this forum?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Help with batch watermarking jpg after photobooth
The basic format should be
Does this work?
Best to try the simplest command and then work toward more complex ones.
Code: Select all
convert backgroundimage watermarkimage -geometry +X+Y -compose over -composite resultimage
Best to try the simplest command and then work toward more complex ones.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Help with batch watermarking jpg after photobooth
Your first error message says it cannot fine convert. So your path may be wrong. Also you should read your input image before -filter
-
- Posts: 17
- Joined: 2018-12-31T12:49:38-07:00
- Authentication code: 1152
Re: Help with batch watermarking jpg after photobooth
Yes, that command worked and generated a logo over the original image. Could you please help me create a shell script that automatically batch all images that are generated in a folder (outputted by this photobooth program https://github.com/reuterbal/photobooth), so that it can be sent to photobooth printer with the logo?
And sorry please move this thread to appropriate subforum, I thought it was the correct one when I looked at the main forum.
And sorry please move this thread to appropriate subforum, I thought it was the correct one when I looked at the main forum.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Help with batch watermarking jpg after photobooth
Please show the command that worked. Your loop command contains -geometry +30. It might be better to specify -geometry +30+0
-
- Posts: 17
- Joined: 2018-12-31T12:49:38-07:00
- Authentication code: 1152
Re: Help with batch watermarking jpg after photobooth
convert photobooth00001.jpg borders.png -500 +500+400 -compose over -composite resultimage.jpg
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Help with batch watermarking jpg after photobooth
You have an invalid command. As stated it won't work.
What is -500? You need an operator or setting? What is +500+400? You need an operator or setting? What are the paths to your directories containing your images? What is the path to Imagemagick convert? Do you need the path specified?
What is -500? You need an operator or setting? What is +500+400? You need an operator or setting? What are the paths to your directories containing your images? What is the path to Imagemagick convert? Do you need the path specified?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Help with batch watermarking jpg after photobooth
Try this format on one background image and one watermark image.
Adjust the -geometry +30+X as desired.
Code: Select all
convert \
\( /path2/backgroundimage \
-set option:filter:filter Lanczos \
-set option:filter:blur 0.8 \
-filter lanczos \
-resize 500x500 \) \
/path2/watermark-small.png \
-gravity SouthEast \
-geometry +30+0 \
-composite \
-quality 80 \
/path2/outputfile
-
- Posts: 17
- Joined: 2018-12-31T12:49:38-07:00
- Authentication code: 1152
Re: Help with batch watermarking jpg after photobooth
sorry, I am really new to this:
pi@raspnode:~/Desktop/PHOTOBOOTH PICTURES $ convert photobooth00002.jpg borders.png -geometry 600423 -compose over -composite resultimage.jpg
convert-im6.q16: width or height exceeds limit `photobooth00002.jpg' @ error/cache.c/OpenPixelCache/3802.
convert-im6.q16: width or height exceeds limit `borders.png' @ error/cache.c/OpenPixelCache/3802.
It still generated a resultimage.jpg, but the borders are not completely aligned, the bottom portion is cropped. The source image is 1920x1080p.
How do I go about in running that script? Am I to make a new shell and execute it? What is the path to background image when the folder is located at /home/pi/Desktop/PHOTOBOOTH PICTURES?
pi@raspnode:~/Desktop/PHOTOBOOTH PICTURES $ convert photobooth00002.jpg borders.png -geometry 600423 -compose over -composite resultimage.jpg
convert-im6.q16: width or height exceeds limit `photobooth00002.jpg' @ error/cache.c/OpenPixelCache/3802.
convert-im6.q16: width or height exceeds limit `borders.png' @ error/cache.c/OpenPixelCache/3802.
It still generated a resultimage.jpg, but the borders are not completely aligned, the bottom portion is cropped. The source image is 1920x1080p.
How do I go about in running that script? Am I to make a new shell and execute it? What is the path to background image when the folder is located at /home/pi/Desktop/PHOTOBOOTH PICTURES?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Help with batch watermarking jpg after photobooth
Are both images in /home/pi/Desktop/PHOTOBOOTH PICTURES?
What sizes are your two images?
-geometry 600423 is not valid. Did you mean -geometry +600+423? Without -gravity, it will be aligned relative to the top left corner of your background image.convert photobooth00002.jpg borders.png -geometry 600423 -compose over -composite resultimage.jpg
What sizes are your two images?
-
- Posts: 17
- Joined: 2018-12-31T12:49:38-07:00
- Authentication code: 1152
Re: Help with batch watermarking jpg after photobooth
The source image is 1920 x 1080p, and the overlay image is 600x423. Yes, all my photos will be outputted to PHOTOBOOTH PICTURES folder located on pi desktop.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Help with batch watermarking jpg after photobooth
I was asking where the two input images are located relative to your working directory where you issue your convert command.
Try using full paths to your images. Also what are you trying to do with -geometry. It is for offsetting the overlay relative to the background. It is not supposed to be used to resize. If you want to process either of your images, you should do that in parentheses so that it the processing is limited to one or the other image and does not get applied to both.
If you post your two images to some free image hosting service such as dropbox.com and put the URLs here, I can help further. Also post the paths to your input images and to your output image relative to your working directory or with full paths.
If both images are in the same directory, then try
Does that work?
Try using full paths to your images. Also what are you trying to do with -geometry. It is for offsetting the overlay relative to the background. It is not supposed to be used to resize. If you want to process either of your images, you should do that in parentheses so that it the processing is limited to one or the other image and does not get applied to both.
If you post your two images to some free image hosting service such as dropbox.com and put the URLs here, I can help further. Also post the paths to your input images and to your output image relative to your working directory or with full paths.
If both images are in the same directory, then try
Code: Select all
convert photobooth00002.jpg borders.png -gravity northwest -geometry +100+100 -compose over -composite resultimage.jpg