I want to create image watermark like Shutterstock. I have tried but not able to replicate it. I tried with the following command. The issue is for me is i not able to add diagonal random text to image as Shutterstock does. I have tried many options with no luck.
infile="zoom.jpg"
ww=$(convert -ping "$infile" -format "%[fx:w-1]" info:)
hh=$(convert -ping "$infile" -format "%[fx:h-1]" info:)
convert "$infile" \
-fill "graya(100%,0.75)" \
-draw "line 0,0 $ww,$hh line $ww,0 0,$hh" -alpha off \
-fill "graya(50%,0.25)" \
tile_aqua_500_text_x_text.jpg
composite -dissolve 35 -gravity center logo.png tile_aqua_500_text_x_text.jpg tile_aqua_500_text_x_text.jpg
convert -background none -size 220x320 xc:none -font DejaVu-Sans-Bold -pointsize 30 \
-gravity North -draw "rotate -22 fill grey text 20,10 'knot9'" \
-gravity West -draw "rotate -27 fill grey text 5,15 '89898989'" \
miff:- |\
composite -dissolve 70 -tile - tile_aqua_500_text_x_text.jpg tile_aqua_500_text_x_text.jpg
width=`identify -format %w tile_aqua_500_text_x_text.jpg`; \
convert -background '#0008' -fill white -gravity center -size ${width}x30 -pointsize 10 -font DejaVu-Sans-Bold\
caption:"\nThis image is Copyrighted by Knot9 \n www.knot9.com | Image Id: 89898989\n" \
tile_aqua_500_text_x_text.jpg +swap -gravity south -composite tile_aqua_500_text_x_text.jpg
My Output is
Requirement is
In ImageMagick, you can do the following. Create a small text image on a transparent background using label:. Rotate it. Pad it to control the spacing. Tile it out to fill the image. Then composite the tiled out image over your background image.
Image:
convert lena.png \
\( -size 100x -background none -fill white -gravity center \
label:"watermark" -trim -rotate -30 \
-bordercolor none -border 10 \
-write mpr:wm +delete \
+clone -fill mpr:wm -draw 'color 0,0 reset' \) \
-compose over -composite \
lena_watermark.png
If using ImageMagick 7, then change convert to magick
See https://imagemagick.org/Usage/canvas/#tile_memory for tiling
Related
I want to convert command below to Magick.Net Code.
convert sunset_lake.png \
\( -background none -pointsize 24 -fill white label:"TESTING" -rotate 20 -write mpr:tile +delete \) \
\( +clone -tile mpr:tile -draw "color 0,0 reset" \) \
-compose over -composite sunset_lake_tile_text.png
I am not sure what is the corresponding code for -write mpr:tile +delete and mpr:tile -draw "color 0,0 reset".
Any help would be appreciated.
With these 3 separates codes I create the following 3 images with desired size for each one. I'm failing in merging in a single command.
This code produces P1.png
convert \( \( -size 426x37 xc:"#4FA7FF" -fill black -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Number 1" \) \
\( -size 426x37 xc:"#4FA7FF" -fill black -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Number 2" \) \
+smush +2 -write P1.png \) null:
P1.png (854x37)
This code produces P2.png
convert \( \( -size 881x488 xc:"#FFE97F" \) \
\( -size 881x488 xc:"#00FF90" \) \
+smush +6 -resize 1180x441! -write P2.png \) null:
P2.png (1180x441)
This code produces P3.png
convert \( \( -size 1104x89! xc:"#00137F" -fill white -font Calibri-Bold -pointsize 48 -gravity center -annotate +0+0 "Different boxes" \) \
-write P3.png \) null:
P3.png (1104x89)
If I join the 3 images in an image editor visually (like Paint.net) the resulting image is of 1180x606 and the resolution is 96 pixels per inch.
How can I join these 3 commands in a single "convert" command in order the final image be of 1180x606 in size?
I've tried with this code, but I don't know how to construct the command correctly
convert \
\( -size 426x37 xc:"#4FA7FF" -fill black -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Number 1" \) \
\( -size 426x37 xc:"#4FA7FF" -fill black -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Number 2" \) \
+smush +2 \
-write mpr:numbers \
\
\(
\( -size 881x488 xc:"#FFE97F" \) \
\( -size 881x488 xc:"#00FF90" \) \
-resize 1180x441! +smush +6 mpr:numbers +swap -gravity center -smush +15 +gravity \
-write mpr:boxes \
-delete 0 \
\
\( -size 1104x89! xc:"#00137F" -fill white -font Calibri-Bold -pointsize 48 -gravity center -annotate +0+0 "Different boxes" \) \
mpr:boxes +swap -gravity center -smush +24 +gravity +write POut.png \) null:
The desired output is like this:
Thanks for any help.
UPDATE
When I see it in an image editor (Paint.net in my case) I can see and change resolution withot change pixel dimentions. Only dimentions of inches change.
Result.png original with Resolution=120 pixel/inch and size 1180x606
Result.png changed to Resolution=96 pixel/inch and size still is 1180x606 but inches dimentions changed
UPDATE 2
fmw42's code works fine creating from scratch 3 images and then merging them. My problem is if I use the same fmw42's script but instead to create
the yellow and green boxes I crop them from another image (source.png) the result.png is not the same. What is the issue when I add the cropped images?
I'm using this code:
convert \
source.png +repage -write mpr:img -delete 0--1 \
\( \
\( -size 1104x89! xc:"#00137F" -fill white -font Calibri-Bold -pointsize 48 -gravity center -annotate +0+0 "Different boxes" \) \
\) \
\
\( \
\( -size 426x37 xc:"#4FA7FF" -fill black -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Number 1" \) \
\( -size 426x37 xc:"#4FA7FF" -fill black -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Number 2" \) \
+smush +2 \
\) \
-smush +24 \
\
\( \
\( mpr:img -crop 881x488+71+376 \) \
\( mpr:img -crop 881x488+992+376 \) \
+smush +6 -resize 1180x441! \
\) \
-smush +15 \
resultX.png
This is source.png
And this is the output that is not correct
Does this do what you want? ImageMagick 6 command could be like the following as one way to do it:
convert \( \( -size 1104x89! xc:"#00137F" -fill white -font Calibri-Bold -pointsize 48 -gravity center -annotate +0+0 "Different boxes" \) \
-write P3.png \) \
\
\( \( -size 426x37 xc:"#4FA7FF" -fill black -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Number 1" \) \
\( -size 426x37 xc:"#4FA7FF" -fill black -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Number 2" \) \
+smush +2 -write P1.png \) \
-smush +24 \
\
\( \( -size 881x488 xc:"#FFE97F" \) \
\( -size 881x488 xc:"#00FF90" \) \
+smush +6 -resize 1180x441! -write P2.png \) \
-smush +15 \
result.png
Note that I may not have used the same font as you.
Please review:
https://imagemagick.org/Usage/basics/#parenthesis
https://imagemagick.org/Usage/layers/#smush
https://imagemagick.org/Usage/files/#write
To answer your Update2 question: You need to resent the gravity with +gravity after you have used it with -gravity center. Also you need to add +repage after your crops.
convert \
source.png +repage -write mpr:img -delete 0--1 \
\( \
\( -size 1104x89! xc:"#00137F" -fill white -font Calibri-Bold -pointsize 48 -gravity center -annotate +0+0 "Different boxes" \) \
\) \
\
\( \
\( -size 426x37 xc:"#4FA7FF" -fill black -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Number 1" \) \
\( -size 426x37 xc:"#4FA7FF" -fill black -font Calibri-Bold -pointsize 32 -gravity center -annotate +0+0 "Number 2" \) \
+smush +2 \
\) \
-smush +24 +gravity \
\
\( \
\( mpr:img -crop 881x488+71+376 +repage \) \
\( mpr:img -crop 881x488+992+376 +repage \) \
+smush +6 -resize 1180x441! \
\) \
-gravity center -smush +15 \
resultX.png
With well considered use of ImageMagick's memory registers, like "mpr:something", you can simplify the construction of your entire image to something like this...
convert -gravity center -background white -font helvetica \
-size 1104x89 xc:"#00137F" -fill white -pointsize 48 \
-annotate +0+0 "Different boxes" -write mpr:diffbox +delete \
-size 426x37 xc:"#4FA7FF" xc:"#4FA7FF" -fill black -pointsize 32 \
-annotate +0+0 "Number %[fx:t+1]" +smush 2 -write mpr:numbox +delete \
-size 588x441 xc:"#FFE97F" xc:"#00FF90" +smush 4 \
mpr:numbox +insert -smush 15 mpr:diffbox +insert -smush 24 result.png
That works for me on Windows Ubuntu bash shell running ImageMagick 6.8.9-9. You'll have to specify your own font, and if you're using the same font for everything you only have to specify it once.
While searching google, we see a lot of images with a text overlay effect that claim these images are coming from shutterstock.com.
This text effect is something like the following:
https://thumb7.shutterstock.com/display_pic_with_logo/4187557/559982074/stock-vector-few-little-houses-in-the-winter-forest-landscape-flat-style-vector-seamless-pattern-559982074.jpg
I am wondering how can I use ImageMagick cli to do something similar?
Thank you very much for any help.
Ideally, you would create a watermark mask with the text effect, and composite over the source image.
Step 1: Create text effect for reuse
convert -pointsize 64 -font GeorgiaB \
-fill black -stroke white -strokewidth 2 \
-background transparent -channel A -evaluate subtract 75% \
caption:"Hello World" mask.png
Step 2: Composite text effect over other images
convert -size 500x400 plasma: mask.png \
-gravity center -compose ATop -composite output.png
There's a lot more examples of text handling & effects, as well as composite techniques over # Anthony's Usage documentation.
There are many ways to add a white area at the bottom with text. This is one. If that is not what you want, then please explain further.
infile="tile_aqua_500.jpg"
ww=$(convert -ping "$infile" -format "%[fx:w-1]" info:)
hh=$(convert -ping "$infile" -format "%[fx:h-1]" info:)
convert "$infile" \
-fill "graya(100%,0.75)" \
-draw "line 0,0 $ww,$hh line $ww,0 0,$hh" -alpha off \
-fill "graya(50%,0.25)" \
-strokewidth 1 -stroke "graya(100%,0.25)" \
-gravity center -font arial -pointsize 48 \
-annotate +0+0 "Hello World" \
-undercolor white -gravity southeast -pointsize 24 \
-fill black -annotate +10+10 "yourdomain.com" \
tile_aqua_500_text_x_text.jpg
Hi fmw42, thank you :) How can I add a big X like shutterstock.com?
Draw two diagonal lines between the corners.
Input (tile_aqua_500.jpg) :
In Imagemagick 6 Unix system:
infile="tile_aqua_500.jpg"
ww=$(convert -ping "$infile" -format "%[fx:w-1]" info:)
hh=$(convert -ping "$infile" -format "%[fx:h-1]" info:)
convert "$infile" \
-fill "graya(100%,0.75)" \
-draw "line 0,0 $ww,$hh line $ww,0 0,$hh" -alpha off \
-fill "graya(50%,0.25)" \
-strokewidth 1 -stroke "graya(100%,0.25)" \
-gravity center -font arial -pointsize 48 \
-annotate +0+0 "Hello World" tile_aqua_500_text_x.jpg
In Imagemagick 7 Unix system:
infile="tile_aqua_500.jpg"
magick "$infile" \
-fill "graya(100%,0.75)" \
-draw "line 0,0 %[fx:w-1],%[fx:h-1] line %[fx:w-1],0 0,%[fx:h-1]" -alpha off \
-fill "graya(50%,0.25)" \
-strokewidth 1 -stroke "graya(100%,0.25)" \
-gravity center -font arial -pointsize 48 \
-annotate +0+0 "Hello World" tile_aqua_500_text_x.jpg
Result of either command:
Here is an alternate method to the excellent one from emcconville using Imagemagick -annotate to draw text directly on an image. I start with a small tillable image that I enlarge to 500x500 in size, before drawing the text with 50% transparency in mid gray and with a 50% transparent white outline. You can change the shades of gray and transparency as desired along with the font and pint-size. Change +0+0 to shift the locations of the text relative to the gravity center. Change -gravity to other compass locations to draw the text relative to those locations.
convert -size 500x500 tile:tile_aqua.jpg \
-fill "graya(50%,0.5)" -strokewidth 1 -stroke "graya(100%,0.5)" \
-gravity center -font arial -pointsize 64 \
-annotate +0+0 "Hello World" result.jpg
convert -size 500x500 tile:tile_aqua.jpg \
-fill "graya(50%,0.25)" -strokewidth 1 -stroke "graya(100%,0.25)" \
-gravity southeast -font arial -pointsize 48 \
-annotate +50+50 "Hello World" result1.jpg
I am new to ImageMagick and I am trying to add 3 different labels to 3 different (small) images, and then insert them over a background image, each being in a corner.
All of the images, and text strings are unknown before-hand and that's why I'm writing a script to handle this. My latest (failed) attempt is:
convert -page +0+0 ${bg}.png \
\( -page +0+0 -gravity south -pointsize 16 \
-stroke '#000C' -strokewidth 4 -annotate 0 "$label" \
-stroke none -strokewidth 20 -fill white -annotate 0 "$label" \) \
\( -page +0+0 ${im1}.png \
-stroke '#000C' -strokewidth 2 -annotate 0 "text1" \
-stroke none -fill white -annotate 0 "text1" \) \
\( -page +${hor_offset}+0 {im2}.png \
-gravity south -pointsize 14 \
-stroke '#000C' -strokewidth 2 -annotate 0 "text2" \
-stroke none -fill white -annotate 0 "text2" \) \
\( -page +0+${ver_offset} ${im3}.png \
-stroke '#000C' -strokewidth 2 -annotate 0 "text3" \
-stroke none -fill white -annotate 0 "text3" \) \
+page -flatten out.png
I have had a better result earlier, but it was mainly by chance and decided to seek an expert's help.
The final result should look something like this: Expected result
-page does not respect -gravity. -page is always relative to the northwest corner (top-left) of the image. You can alternately, use -gravity and -geometry with -composite in pairs. Create one image, then composite over the background in the correct location. The repeat with that result and another image to overlay. See http://www.imagemagick.org/Usage/layers/#convert
Can anyone please help me to generate command for following image?
https://drive.google.com/file/d/0B2vZnIXu1nOweDI1aEJRYTYtSWM/view?pli=1
The command which i tried is as follows.
convert -size 5256.00x2799.00 xc:transparent -gravity Center -font MyriadProRegular.otf ^
-pointsize "83.00" -interword-spacing 30 -stroke none ( ( -size 1x29 xc:"#A89AD7-#9E87BD" ) ( -size 1x30 gradient:"#A581B1-#B16D92" ) ( -size 1x30 gradient:"#C57195-#D47396" ) -append -scale 89x89! -write mpr:grad ) -fill mpr:grad ^
-annotate +1238.00-1092.00 "[Child 5], &" ^ -delete 1 ^
final_result.png
Exact issue i am facing is to get gradient effect in font.
Not too sure what your exact difficulty is, but maybe this wil help you get there in simple steps, each of which can be debugged and improved individually...
First generate your text:
convert -font MyriadPro -pointsize 83 -background none label:"[Child 5], &" text.png
Now generate your blurred gradient:
convert -size 376x29 \
gradient:"#A89AD7-#9E87BD" \
gradient:"#A581B1-#B16D92" \
gradient:"#C57195-#D47396" \
-append -blur 0x10 gradient.png
Now overlay:
convert gradient.png text.png -compose copy-opacity -composite result.png
The blended curve your attempting is closer to interpolation than a stacked series of gradients.
Try using -spare-color, examples here, and experiment with blending each color-stop.
convert -size 100x100 xc: -sparse-color Inverse \
'0,0 #A89AD7 0,15 #9E87BD 0,33 #A581B1 0,66 #B16D92 0,85 #C57195 0,99 #D47396' \
preview.png
convert -size 400x100 xc: \( \
-size 1x100 xc: -sparse-color Inverse \
'0,0 #A89AD7 0,15 #9E87BD 0,33 #A581B1 0,66 #B16D92 0,85 #C57195 0,99 #D47396' \
-write mpr:grad +delete
\) \
-pointsize 63 -interword-spacing 30 \
-stroke none -fill mpr:grad \
-gravity Center -annotate 0 "[Child 5], &" \
final_result.png