This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
OperatorText
text(string_to_write, options = {})
Draw text on the image. Customize size, position, color, dropshadow, and font.
string_to_write
This required argument is the actual string that gets written to the image.
Use the following keys in the options hash:
:alignment
A symbol that tells Fleximage where to put the text. Can be any of the following::center,:top,:top_right,:right,:bottom_right,:bottom,:bottom_left,:left,:top_left.
:offset
The X and Y distance, in"123x456"format, away from the:alignmentanchor. This represents the left edge of the baseline of your text. If the anchor is in the top left, then X and Y move it down and to the right. If in the bottom right, then X and Y and move left and up.
:antialias
By default, the drawn text is antialiased. If you are rendering a small font and do not want antialiasing at all, passfalseto this key.
:color
The color of the drawn text. Like"red"orcolor(255, 0, 0).
:font_size
An integer for the pixel size of the font.
:font
The path to a font file to render your text with. This is relative toRAILS_ROOT
:rotate
You can rotate this text by this many degrees clockwise.
:shadow
This option add a black dropshadow to your text. Pass in a hash like{:blur => 1, :opacity => 1.0}.
:stroke
To add a stroke to your text, pass in a simple hash here. It should have the keys:width(integer in pixels) and:color(string or color object).
Example
@photo.operate do |image|
image.text('I like Cheese',
:alignment => :top_left,
:offset => '300x150',
:antialias => true,
:color => 'pink',
:font_size => 24,
:font => 'path/to/myfont.ttf',
:rotate => -15,
:shadow => {
:blur => 1,
:opacity => 0.5,
},
:stroke => {
:width => 1,
:color => 'black',
}
)
end






