Recursively execute imagemagick composite command in directory treeremove extra tilespace from a montage...
Can I say: "When was your train leaving?" if the train leaves in the future?
Is this apt vulnerability (CVE-2019-3462) a security concern for Ubuntu users?
German characters on US-International keyboard layout
Entering the UK as a British citizen who is a Canadian permanent resident
Anatomically Correct Carnivorous Tree
Developers demotivated due to working on same project for more than 2 years
Determine the slope and write the Cartesian equation of the line.
What was the significance of Varys' little girl?
Why do I get two different answers when solving for arclength?
On studying Computer Science vs. Software Engineering to become a proficient coder
Why would a switch ever send an ARP request for a MAC address when it can just wait for the first packet to be received from a device?
Unexpected Netflix account registered to my Gmail address - any way it could be a hack attempt?
Rounding a number extracted by jq to limit the decimal points
How can dragons propel their breath attacks to a long distance
Quote from Leibniz
Area under the curve - Integrals (Antiderivatives)
Can't find the release for this wiring harness connector
Why was Thor doubtful about his worthiness to Mjolnir?
As programers say: Strive to be lazy
Conditional probability - sum of dice is even given that at least one is a five
Why are solar panels kept tilted?
What is the largest number of identical satellites launched together?
Find hamming distance between two Strings of equal length in Java
Are there any established rules for splitting books into parts, chapters, sections etc?
Recursively execute imagemagick composite command in directory tree
remove extra tilespace from a montage (ImageMagick) composite image?imagemagick globbing multiple extensionsHow to rotate all images in a directory with imagemagick?Imagemagick segmentation-faulthow to shrink all images, jpg in a directory to another directory using imagemagickImageMagick/GraphicsMagick: How to merge/composite multiple (3+) images without temp files in a single step?imagemagick create pdf from 2 different imagesimagemagick command not found?Building ImageMagick commandCommand “tree” vs “tree -R”
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I have a large directory tree with many sub-folders and lots of images within each one. I found a script that applies watermark to all images within a directory, in-place, overwriting the original image. I'm looking for the best way to iterate trough all the folders and subfolders and run the "compose" command for each image on my linux server.
Here is the original script I found
#!/bin/bash
###########################################
# NAME: wn-ow
# AUTHOR: Linerd (http://tuxtweaks.com), Copyright 2009
# LICENSE: Creative Commons Attribution - Share Alike 3.0 http://creativecommons.org/licenses/by-sa/3.0/
# You are free to use and/or modify this script. If you choose to distribute this script, with or
# without changes, you must attribute credit to the author listed above.
# REQUIRES: ImageMagick, coreutils
# VERSION: 1.0
# DESCRIPTION: A script to add a watermark and overwrite all images in a directory.
#
# This script will watermark all of the images in a directory. Warning! This will overwrite the files.
###########################################
# Initialize variables
WM=$HOME/public_html/image/catalog/logo-website/watermark.png # This is the path to your watermark image
SCALE=100 # This sets the scale % of your watermark image
# Warning
echo -e "This will overwrite all of the images in this directory."\n"Are you shure want to continue? {Y/n}"
read REPLY
if
[ "$REPLY" != "n" ] && [ "$REPLY" != "N" ]
then
file -i * | grep image | awk -F':' '{ print $1 }' | while read IMAGE
do
echo Watermarking $IMAGE
composite -dissolve 40% -gravity SouthEast -quality 100 ( $WM -resize $SCALE% ) "$IMAGE" "$IMAGE"
done
else
echo exiting
exit 0
fi
exit 0
Should I use a combination of "find . -name *.jpg" or something else?
recursive imagemagick composite
bumped to the homepage by Community♦ 1 hour ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have a large directory tree with many sub-folders and lots of images within each one. I found a script that applies watermark to all images within a directory, in-place, overwriting the original image. I'm looking for the best way to iterate trough all the folders and subfolders and run the "compose" command for each image on my linux server.
Here is the original script I found
#!/bin/bash
###########################################
# NAME: wn-ow
# AUTHOR: Linerd (http://tuxtweaks.com), Copyright 2009
# LICENSE: Creative Commons Attribution - Share Alike 3.0 http://creativecommons.org/licenses/by-sa/3.0/
# You are free to use and/or modify this script. If you choose to distribute this script, with or
# without changes, you must attribute credit to the author listed above.
# REQUIRES: ImageMagick, coreutils
# VERSION: 1.0
# DESCRIPTION: A script to add a watermark and overwrite all images in a directory.
#
# This script will watermark all of the images in a directory. Warning! This will overwrite the files.
###########################################
# Initialize variables
WM=$HOME/public_html/image/catalog/logo-website/watermark.png # This is the path to your watermark image
SCALE=100 # This sets the scale % of your watermark image
# Warning
echo -e "This will overwrite all of the images in this directory."\n"Are you shure want to continue? {Y/n}"
read REPLY
if
[ "$REPLY" != "n" ] && [ "$REPLY" != "N" ]
then
file -i * | grep image | awk -F':' '{ print $1 }' | while read IMAGE
do
echo Watermarking $IMAGE
composite -dissolve 40% -gravity SouthEast -quality 100 ( $WM -resize $SCALE% ) "$IMAGE" "$IMAGE"
done
else
echo exiting
exit 0
fi
exit 0
Should I use a combination of "find . -name *.jpg" or something else?
recursive imagemagick composite
bumped to the homepage by Community♦ 1 hour ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
I'm trying to do it for ,JPG. I only have .JPG files. I just tried the below command, but it complains about invalid filenames, I think because the folders and sub-folders have names with spaces like "17 inches".WM=$HOME/public_html/image/catalog/logo-website/watermark.png SCALE=100 for f in
find . -iname ".jpg"` do composite -dissolve 40% -gravity SouthEast -quality 100 ( $WM -resize $SCALE% ) "$f" "$f" done exit 0` I get "composite: unable to open image `./17': No such file or directory @ error/blob.c/OpenBlob/2588."
– Roberto C
Oct 4 '15 at 22:53
1
You don't need that whole script to do that...find . -iname '*.jpg' -exec echo composite -dissolve 40% -gravity SouthEast -quality 100 /path/to/watermark -resize 100 {} {} ;
Replace /path/to/watermark and 100 after -resize with your actual values and if you're happy with the result remove theecho
in front ofcomposite
– don_crissti
Oct 4 '15 at 23:05
hah...yeah, your answer is much better @don_crissti you should put it in as the proper answer
– seumasmac
Oct 4 '15 at 23:12
For some reason it makes my images very small resolution and poor quality. I use thisfind . -iname '*.jpg' -exec composite -dissolve 40% -gravity SouthEast -quality 100 /home/public_html/image/catalog/logo-website/watermark.png -resize 100% {} {} ;
What am I missing?
– Roberto C
Oct 4 '15 at 23:32
add a comment |
I have a large directory tree with many sub-folders and lots of images within each one. I found a script that applies watermark to all images within a directory, in-place, overwriting the original image. I'm looking for the best way to iterate trough all the folders and subfolders and run the "compose" command for each image on my linux server.
Here is the original script I found
#!/bin/bash
###########################################
# NAME: wn-ow
# AUTHOR: Linerd (http://tuxtweaks.com), Copyright 2009
# LICENSE: Creative Commons Attribution - Share Alike 3.0 http://creativecommons.org/licenses/by-sa/3.0/
# You are free to use and/or modify this script. If you choose to distribute this script, with or
# without changes, you must attribute credit to the author listed above.
# REQUIRES: ImageMagick, coreutils
# VERSION: 1.0
# DESCRIPTION: A script to add a watermark and overwrite all images in a directory.
#
# This script will watermark all of the images in a directory. Warning! This will overwrite the files.
###########################################
# Initialize variables
WM=$HOME/public_html/image/catalog/logo-website/watermark.png # This is the path to your watermark image
SCALE=100 # This sets the scale % of your watermark image
# Warning
echo -e "This will overwrite all of the images in this directory."\n"Are you shure want to continue? {Y/n}"
read REPLY
if
[ "$REPLY" != "n" ] && [ "$REPLY" != "N" ]
then
file -i * | grep image | awk -F':' '{ print $1 }' | while read IMAGE
do
echo Watermarking $IMAGE
composite -dissolve 40% -gravity SouthEast -quality 100 ( $WM -resize $SCALE% ) "$IMAGE" "$IMAGE"
done
else
echo exiting
exit 0
fi
exit 0
Should I use a combination of "find . -name *.jpg" or something else?
recursive imagemagick composite
I have a large directory tree with many sub-folders and lots of images within each one. I found a script that applies watermark to all images within a directory, in-place, overwriting the original image. I'm looking for the best way to iterate trough all the folders and subfolders and run the "compose" command for each image on my linux server.
Here is the original script I found
#!/bin/bash
###########################################
# NAME: wn-ow
# AUTHOR: Linerd (http://tuxtweaks.com), Copyright 2009
# LICENSE: Creative Commons Attribution - Share Alike 3.0 http://creativecommons.org/licenses/by-sa/3.0/
# You are free to use and/or modify this script. If you choose to distribute this script, with or
# without changes, you must attribute credit to the author listed above.
# REQUIRES: ImageMagick, coreutils
# VERSION: 1.0
# DESCRIPTION: A script to add a watermark and overwrite all images in a directory.
#
# This script will watermark all of the images in a directory. Warning! This will overwrite the files.
###########################################
# Initialize variables
WM=$HOME/public_html/image/catalog/logo-website/watermark.png # This is the path to your watermark image
SCALE=100 # This sets the scale % of your watermark image
# Warning
echo -e "This will overwrite all of the images in this directory."\n"Are you shure want to continue? {Y/n}"
read REPLY
if
[ "$REPLY" != "n" ] && [ "$REPLY" != "N" ]
then
file -i * | grep image | awk -F':' '{ print $1 }' | while read IMAGE
do
echo Watermarking $IMAGE
composite -dissolve 40% -gravity SouthEast -quality 100 ( $WM -resize $SCALE% ) "$IMAGE" "$IMAGE"
done
else
echo exiting
exit 0
fi
exit 0
Should I use a combination of "find . -name *.jpg" or something else?
recursive imagemagick composite
recursive imagemagick composite
asked Oct 4 '15 at 22:37
Roberto CRoberto C
111
111
bumped to the homepage by Community♦ 1 hour ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 1 hour ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
I'm trying to do it for ,JPG. I only have .JPG files. I just tried the below command, but it complains about invalid filenames, I think because the folders and sub-folders have names with spaces like "17 inches".WM=$HOME/public_html/image/catalog/logo-website/watermark.png SCALE=100 for f in
find . -iname ".jpg"` do composite -dissolve 40% -gravity SouthEast -quality 100 ( $WM -resize $SCALE% ) "$f" "$f" done exit 0` I get "composite: unable to open image `./17': No such file or directory @ error/blob.c/OpenBlob/2588."
– Roberto C
Oct 4 '15 at 22:53
1
You don't need that whole script to do that...find . -iname '*.jpg' -exec echo composite -dissolve 40% -gravity SouthEast -quality 100 /path/to/watermark -resize 100 {} {} ;
Replace /path/to/watermark and 100 after -resize with your actual values and if you're happy with the result remove theecho
in front ofcomposite
– don_crissti
Oct 4 '15 at 23:05
hah...yeah, your answer is much better @don_crissti you should put it in as the proper answer
– seumasmac
Oct 4 '15 at 23:12
For some reason it makes my images very small resolution and poor quality. I use thisfind . -iname '*.jpg' -exec composite -dissolve 40% -gravity SouthEast -quality 100 /home/public_html/image/catalog/logo-website/watermark.png -resize 100% {} {} ;
What am I missing?
– Roberto C
Oct 4 '15 at 23:32
add a comment |
I'm trying to do it for ,JPG. I only have .JPG files. I just tried the below command, but it complains about invalid filenames, I think because the folders and sub-folders have names with spaces like "17 inches".WM=$HOME/public_html/image/catalog/logo-website/watermark.png SCALE=100 for f in
find . -iname ".jpg"` do composite -dissolve 40% -gravity SouthEast -quality 100 ( $WM -resize $SCALE% ) "$f" "$f" done exit 0` I get "composite: unable to open image `./17': No such file or directory @ error/blob.c/OpenBlob/2588."
– Roberto C
Oct 4 '15 at 22:53
1
You don't need that whole script to do that...find . -iname '*.jpg' -exec echo composite -dissolve 40% -gravity SouthEast -quality 100 /path/to/watermark -resize 100 {} {} ;
Replace /path/to/watermark and 100 after -resize with your actual values and if you're happy with the result remove theecho
in front ofcomposite
– don_crissti
Oct 4 '15 at 23:05
hah...yeah, your answer is much better @don_crissti you should put it in as the proper answer
– seumasmac
Oct 4 '15 at 23:12
For some reason it makes my images very small resolution and poor quality. I use thisfind . -iname '*.jpg' -exec composite -dissolve 40% -gravity SouthEast -quality 100 /home/public_html/image/catalog/logo-website/watermark.png -resize 100% {} {} ;
What am I missing?
– Roberto C
Oct 4 '15 at 23:32
I'm trying to do it for ,JPG. I only have .JPG files. I just tried the below command, but it complains about invalid filenames, I think because the folders and sub-folders have names with spaces like "17 inches".
WM=$HOME/public_html/image/catalog/logo-website/watermark.png SCALE=100 for f in
find . -iname ".jpg"` do composite -dissolve 40% -gravity SouthEast -quality 100 ( $WM -resize $SCALE% ) "$f" "$f" done exit 0` I get "composite: unable to open image `./17': No such file or directory @ error/blob.c/OpenBlob/2588."– Roberto C
Oct 4 '15 at 22:53
I'm trying to do it for ,JPG. I only have .JPG files. I just tried the below command, but it complains about invalid filenames, I think because the folders and sub-folders have names with spaces like "17 inches".
WM=$HOME/public_html/image/catalog/logo-website/watermark.png SCALE=100 for f in
find . -iname ".jpg"` do composite -dissolve 40% -gravity SouthEast -quality 100 ( $WM -resize $SCALE% ) "$f" "$f" done exit 0` I get "composite: unable to open image `./17': No such file or directory @ error/blob.c/OpenBlob/2588."– Roberto C
Oct 4 '15 at 22:53
1
1
You don't need that whole script to do that...
find . -iname '*.jpg' -exec echo composite -dissolve 40% -gravity SouthEast -quality 100 /path/to/watermark -resize 100 {} {} ;
Replace /path/to/watermark and 100 after -resize with your actual values and if you're happy with the result remove the echo
in front of composite
– don_crissti
Oct 4 '15 at 23:05
You don't need that whole script to do that...
find . -iname '*.jpg' -exec echo composite -dissolve 40% -gravity SouthEast -quality 100 /path/to/watermark -resize 100 {} {} ;
Replace /path/to/watermark and 100 after -resize with your actual values and if you're happy with the result remove the echo
in front of composite
– don_crissti
Oct 4 '15 at 23:05
hah...yeah, your answer is much better @don_crissti you should put it in as the proper answer
– seumasmac
Oct 4 '15 at 23:12
hah...yeah, your answer is much better @don_crissti you should put it in as the proper answer
– seumasmac
Oct 4 '15 at 23:12
For some reason it makes my images very small resolution and poor quality. I use this
find . -iname '*.jpg' -exec composite -dissolve 40% -gravity SouthEast -quality 100 /home/public_html/image/catalog/logo-website/watermark.png -resize 100% {} {} ;
What am I missing?– Roberto C
Oct 4 '15 at 23:32
For some reason it makes my images very small resolution and poor quality. I use this
find . -iname '*.jpg' -exec composite -dissolve 40% -gravity SouthEast -quality 100 /home/public_html/image/catalog/logo-website/watermark.png -resize 100% {} {} ;
What am I missing?– Roberto C
Oct 4 '15 at 23:32
add a comment |
1 Answer
1
active
oldest
votes
The script already checks the directory for image files, but if you want to adjust it to go through all your directories and not prompt you for each one, you might as well just rewrite it. Something like:
#!/bin/bash
WM=$HOME/public_html/image/catalog/logo-website/watermark.png # This is the path to your watermark image
SCALE=100 # This sets the scale % of your watermark image
STARTDIR="/home/whatever/images" # This is the directory to start in
for imagedir in $( find $STARTDIR -type d )
do
echo "Running in $imagedir ..."
cd $imagedir
file -i * | grep image | awk -F':' '{ print $1 }' | while read IMAGE
do
echo "Watermarking $IMAGE"
composite -dissolve 40% -gravity SouthEast -quality 100 ( $WM -resize $SCALE% ) "$IMAGE" "$IMAGE"
done
done
Can someone explain to me why if I run the command in a folder with under 1000 images it works ok, but running it in folder with more than 3000 images, it does nothing, no files are being touched and also no errors. It runs until I ctrc+c the execution.find . -iname '*.jpg' -exec composite -dissolve 40% -gravity SouthEast -quality 100 /home/cauciucurixxl/public_html/image/catalog/logo-website/watermark.png {} {} ;
– Roberto C
Oct 6 '15 at 23:09
You're probably hitting the "maximum length of a command" limit. Try with+
on the end instead of;
– seumasmac
Oct 6 '15 at 23:26
Eventually it ran, but it took a whooping 4 hours to complete.
– Roberto C
Oct 7 '15 at 16:42
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f233910%2frecursively-execute-imagemagick-composite-command-in-directory-tree%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The script already checks the directory for image files, but if you want to adjust it to go through all your directories and not prompt you for each one, you might as well just rewrite it. Something like:
#!/bin/bash
WM=$HOME/public_html/image/catalog/logo-website/watermark.png # This is the path to your watermark image
SCALE=100 # This sets the scale % of your watermark image
STARTDIR="/home/whatever/images" # This is the directory to start in
for imagedir in $( find $STARTDIR -type d )
do
echo "Running in $imagedir ..."
cd $imagedir
file -i * | grep image | awk -F':' '{ print $1 }' | while read IMAGE
do
echo "Watermarking $IMAGE"
composite -dissolve 40% -gravity SouthEast -quality 100 ( $WM -resize $SCALE% ) "$IMAGE" "$IMAGE"
done
done
Can someone explain to me why if I run the command in a folder with under 1000 images it works ok, but running it in folder with more than 3000 images, it does nothing, no files are being touched and also no errors. It runs until I ctrc+c the execution.find . -iname '*.jpg' -exec composite -dissolve 40% -gravity SouthEast -quality 100 /home/cauciucurixxl/public_html/image/catalog/logo-website/watermark.png {} {} ;
– Roberto C
Oct 6 '15 at 23:09
You're probably hitting the "maximum length of a command" limit. Try with+
on the end instead of;
– seumasmac
Oct 6 '15 at 23:26
Eventually it ran, but it took a whooping 4 hours to complete.
– Roberto C
Oct 7 '15 at 16:42
add a comment |
The script already checks the directory for image files, but if you want to adjust it to go through all your directories and not prompt you for each one, you might as well just rewrite it. Something like:
#!/bin/bash
WM=$HOME/public_html/image/catalog/logo-website/watermark.png # This is the path to your watermark image
SCALE=100 # This sets the scale % of your watermark image
STARTDIR="/home/whatever/images" # This is the directory to start in
for imagedir in $( find $STARTDIR -type d )
do
echo "Running in $imagedir ..."
cd $imagedir
file -i * | grep image | awk -F':' '{ print $1 }' | while read IMAGE
do
echo "Watermarking $IMAGE"
composite -dissolve 40% -gravity SouthEast -quality 100 ( $WM -resize $SCALE% ) "$IMAGE" "$IMAGE"
done
done
Can someone explain to me why if I run the command in a folder with under 1000 images it works ok, but running it in folder with more than 3000 images, it does nothing, no files are being touched and also no errors. It runs until I ctrc+c the execution.find . -iname '*.jpg' -exec composite -dissolve 40% -gravity SouthEast -quality 100 /home/cauciucurixxl/public_html/image/catalog/logo-website/watermark.png {} {} ;
– Roberto C
Oct 6 '15 at 23:09
You're probably hitting the "maximum length of a command" limit. Try with+
on the end instead of;
– seumasmac
Oct 6 '15 at 23:26
Eventually it ran, but it took a whooping 4 hours to complete.
– Roberto C
Oct 7 '15 at 16:42
add a comment |
The script already checks the directory for image files, but if you want to adjust it to go through all your directories and not prompt you for each one, you might as well just rewrite it. Something like:
#!/bin/bash
WM=$HOME/public_html/image/catalog/logo-website/watermark.png # This is the path to your watermark image
SCALE=100 # This sets the scale % of your watermark image
STARTDIR="/home/whatever/images" # This is the directory to start in
for imagedir in $( find $STARTDIR -type d )
do
echo "Running in $imagedir ..."
cd $imagedir
file -i * | grep image | awk -F':' '{ print $1 }' | while read IMAGE
do
echo "Watermarking $IMAGE"
composite -dissolve 40% -gravity SouthEast -quality 100 ( $WM -resize $SCALE% ) "$IMAGE" "$IMAGE"
done
done
The script already checks the directory for image files, but if you want to adjust it to go through all your directories and not prompt you for each one, you might as well just rewrite it. Something like:
#!/bin/bash
WM=$HOME/public_html/image/catalog/logo-website/watermark.png # This is the path to your watermark image
SCALE=100 # This sets the scale % of your watermark image
STARTDIR="/home/whatever/images" # This is the directory to start in
for imagedir in $( find $STARTDIR -type d )
do
echo "Running in $imagedir ..."
cd $imagedir
file -i * | grep image | awk -F':' '{ print $1 }' | while read IMAGE
do
echo "Watermarking $IMAGE"
composite -dissolve 40% -gravity SouthEast -quality 100 ( $WM -resize $SCALE% ) "$IMAGE" "$IMAGE"
done
done
answered Oct 4 '15 at 23:01
seumasmacseumasmac
1,393710
1,393710
Can someone explain to me why if I run the command in a folder with under 1000 images it works ok, but running it in folder with more than 3000 images, it does nothing, no files are being touched and also no errors. It runs until I ctrc+c the execution.find . -iname '*.jpg' -exec composite -dissolve 40% -gravity SouthEast -quality 100 /home/cauciucurixxl/public_html/image/catalog/logo-website/watermark.png {} {} ;
– Roberto C
Oct 6 '15 at 23:09
You're probably hitting the "maximum length of a command" limit. Try with+
on the end instead of;
– seumasmac
Oct 6 '15 at 23:26
Eventually it ran, but it took a whooping 4 hours to complete.
– Roberto C
Oct 7 '15 at 16:42
add a comment |
Can someone explain to me why if I run the command in a folder with under 1000 images it works ok, but running it in folder with more than 3000 images, it does nothing, no files are being touched and also no errors. It runs until I ctrc+c the execution.find . -iname '*.jpg' -exec composite -dissolve 40% -gravity SouthEast -quality 100 /home/cauciucurixxl/public_html/image/catalog/logo-website/watermark.png {} {} ;
– Roberto C
Oct 6 '15 at 23:09
You're probably hitting the "maximum length of a command" limit. Try with+
on the end instead of;
– seumasmac
Oct 6 '15 at 23:26
Eventually it ran, but it took a whooping 4 hours to complete.
– Roberto C
Oct 7 '15 at 16:42
Can someone explain to me why if I run the command in a folder with under 1000 images it works ok, but running it in folder with more than 3000 images, it does nothing, no files are being touched and also no errors. It runs until I ctrc+c the execution.
find . -iname '*.jpg' -exec composite -dissolve 40% -gravity SouthEast -quality 100 /home/cauciucurixxl/public_html/image/catalog/logo-website/watermark.png {} {} ;
– Roberto C
Oct 6 '15 at 23:09
Can someone explain to me why if I run the command in a folder with under 1000 images it works ok, but running it in folder with more than 3000 images, it does nothing, no files are being touched and also no errors. It runs until I ctrc+c the execution.
find . -iname '*.jpg' -exec composite -dissolve 40% -gravity SouthEast -quality 100 /home/cauciucurixxl/public_html/image/catalog/logo-website/watermark.png {} {} ;
– Roberto C
Oct 6 '15 at 23:09
You're probably hitting the "maximum length of a command" limit. Try with
+
on the end instead of ;
– seumasmac
Oct 6 '15 at 23:26
You're probably hitting the "maximum length of a command" limit. Try with
+
on the end instead of ;
– seumasmac
Oct 6 '15 at 23:26
Eventually it ran, but it took a whooping 4 hours to complete.
– Roberto C
Oct 7 '15 at 16:42
Eventually it ran, but it took a whooping 4 hours to complete.
– Roberto C
Oct 7 '15 at 16:42
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f233910%2frecursively-execute-imagemagick-composite-command-in-directory-tree%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I'm trying to do it for ,JPG. I only have .JPG files. I just tried the below command, but it complains about invalid filenames, I think because the folders and sub-folders have names with spaces like "17 inches".
WM=$HOME/public_html/image/catalog/logo-website/watermark.png SCALE=100 for f in
find . -iname ".jpg"` do composite -dissolve 40% -gravity SouthEast -quality 100 ( $WM -resize $SCALE% ) "$f" "$f" done exit 0` I get "composite: unable to open image `./17': No such file or directory @ error/blob.c/OpenBlob/2588."– Roberto C
Oct 4 '15 at 22:53
1
You don't need that whole script to do that...
find . -iname '*.jpg' -exec echo composite -dissolve 40% -gravity SouthEast -quality 100 /path/to/watermark -resize 100 {} {} ;
Replace /path/to/watermark and 100 after -resize with your actual values and if you're happy with the result remove theecho
in front ofcomposite
– don_crissti
Oct 4 '15 at 23:05
hah...yeah, your answer is much better @don_crissti you should put it in as the proper answer
– seumasmac
Oct 4 '15 at 23:12
For some reason it makes my images very small resolution and poor quality. I use this
find . -iname '*.jpg' -exec composite -dissolve 40% -gravity SouthEast -quality 100 /home/public_html/image/catalog/logo-website/watermark.png -resize 100% {} {} ;
What am I missing?– Roberto C
Oct 4 '15 at 23:32