I need to be able to apply watermark on an image, using either text or another image.
Getting it to work with an image was quite straight forward, using the following command:
gm composite -dissolve 15 -tile logo.png image.jpg wmark_tiled.jpg
Now, I also want to be able to use text for watermarking (in other cases). The only thing that I found close to it, is a command from ImageMagick tutorial which is the following :
convert -size 140x80 xc:none -fill grey -gravity NorthWest -draw "text 10,10 'copyrigh text'" -gravity SouthEast -draw "text 5,15 'copyright text'" miff:- | gm composite -tile - image.jpg copyrightImage.jpg
Although its not working in GM, and I would rather avoid using pipe as it causes some headaches managing it from Java.
What I thought I could do, is generate an image from a given text, and then use that image as logo.png is used on my first command. Although I cannot find how to generate an image out of text, all I find is putting text on top of an image.
Ideally I will generate a transparent image with the text, and from what I see modifying font/color etc should be quite flexible.
Any suggestions on how to achieve this, or any better solutions are welcome.
(I added imagemagick tag as the interfaces are often same/similar)
I'm not sure I fully understand your query, so apologies if I've misunderstood, but are you trying to create a transparent image, with some text in the corner? If so, would this not work?
convert -background transparent -fill grey -font Calibri -size 140x80 -pointsize 14 -gravity southeast label:'copyright text' output.png
Obviously adjusting the font, pointsize, output image name etc. That would create the following:
http://oi42.tinypic.com/14j1bvp.jpg
P.S. that was written for ImageMagick. I don't know how GM differs or whether it would still work.
To be able to get the watermark text into the same image I had to use the -annotate parameter.
So Moogle's code snippet would look like this in my case:
convert original_image.jpg -background transparent -fill grey -font Calibri -size 140x80 -pointsize 14 -gravity southeast -annotate +0+0 'copyright text' output.jpg
Related
I have a collection (of variable size) of rectangular images (frames extracted from a source video file with ffmpeg), and am trying to find a way to automatically generate a "filmstrip" at the command line, ideally one in which each image is rotated to give it a perspective, and then partly overlayed with the previous one.
The output would be something like this (with transparent background)
(Note: Numbers in the corner would be a plus...)
I imagine ImageMagick has the tools for this, but so far I've not found any obvious way of achieving this...
Any pointer?
Here's something that worked quite nicely for me:
-virtual-pixel transparent +distort Perspective '0,0 0,0 0,110 0,110 200,0 100,20 200,110 100,80' \
-gravity South -background transparent -splice 0x15 \
-font Arial -pointsize 12 -gravity southwest -annotate +2+0 "%[p]" \
miff:- | \
montage -geometry 100x\>-20+2 -tile x1 -background none - montage_test.png```
![montage](https://i.stack.imgur.com/ezplh.png)
I'm trying to generate an image using Imagemagick to match a preview in the browser, but the text comes out blurry. Does anybody have any suggestions? Attached is an image with the Imagemagick one on top, and browser one on bottom, along with the IM code.
convert -density 288 -resize 25% -background white -fill black -strokewidth 0 -stroke white -font Rubik-Regular.ttf -pointsize 10 -gravity center label:'This is a TEST!' label_arial.gif
You might find it easier to start with caption which automatically sizes the text the best way to fill a given area. So, as your lettering is around 140x36 pixels, you would do:
convert -size 140x36 -gravity center caption:'This is a TEST!' label.gif
I try to overlay two versions of the same text using different fonts (to create text effects like outlines and multi-color letters).
The fonts are defined with identical glyph widths, if I use Photoshop (or any text processing software) to generate the two texts and overlay them, they fit perfectly.
But ImageMagick doesn't seem to care about glyph widths but uses its own positioning system. So the two layers don't fit even if it's only a one-letter-text to be displayed.
What font definitions are used by ImageMagick?
Here my command for displaying a "4":
convert -size 500x500 xc:transparent -antialias -stroke none -pointsize 140 -gravity southwest -fill "#00ff00" -font FontBack.ttf -annotate 0x0+0+0 "4" -fill "#ff0000" -font FontOverlay.ttf -annotate 0x0+0+0 "4" -trim -virtual-pixel Background temp.png
To position the layers with the annotate options won't be a solution, as texts are generated dynamically in an imageprocessor.
Any ideas?
I'm trying to convert a bunch of photos using imagemagick. However, I hadn't figured out how to overlay an image with gradient and write some text on it. I know the text part though:
convert IMG_8408.jpg \
-font URWChanceryMediumI \
-pointsize 250 \
-draw "gravity south
fill black text 0,40 'Some text stuff here'" \
test.jpg
Is there a way to add a white gradient to the bottom? Note, that the image size may vary.
What I have:
What I want:
I picked the colors so that it's clearly visible what I want to achieve
You can achieve desired output with 3 commands:
a. create the upper part of your image (a solid rectangle with your selected background color):
convert -size 640x200 xc:#A02B2B background.jpg
b. create another image containing the text over a gradient:
convert -size 640x110 gradient:#A02B2B-#126B27 -pointsize 25 -draw "gravity south fill black text 0,40 'Some text stuff here'" text.jpg
c. combine the images to obtain the final output:
montage background.jpg text.jpg -tile 1x2 -geometry +0+0 output.jpg
Note: I modified text creation parameters in step 2 to keep the command short, but you can add back your original settings
Use the following command:
magick -size 640x310 -define gradient:vector="0,107 0,0" gradient:"#a02b2b-#126b27" -flip -gravity south -font script-mt-bold -pointsize 48 -annotate +0+24 "Some text stuff here" output.png
I'm learning to use ImageMagick, but I'm having trouble when I try to generate an image like the example below:
And for that, I'm using the following code:
convert original.jpg -size 460x caption:'This is a multiline caption, This is a multiline caption, This is a multiline caption.' result.jpg
This command generated two separate images, one with just the title. Can you help me?
PS: I'm using RubyOnRails with ImageMagick, but you can suggest examples with MiniMagick or Rmagick. Thanks.
This works in php and I can not see why it will not work o RubyOnRails:
convert original.jpg -size 460x -background transparent -fill black -pointsize 40 caption:'This is a multiline caption, This is a multiline caption, This is a multiline caption.' -gravity center -composite result.jpg