View Source CImg.Builder (cimg v0.1.9)
Build and excecute image processing sequence. under construction
Link to this section Summary
Functions
Building image processing sequence. It allows to execute mutable operation in this sequence.
Building image processing sequence. This one creates empty image object instead recieving a image.
Create a %Builder{} from jpeg/png format binary. You can create an image from loaded binary of the JPEG/PNG file.
Return %CImg{} converted from %Builder{}. Of course, mutable operations cannot be applied to %CImg{}.
Link to this section Functions
Building image processing sequence. It allows to execute mutable operation in this sequence.
Parameters
- image - %CImg{} or %Builder{} object. if %CImg{} is passed,
builder
duplicates the image object and returns it wrapped with %Builder{}.
Examples
img = CImg.load("sample.jpg")
res = CImg.builder(img)
|> CImg.draw_circle(100, 100, 30, {0, 255, 0}) # draw a circle on the duplicated img.
Building image processing sequence. This one creates empty image object instead recieving a image.
Parameters
- x, y, z, c - image shape.
- val - filling value
Examples
res = CImg.builder(100, 100, 1, 3, 0) # 0 filled color image {100, 100, 1, 3}
|> CImg.draw_circle(100, 100, 30, {0, 255, 0}) # draw a circle on the duplicated img.
Create a %Builder{} from jpeg/png format binary. You can create an image from loaded binary of the JPEG/PNG file.
Parameters
- jpeg_or_png - loaded binary of the image file.
Examples
jpeg = File.read!("sample.jpg")
img = Builder.from_binary(jpeg)
Return %CImg{} converted from %Builder{}. Of course, mutable operations cannot be applied to %CImg{}.
Parameters
- builder - %Builder{} object.
Examples
cimg = CImg.builder(100, 100, 1, 3, 0)
|> CImg.draw_circle(100, 100, 30, {0, 255, 0}) # draw a circle on the duplicated img.
|> CImg.runit()
# cimg is %CImg{} object with a circle drawn on it.