Melib v0.1.11 Melib.Mogrify View Source
图片的基本操作
- layers # OptimizePlus
- delay # 25x100
- loop # 0
- resize # 设置大小
- crop # 裁剪
- colorspace, # 颜色空间
- sample, # 马赛克
- charcoal, # 手绘效果
- contrast, # 饱和度
- blur, # 模糊
- quality, # 图片质量
- strip, # 去掉extif
- flatten, # gif图片转jpg有用
- mosiac,
- "motion-blur", # 运动模糊
- "auto-orient", # 自动方向
- geometry,
- composite, # true/false
- flop, # 水平翻转
- flip, # 垂直翻转
- background, # 设置背景, 透明色:transparent
- gravity, # 坐标系, center, SouthEast, NorthEast
- extent, # 画布大小,300x300
- alpha, # 设置为透明:Set
- trim, # 是否减去白边 true/false,
- border, # 边框
- bordercolor, # 边框颜色,
- sharpen, # 锐化
- shadow, # 阴影
- font, # 参数为设置文字字体,值为字体文件的路径
- fill, # 设置文字颜色
- pointsize # 设置字体大小,单位为像素
Link to this section Summary
Functions
Makes a copy of original image
Creates or saves image
opts:
- x
- y
- text
- gravity
- fill
- pointsize
- font
Extends the image to the specified dimensions
Converts the image to the image format you specify
Sets the gravity of the image
Returns the histogram of the image
Opens image source
Resizes the image with provided geometry
Resize the image to fit within the specified dimensions while retaining the aspect ratio of the original image. If necessary, crop the image in the larger dimension
Resize the image to fit within the specified dimensions while retaining the original aspect ratio. Will only resize the image if it is larger than the specified dimensions. The resulting image may be shorter or narrower than specified in the smaller dimension but will not be larger than the specified values
Saves modified image
Provides detailed information about the image
opts:
- gravity
- geometry
- min_height
- min_width
Link to this section Functions
auto_orient(image) View Source
canvas(image, color) View Source
copy(image) View Source
Makes a copy of original image
create(image, opts \\ []) View Source
Creates or saves image
Uses the convert
command, which accepts both existing images, or image
operators. If you have an existing image, prefer save/2.
Options
:path
- The output path of the image. Defaults to a temporary file.:in_place
- Overwrite the original image, ignoring:path
option. Default false.
create_gif_from(sources, opts \\ []) View Source
custom(image, action, options \\ nil) View Source
dev_null() View Source
draw_text(image, opts \\ []) View Source
opts:
- x
- y
- text
- gravity
- fill
- pointsize
- font
extent(image, params) View Source
Extends the image to the specified dimensions
format(image, format) View Source
Converts the image to the image format you specify
generate_temp_path(postfix \\ "") View Source
gif_thumbnail(image, opts \\ []) View Source
gravity(image, params) View Source
Sets the gravity of the image
histogram(image) View Source
Returns the histogram of the image
Runs ImageMagick's histogram:info:-
command
Results are returned as a list of maps where each map includes keys red, blue, green, hex and count
Example:
iex> open("test/fixtures/rbgw.png") |> histogram [ %{"blue" => 255, "count" => 400, "green" => 0, "hex" => "#0000ff", "red" => 0}, %{"blue" => 0, "count" => 225, "green" => 255, "hex" => "#00ff00", "red" => 0}, %{"blue" => 0, "count" => 525, "green" => 0, "hex" => "#ff0000", "red" => 255}, %{"blue" => 255, "count" => 1350, "green" => 255, "hex" => "#ffffff", "red" => 255} ]
image_operator(image, operator) View Source
normalize_verbose_term(arg) View Source
open(path) View Source
Opens image source
quality(image, quality) View Source
resize(image, params) View Source
Resizes the image with provided geometry
resize_to_fill(image, params) View Source
Resize the image to fit within the specified dimensions while retaining the aspect ratio of the original image. If necessary, crop the image in the larger dimension.
resize_to_limit(image, params) View Source
Resize the image to fit within the specified dimensions while retaining the original aspect ratio. Will only resize the image if it is larger than the specified dimensions. The resulting image may be shorter or narrower than specified in the smaller dimension but will not be larger than the specified values.
save(image, opts \\ []) View Source
Saves modified image
Options
:path
- The output path of the image. Defaults to a temporary file.:in_place
- Overwrite the original image, ignoring:path
option. Default false.
set_background(image, background) View Source
set_delay(image, delay) View Source
set_gif_src(image, gif_src) View Source
set_layers(image, layers) View Source
set_loop(image, loop) View Source
set_path(image, path) View Source
strip(image) View Source
temporary_path_for(image) View Source
verbose(image) View Source
Provides detailed information about the image
watermark(image, watermark, opts \\ []) View Source
opts:
- gravity
- geometry
- min_height
- min_width