diff --git a/README.md b/README.md index b0b18d6f..a85b5ccd 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Documentation can be found at . * **ICC colour profiles** — `Image.ICCProfile` for libvips' built-in profiles (`:srgb`, `:cmyk`, `:p3`) and arbitrary `.icc` files. -* **Image streaming** — open and write directly from `File.Stream`s, Plug `Conn`s, in-memory binaries, and S3 sources. +* **Image streaming** — open and write directly from `File.Stream`s, `Plug.Conn`s, in-memory binaries, and S3 sources. * **Optional integrations** — each is compiled only when its optional dependency is present: @@ -38,7 +38,7 @@ Documentation can be found at . * QR code encoding and decoding via the sibling [`image_qrcode`](https://hex.pm/packages/image_qrcode) package (Nayuki QR-Code-generator + quirc; no `:evision` dependency). - * `Image.k_means` via [Scholar](https://hex.pm/packages/scholar). + * `Image.k_means/2` via [Scholar](https://hex.pm/packages/scholar). * `Image.to_nx/2` / `Image.from_nx/1` via [Nx](https://hex.pm/packages/nx). diff --git a/lib/image.ex b/lib/image.ex index e7fe3abd..ea2cab1d 100644 --- a/lib/image.ex +++ b/lib/image.ex @@ -6,7 +6,7 @@ defmodule Image do `Image` is intended to provide well-documented common image processing functions in an idiomatic Elixir functional style as a layer above the very comprehensive set - of functions in `Vix` and `libvips`. + of functions in Vix and libvips. In a very simple image resizing [benchmark](https://github.com/kipcole9/image/blob/main/bench/image_resize.exs), @@ -143,7 +143,7 @@ defmodule Image do @type pixel :: [number()] | number() @typedoc """ - Representaton of a coordinate in an image. + Representation of a coordinate in an image. The first number is the displacement on the x-axis (starting at 0 from the left) and the @@ -314,7 +314,7 @@ defmodule Image do represent a rectangle (not an arbitrary quadrilateral), The order of points is top_left -> top right -> bottom - right -> bottm left. + right -> bottom left. """ @doc subject: "Guard" @@ -1609,7 +1609,7 @@ defmodule Image do for each known image type. For example: Image.write(image, image_path, minimize_file_size: true, - png: [compress: 60, lossy: true], + png: [compression: 7, lossy: true], jpg: [quality: 70], webp: [quality: 5]) @@ -1627,7 +1627,7 @@ defmodule Image do ### Returns * `{:ok, image}`, or `{:ok, binary}` if the destination is - `:memory`) or `{:ok, conn}` if the destination is a `t:Plug.Connt.t/0` or + `:memory`) or `{:ok, conn}` if the destination is a `t:Plug.Conn.t/0` or * `{:error, reason}` @@ -1788,7 +1788,7 @@ defmodule Image do ### Notes * Due to the nature of the interaction between Req and Vix, error - responses from the embedded `Reg.get/2` are swallowed and a generic + responses from the embedded `Req.get/2` are swallowed and a generic `{:error, %Image.Error{message: "Failed to find loader for the source", reason: "Failed to find loader for the source"}}` may be returned instead. ### Example @@ -2045,12 +2045,12 @@ defmodule Image do * `condition_image` is any image. Typically it is an image formed by the relation operations such as `Image.Math.greater_than/2`. - * `if_image_or_color` is either an `t:Vimage.t/0` or + * `if_image_or_color` is either an `t:Vix.Vips.Image.t/0` or a `t:Image.Pixel.t/0`. If a color is provided then an image is constructed with the same shape as `condition_image` filled with the provided color. - * `else_image_or_color` is either an `t:Vimage.t/0` or + * `else_image_or_color` is either an `t:Vix.Vips.Image.t/0` or a `t:Image.Pixel.t/0`. If a color is provided then an image is constructed with the same shape as `condition_image` filled with the provided color. @@ -2162,12 +2162,12 @@ defmodule Image do * `condition_image` is any image. Typically it is an image formed by the relation operations such as `Image.Math.greater_than/2`. - * `if_image_or_color` is either an `t:Vimage.t/0` or + * `if_image_or_color` is either an `t:Vix.Vips.Image.t/0` or a `t:Image.Pixel.t/0`. If a color is provided then an image is constructed with the same shape as `condition_image` filled with the provided color. - * `else_image_or_color` is either an `t:Vimage.t/0` or + * `else_image_or_color` is either an `t:Vix.Vips.Image.t/0` or a `t:Image.Pixel.t/0`. If a color is provided then an image is constructed with the same shape as `condition_image` filled with the provided color. @@ -2841,7 +2841,7 @@ defmodule Image do guideline, use `0.5` for 4 pixels/mm (display resolution), `1.0` for 12 pixels/mm and `1.5` for 16 pixels/mm (300 dpi == 12 pixels/mm). These figures refer to the image raster, not the half-tone - resolution. The default is `0.5`. + resolution. The default is `1.0`. ### Returns @@ -2957,7 +2957,7 @@ defmodule Image do guideline, use `0.5` for 4 pixels/mm (display resolution), `1.0` for 12 pixels/mm and `1.5` for 16 pixels/mm (300 dpi == 12 pixels/mm). These figures refer to the image raster, not the half-tone - resolution. The default is `0.5`. + resolution. The default is `1.0`. ### Returns @@ -3806,7 +3806,7 @@ defmodule Image do ### Arguments - * `image_list` is a non-empty list of `t:Vimage.t/0` + * `image_list` is a non-empty list of `t:Vix.Vips.Image.t/0` images. * `options` is a keyword list of options. @@ -3909,7 +3909,7 @@ defmodule Image do ### Arguments - * `image_list` is a non-empty list of `t:Vimage.t/0` + * `image_list` is a non-empty list of `t:Vix.Vips.Image.t/0` images. * `options` is a keyword list of options. @@ -4026,12 +4026,12 @@ defmodule Image do image. * `:font` is the name of the font family to be applied. - The default is `Impact`. + The default is `"Impact"`. * `:font_file` is the path name to a font file that will be loaded. The default is `:default` which will load the included - `Impact` font if the font family is `Impact`. If the font family - is not `Impact` and the `:font_file` is `:default` then the + `Impact` font if the font family is `"Impact"`. If the font family + is not `"Impact"` and the `:font_file` is `:default` then the font displayed is resolved by the underlying operating system. If `:font_file` is a string, then it is expected to be a valid font file. If `:font_file` is set to a path then the `:font` option @@ -4113,15 +4113,15 @@ defmodule Image do image. * `:font` is the name of the font family to be applied. - The default is `Impact`. If the font family name is `"Impact"` + The default is `"Impact"`. If the font family name is `"Impact"` then the included `unicode.impact.ttf` font file will also be loaded. This ensures that the `Impact` font is available on all systems. * `:font_file` is the path name to a font file that will be loaded. The default is `:default` which will load the included - `Impact` font if the font family is `Impact`. If the font family - is not `Impact` and the `:font_file` is `:default` then the + `Impact` font if the font family is `"Impact"`. If the font family + is not `"Impact"` and the `:font_file` is `:default` then the font displayed is resolved by the underlying operating system. If `:font_file` is a string, then it is expected to be a valid font file. If `:font_file` is set to a path then the `:font` option @@ -4739,10 +4739,6 @@ defmodule Image do ### Options - * `:centre` is a boolean indicating whether to use - the centre downsampling convention. The default is - `false`. - * `:interpolate` defines which resampling kernel to apply. The options are `:nearest`, `:linear`, `:cubic`, `:mitchell`, `:lanczos2` or `:lanczos3` (the default). @@ -4808,10 +4804,6 @@ defmodule Image do ### Options - * `:centre` is a boolean indicating whether to use - the centre downsampling convention. The default is - `false`. - * `:interpolate` defines which resampling kernel to apply. The options are `:nearest`, `:linear`, `:cubic`, `:mitchell`, `:lanczos2` or `:lanczos3` (the default). @@ -5158,7 +5150,7 @@ defmodule Image do * `image` is any `t:Vix.Vips.Image.t/0`. * `options` is a keyword list of options. The - default is `[shape: :circle, crop: :none, size: #{Image.Options.Avatar.default_avatar_size()}]`. + default is `[shape: :circle, crop: :center, size: #{Image.Options.Avatar.default_avatar_size()}]`. ### Options @@ -5174,7 +5166,7 @@ defmodule Image do format is `:circle` or `:squircle` an appropriate image mask is applied. - * `:crop_focus` is one of `:center`, `:entropy`, + * `:crop` is one of `:center`, `:entropy`, `:attention`, `:low`, `:high`. The default is `:center`. For details see `t:Image.Options.Crop.crop_focus/0`. @@ -5232,7 +5224,7 @@ defmodule Image do * `image` is any `t:Vix.Vips.Image.t/0`. * `options` is a keyword list of options. The - default is `[shape: :circle, crop: :none, size: #{Image.Options.Avatar.default_avatar_size()}]`. + default is `[shape: :circle, crop: :center, size: #{Image.Options.Avatar.default_avatar_size()}]`. ### Options @@ -5248,7 +5240,7 @@ defmodule Image do format is `:circle` or `:squircle` an appropriate image mask is applied. - * `:crop_focus` is one of `:center`, `:entropy`, + * `:crop` is one of `:center`, `:entropy`, `:attention`, `:low`, `:high`. The default is `:center`. For details see `t:Image.Options.Crop.crop_focus/0`. @@ -5299,7 +5291,7 @@ defmodule Image do end # thumbnail/2 takes a size argument but its to establish the - # length of the *maxixum** side. We need the size of the *minimum* + # length of the *maximum* side. We need the size of the *minimum* # size defp calculate_size_from_option(image, size) do @@ -5404,7 +5396,7 @@ defmodule Image do """ # The shenanigans below is to avoid infinite recursion or - # hard-to-explain errors if `Image.map_pages/2` is called with + # hard-to-explain errors if `Image.map_join_pages/2` is called with # `Image.crop/5` as its function argument. @doc subject: "Crop" @@ -6920,7 +6912,7 @@ defmodule Image do ### Flags - A two-entry `Keyword.t` is returned indicating what actions + A two-entry `t:Keyword.t/0` is returned indicating what actions were taken: * `:flip` which is a boolean indicating if the image @@ -7979,7 +7971,7 @@ defmodule Image do # up the full requested angle. # Note that this implementation is a linear interpolation. - # In a future release it may be possible to impleement a quadratic + # In a future release it may be possible to implement a quadratic # curve fit (see https://www.youtube.com/watch?v=vEvbNG-kRyY) # Vertical gradient @@ -8025,7 +8017,7 @@ defmodule Image do end # When creating a linear gradient on an angle we create the linear - # vertical grdient and then rotate it. Since rotation will result in + # vertical gradient and then rotate it. Since rotation will result in # the effective image area being smaller than the original image (and # will also be surrounded by black space pixels) we need to size the # gradient to be that size which, when center cropped, returns a gradient @@ -8157,7 +8149,7 @@ defmodule Image do pixels. * `options` is a keyword list of options. See - `t:Image.Options.RadialrGradient.radial_gradient_option/0`. + `t:Image.Options.RadialGradient.radial_gradient_option/0`. ### Options @@ -8239,7 +8231,7 @@ defmodule Image do pixels. * `options` is a keyword list of options. See - `t:Image.Options.RadialrGradient.radial_gradient_option/0`. + `t:Image.Options.RadialGradient.radial_gradient_option/0`. ### Options @@ -8635,7 +8627,7 @@ defmodule Image do @doc """ Returns the histogram for an image. - The histogram is returned as a `t:Vimage.t/0` + The histogram is returned as a `t:Vix.Vips.Image.t/0` that is a 255 by 1 pixel image with the same numbers of bands as the source image. @@ -10290,7 +10282,7 @@ defmodule Image do end @doc """ - Equalizes the histogram of an imaage. + Equalizes the histogram of an image. Equalization is the process of expanding the tone range of an image by stretching the darkest @@ -10305,7 +10297,7 @@ defmodule Image do * `bands` determines which bands are equalized. The value may be one of: - * `:all` (defaalt) means that all bands are eqalized + * `:all` (default) means that all bands are equalized such that the darkest tones are expanded to black and the lightest tones are expanded to white. @@ -10317,10 +10309,10 @@ defmodule Image do color shifts detected. * `:luminance` means that only the luminance band is - equqlized to fill between 1% and 99% of the tone range. + equalized to fill between 1% and 99% of the tone range. The image is converted to the `:lab` color space, the `l` band is equalized and the image is converted back to - its origianal color space. + its original color space. ### Returns @@ -10439,7 +10431,7 @@ defmodule Image do * `bands` determines which bands are equalized. The value may be one of: - * `:all` (defaalt) means that all bands are eqalized + * `:all` (default) means that all bands are equalized such that the darkest tones are expanded to black and the lightest tones are expanded to white. @@ -10451,10 +10443,10 @@ defmodule Image do color shifts detected. * `:luminance` means that only the luminance band is - equqlized to fill between 1% and 99% of the tone range. + equalized to fill between 1% and 99% of the tone range. The image is converted to the `:lab` color space, the `l` band is equalized and the image is converted back to - its origianal color space. + its original color space. ### Returns @@ -11886,7 +11878,7 @@ defmodule Image do ### Returns - * A single band `t:Vimage.t/0` representing the right hand side + * A single band `t:Vix.Vips.Image.t/0` representing the right hand side (positive numbers) of the logistic curve. ### Notes @@ -12033,7 +12025,7 @@ defmodule Image do It renders the image to memory as a binary (therefore executing a full image pipeline) and then decomposes the binary into a list of lists. - As a result it can consume considerable amounst of memory and time + As a result it can consume considerable amounts of memory and time for anything other than small images. ### Example @@ -12558,7 +12550,7 @@ defmodule Image do ### Arguments - * `image` is any `t:Vimage.t/0` + * `image` is any `t:Vix.Vips.Image.t/0` * `options` is a keyword list of options @@ -12585,7 +12577,7 @@ defmodule Image do ### Note * The image type, `t:Vix.Vips.Image.t/0` stores data in - `{width, height, band}` format. However when the data is conerted + `{width, height, band}` format. However when the data is converted into an `t:Nx.Tensor.t/0` the data is written in `{height, width, band}` format. @@ -12644,7 +12636,7 @@ defmodule Image do ### Arguments - * `image` is any `t:Vimage.t/0` + * `image` is any `t:Vix.Vips.Image.t/0` * `options` is a keyword list of options @@ -12671,7 +12663,7 @@ defmodule Image do ### Note * The image type, `t:Vix.Vips.Image.t/0` stores data in - `{width, height, band}` format. However when the data is conerted + `{width, height, band}` format. However when the data is converted into an `t:Nx.Tensor.t/0` the data is written in `{height, width, band}` format. @@ -12846,7 +12838,7 @@ defmodule Image do ### Arguments - * `image` is any `t:Vimage.t/0` + * `image` is any `t:Vix.Vips.Image.t/0` * `source` is a list of four 2-tuples representing the four corners of the subject-of-interest in `image`. @@ -12936,7 +12928,7 @@ defmodule Image do ### Arguments - * `image` is any `t:Vimage.t/0` + * `image` is any `t:Vix.Vips.Image.t/0` * `source` is a list of four 2-tuples representing the four corners of the subject-of-interest in `image`. @@ -12989,7 +12981,7 @@ defmodule Image do ### Arguments - * `image` is any `t:Vimage.t/0`. + * `image` is any `t:Vix.Vips.Image.t/0`. * `source` is a list of four 2-tuples representing the four corners of the subject-of-interest in `image`. @@ -13080,7 +13072,7 @@ defmodule Image do ### Arguments - * `image` is any `t:Vimage.t/0`. + * `image` is any `t:Vix.Vips.Image.t/0`. * `source` is a list of four 2-tuples representing the four corners of the subject-of-interest in `image`. @@ -13143,7 +13135,7 @@ defmodule Image do ### Arguments - * `image` is any `t:Vimage.t/0`. + * `image` is any `t:Vix.Vips.Image.t/0`. * `source` is a list of 2-tuples representing the source points in `image`. @@ -13255,7 +13247,7 @@ defmodule Image do ### Arguments - * `image` is any `t:Vimage.t/0` + * `image` is any `t:Vix.Vips.Image.t/0` * `source` is a list of four 2-tuples representing the four corners of the subject-of-interest in `image`. @@ -13361,7 +13353,7 @@ defmodule Image do ### Arguments - * `image` is any `t:Vimage.t/0`. + * `image` is any `t:Vix.Vips.Image.t/0`. * `convert_to_bgr` is a boolean indicating if the color order should be converted from `RGB` to `BGR` @@ -13466,7 +13458,7 @@ defmodule Image do ### Arguments - * `image` is any `t:Vimage.t/0`. + * `image` is any `t:Vix.Vips.Image.t/0`. ### Returns @@ -13503,7 +13495,7 @@ defmodule Image do ### Arguments - * `image` is any `t:Vimage.t/0` + * `image` is any `t:Vix.Vips.Image.t/0` * `transform_matrix` is a matrix returned by `Image.transform_matrix/3`. @@ -13591,7 +13583,7 @@ defmodule Image do is `:ae`. The valid metrics are: * [:ae](https://en.wikipedia.org/wiki/Sum_of_absolute_differences) which returns - the absolute nuber of pixels that are different between the two images. + the absolute number of pixels that are different between the two images. The returned value is conformed to the range of the underlying image format. Therefore the returned value is between `0.0` (images appear to be the same) and `1.0` (meaning the images appear completely different). @@ -14841,7 +14833,7 @@ defmodule Image do * `{:ok, list_of_images}` or - * `{:error, reasom}` + * `{:error, reason}` ### Notes diff --git a/lib/image/draw.ex b/lib/image/draw.ex index e9c7acb9..2c89d5a9 100644 --- a/lib/image/draw.ex +++ b/lib/image/draw.ex @@ -38,11 +38,11 @@ defmodule Image.Draw do ### Arguments - * `image` is any `t:Vimage.t/0` or a - `t:MutableImage.t/0` upon which the rectangle - will be drawn. If `image` is a `t:MutableImage.t/0` + * `image` is any `t:Vix.Vips.Image.t/0` or a + `t:Vix.Vips.MutableImage.t/0` upon which the rectangle + will be drawn. If `image` is a `t:Vix.Vips.MutableImage.t/0` it will be mutated directly. If `image` is a - `t:Vimage.t/0` it will be copied to a `t:MutableImage.t/0` + `t:Vix.Vips.Image.t/0` it will be copied to a `t:Vix.Vips.MutableImage.t/0` and then mutated. * `left` is the 0-based offset from the @@ -124,11 +124,11 @@ defmodule Image.Draw do ### Arguments - * `image` is any `t:Vimage.t/0` or a - `t:MutableImage.t/0` upon which the rectangle - will be drawn. If `image` is a `t:MutableImage.t/0` + * `image` is any `t:Vix.Vips.Image.t/0` or a + `t:Vix.Vips.MutableImage.t/0` upon which the rectangle + will be drawn. If `image` is a `t:Vix.Vips.MutableImage.t/0` it will be mutated directly. If `image` is a - `t:Vimage.t/0` it will be copied to a `t:MutableImage.t/0` + `t:Vix.Vips.Image.t/0` it will be copied to a `t:Vix.Vips.MutableImage.t/0` and then mutated. * `left` is the 0-based offset from the @@ -182,11 +182,11 @@ defmodule Image.Draw do ### Arguments - * `image` is any `t:Vimage.t/0` or a - `t:MutableImage.t/0` upon which the rectangle - will be drawn. If `image` is a `t:MutableImage.t/0` + * `image` is any `t:Vix.Vips.Image.t/0` or a + `t:Vix.Vips.MutableImage.t/0` upon which the rectangle + will be drawn. If `image` is a `t:Vix.Vips.MutableImage.t/0` it will be mutated directly. If `image` is a - `t:Vimage.t/0` it will be copied to a `t:MutableImage.t/0` + `t:Vix.Vips.Image.t/0` it will be copied to a `t:Vix.Vips.MutableImage.t/0` and then mutated. * `left` is the 0-based offset from the @@ -309,11 +309,11 @@ defmodule Image.Draw do ### Arguments - * `image` is any `t:Vimage.t/0` or a - `t:MutableImage.t/0` upon which the rectangle - will be drawn. If `image` is a `t:MutableImage.t/0` + * `image` is any `t:Vix.Vips.Image.t/0` or a + `t:Vix.Vips.MutableImage.t/0` upon which the rectangle + will be drawn. If `image` is a `t:Vix.Vips.MutableImage.t/0` it will be mutated directly. If `image` is a - `t:Vimage.t/0` it will be copied to a `t:MutableImage.t/0` + `t:Vix.Vips.Image.t/0` it will be copied to a `t:Vix.Vips.MutableImage.t/0` and then mutated. * `left` is the 0-based offset from the @@ -395,11 +395,11 @@ defmodule Image.Draw do ### Arguments - * `image` is any `t:Vimage.t/0` or a - `t:MutableImage.t/0` upon which the rectangle - will be drawn. If `image` is a `t:MutableImage.t/0` + * `image` is any `t:Vix.Vips.Image.t/0` or a + `t:Vix.Vips.MutableImage.t/0` upon which the rectangle + will be drawn. If `image` is a `t:Vix.Vips.MutableImage.t/0` it will be mutated directly. If `image` is a - `t:Vimage.t/0` it will be copied to a `t:MutableImage.t/0` + `t:Vix.Vips.Image.t/0` it will be copied to a `t:Vix.Vips.MutableImage.t/0` and then mutated. * `cx` is the 0-based offset from the @@ -513,11 +513,11 @@ defmodule Image.Draw do ### Arguments - * `image` is any `t:Vimage.t/0` or a - `t:MutableImage.t/0` upon which the rectangle - will be drawn. If `image` is a `t:MutableImage.t/0` + * `image` is any `t:Vix.Vips.Image.t/0` or a + `t:Vix.Vips.MutableImage.t/0` upon which the rectangle + will be drawn. If `image` is a `t:Vix.Vips.MutableImage.t/0` it will be mutated directly. If `image` is a - `t:Vimage.t/0` it will be copied to a `t:MutableImage.t/0` + `t:Vix.Vips.Image.t/0` it will be copied to a `t:Vix.Vips.MutableImage.t/0` and then mutated. * `cx` is the 0-based offset from the @@ -587,11 +587,11 @@ defmodule Image.Draw do ### Arguments - * `image` is any `t:Vimage.t/0` or a - `t:MutableImage.t/0` upon which the rectangle - will be drawn. If `image` is a `t:MutableImage.t/0` + * `image` is any `t:Vix.Vips.Image.t/0` or a + `t:Vix.Vips.MutableImage.t/0` upon which the rectangle + will be drawn. If `image` is a `t:Vix.Vips.MutableImage.t/0` it will be mutated directly. If `image` is a - `t:Vimage.t/0` it will be copied to a `t:MutableImage.t/0` + `t:Vix.Vips.Image.t/0` it will be copied to a `t:Vix.Vips.MutableImage.t/0` and then mutated. * `x1`, `y1` are the 0-based offsets from the `left` @@ -675,11 +675,11 @@ defmodule Image.Draw do ### Arguments - * `image` is any `t:Vimage.t/0` or a - `t:MutableImage.t/0` upon which the rectangle - will be drawn. If `image` is a `t:MutableImage.t/0` + * `image` is any `t:Vix.Vips.Image.t/0` or a + `t:Vix.Vips.MutableImage.t/0` upon which the rectangle + will be drawn. If `image` is a `t:Vix.Vips.MutableImage.t/0` it will be mutated directly. If `image` is a - `t:Vimage.t/0` it will be copied to a `t:MutableImage.t/0` + `t:Vix.Vips.Image.t/0` it will be copied to a `t:Vix.Vips.MutableImage.t/0` and then mutated. * `x1`, `y1` are the 0-based offsets from the `left` @@ -745,14 +745,14 @@ defmodule Image.Draw do ### Arguments - * `image` is any `t:Vimage.t/0` or a - `t:MutableImage.t/0` upon which the rectangle - will be drawn. If `image` is a `t:MutableImage.t/0` + * `image` is any `t:Vix.Vips.Image.t/0` or a + `t:Vix.Vips.MutableImage.t/0` upon which the rectangle + will be drawn. If `image` is a `t:Vix.Vips.MutableImage.t/0` it will be mutated directly. If `image` is a - `t:Vimage.t/0` it will be copied to a `t:MutableImage.t/0` + `t:Vix.Vips.Image.t/0` it will be copied to a `t:Vix.Vips.MutableImage.t/0` and then mutated. - * `sub_image` is any `t:Vimage.t/0` that + * `sub_image` is any `t:Vix.Vips.Image.t/0` that is drawn on top of `image`. * `left` is the 0-based offset from the @@ -837,14 +837,14 @@ defmodule Image.Draw do ### Arguments - * `image` is any `t:Vimage.t/0` or a - `t:MutableImage.t/0` upon which the rectangle - will be drawn. If `image` is a `t:MutableImage.t/0` + * `image` is any `t:Vix.Vips.Image.t/0` or a + `t:Vix.Vips.MutableImage.t/0` upon which the rectangle + will be drawn. If `image` is a `t:Vix.Vips.MutableImage.t/0` it will be mutated directly. If `image` is a - `t:Vimage.t/0` it will be copied to a `t:MutableImage.t/0` + `t:Vix.Vips.Image.t/0` it will be copied to a `t:Vix.Vips.MutableImage.t/0` and then mutated. - * `sub_image` is any `t:Vimage.t/0` that + * `sub_image` is any `t:Vix.Vips.Image.t/0` that is drawn on top of `image`. * `left` is the 0-based offset from the @@ -919,11 +919,11 @@ defmodule Image.Draw do ### Arguments - * `image` is any `t:Vimage.t/0` or a - `t:MutableImage.t/0` upon which the rectangle - will be drawn. If `image` is a `t:MutableImage.t/0` + * `image` is any `t:Vix.Vips.Image.t/0` or a + `t:Vix.Vips.MutableImage.t/0` upon which the rectangle + will be drawn. If `image` is a `t:Vix.Vips.MutableImage.t/0` it will be mutated directly. If `image` is a - `t:Vimage.t/0` it will be copied to a `t:MutableImage.t/0` + `t:Vix.Vips.Image.t/0` it will be copied to a `t:Vix.Vips.MutableImage.t/0` and then mutated. * `left` is the 0-based offset from the @@ -1013,11 +1013,11 @@ defmodule Image.Draw do ### Arguments - * `image` is any `t:Vimage.t/0` or a - `t:MutableImage.t/0` upon which the rectangle - will be drawn. If `image` is a `t:MutableImage.t/0` + * `image` is any `t:Vix.Vips.Image.t/0` or a + `t:Vix.Vips.MutableImage.t/0` upon which the rectangle + will be drawn. If `image` is a `t:Vix.Vips.MutableImage.t/0` it will be mutated directly. If `image` is a - `t:Vimage.t/0` it will be copied to a `t:MutableImage.t/0` + `t:Vix.Vips.Image.t/0` it will be copied to a `t:Vix.Vips.MutableImage.t/0` and then mutated. * `left` is the 0-based offset from the diff --git a/lib/image/enum/band_format.ex b/lib/image/enum/band_format.ex index 78b65e98..98e15963 100644 --- a/lib/image/enum/band_format.ex +++ b/lib/image/enum/band_format.ex @@ -154,7 +154,7 @@ defmodule Image.BandFormat do ### Arguments - * Any `t:Vimage.t/0` of format in the list + * Any `t:Vix.Vips.Image.t/0` of format in the list returned by `Image.BandFormat.known_band_formats/0`. ### Returns @@ -193,7 +193,7 @@ defmodule Image.BandFormat do ### Arguments - * Any `t:Vimage.t/0` of format in the list + * Any `t:Vix.Vips.Image.t/0` of format in the list returned by `Image.BandFormat.known_band_formats/0`. ### Returns diff --git a/lib/image/histogram.ex b/lib/image/histogram.ex index 009a6485..c1bc8914 100644 --- a/lib/image/histogram.ex +++ b/lib/image/histogram.ex @@ -26,7 +26,7 @@ defmodule Image.Histogram do The histograms generated in this module have red, green, blue and luminance layers and can be returned as either an [svg](https://en.wikipedia.org/wiki/SVG) string or as an - `t:Vimage.t/0`. + `t:Vix.Vips.Image.t/0`. The current implementation does not applying any scale compression or expansion and therefore where the image @@ -390,7 +390,7 @@ defmodule Image.Histogram do end # Here we are expanding the list of 100 - # luminanace values into a list of 256 + # luminance values into a list of 256 # luminance values. Its a bit ad-hoc but # reasonably efficient. diff --git a/lib/image/math.ex b/lib/image/math.ex index eab11115..e3778aa5 100644 --- a/lib/image/math.ex +++ b/lib/image/math.ex @@ -996,10 +996,10 @@ defmodule Image.Math do """ @spec bottom_n(image :: Vimage.t(), n :: non_neg_integer()) :: { - minimim :: float(), - x_max :: non_neg_integer(), - y_max :: non_neg_integer(), - max_coordinates :: [Image.point(), ...] + minimum :: float(), + x_min :: non_neg_integer(), + y_min :: non_neg_integer(), + min_coordinates :: [Image.point(), ...] } def bottom_n(%Vimage{} = image, n \\ 10) when is_integer(n) do diff --git a/lib/image/options/compare.ex b/lib/image/options/compare.ex index 4a7864d9..68ad97fd 100644 --- a/lib/image/options/compare.ex +++ b/lib/image/options/compare.ex @@ -25,7 +25,7 @@ defmodule Image.Options.Compare do @type compare_options :: [compare_option()] - # Ussed by Image.compare/3 and defines the + # Used by Image.compare/3 and defines the # default metric to be used. @default_compare_metric :ae diff --git a/lib/image/options/compose.ex b/lib/image/options/compose.ex index b6fb3e0d..9bd81458 100644 --- a/lib/image/options/compose.ex +++ b/lib/image/options/compose.ex @@ -10,7 +10,7 @@ defmodule Image.Options.Compose do """ @typedoc """ - Image compoositions options + Image composition options """ @type t :: list(composition_option()) diff --git a/lib/image/options/crop.ex b/lib/image/options/crop.ex index 9d565f99..daed414a 100644 --- a/lib/image/options/crop.ex +++ b/lib/image/options/crop.ex @@ -56,7 +56,7 @@ defmodule Image.Options.Crop do # after cropping. Indeed that is already the behaviour for # :center and :attention. - # Note too that we use US English spelling as apposed + # Note too that we use US English spelling as opposed # to the libvips British English spelling. The # assumption being that most developers expect # US English. @@ -74,7 +74,7 @@ defmodule Image.Options.Crop do @inverse_crop Map.values(@crop_map) @doc """ - Validates options to `Iamge.crop/5`. + Validates options to `Image.crop/5`. """ def validate_options(options) do diff --git a/lib/image/options/draw.ex b/lib/image/options/draw.ex index 8cea69a2..09d451a2 100644 --- a/lib/image/options/draw.ex +++ b/lib/image/options/draw.ex @@ -1,7 +1,7 @@ defmodule Image.Options.Draw do @moduledoc """ Options and options validation for the - drawing functionss. + drawing functions. """ diff --git a/lib/image/options/join.ex b/lib/image/options/join.ex index 46beb07c..669f2e46 100644 --- a/lib/image/options/join.ex +++ b/lib/image/options/join.ex @@ -24,11 +24,11 @@ defmodule Image.Options.Join do """ @type join_options :: [join_option()] - # Ussed by Image.join/2 and defines the + # Used by Image.join/2 and defines the # vertical spacing in pixels between images. @default_vertical_spacing 0 - # Ussed by Image.join/2 and defines the + # Used by Image.join/2 and defines the # horizontal spacing in pixels between images. @default_horizontal_spacing 0 @@ -41,7 +41,7 @@ defmodule Image.Options.Join do # Default pixels between images. @default_shim_in_pixels 0 - # Default umber of images across the grid. + # Default number of images across the grid. @default_images_across 1 # Maps from api values to libvips values diff --git a/lib/image/options/open.ex b/lib/image/options/open.ex index 9cbe8cd0..01fbf249 100644 --- a/lib/image/options/open.ex +++ b/lib/image/options/open.ex @@ -68,7 +68,7 @@ defmodule Image.Options.Open do @typedoc """ The file access mode when opening - image files. The default in `:sequential`. + image files. The default is `:random`. """ @type file_access :: :sequential | :random diff --git a/lib/image/options/text.ex b/lib/image/options/text.ex index 01ac6294..aff6caff 100644 --- a/lib/image/options/text.ex +++ b/lib/image/options/text.ex @@ -13,7 +13,7 @@ defmodule Image.Options.Text do | {:dpi, pos_integer()} | {:text_fill_color, Pixel.t()} | {:text_stroke_width, pos_integer()} - | {:font_weigtht, atom()} + | {:font_weight, atom()} | {:background_fill_color, Pixel.t()} | {:background_stroke_color, Pixel.t()} | {:background_stroke_width, pos_integer()} diff --git a/lib/image/options/tone_map.ex b/lib/image/options/tone_map.ex index 3fd1af68..244ec143 100644 --- a/lib/image/options/tone_map.ex +++ b/lib/image/options/tone_map.ex @@ -24,7 +24,7 @@ defmodule Image.Options.ToneCurve do @typedoc """ Range for setting the black point and white point. The range is 0..100 reflecting - the values of L* in the `Lab` colorspace. + the values of L* in the Lab colorspace. """ @type set_point :: 0..100 diff --git a/lib/image/shape.ex b/lib/image/shape.ex index 35205385..9e471d99 100644 --- a/lib/image/shape.ex +++ b/lib/image/shape.ex @@ -62,7 +62,7 @@ defmodule Image.Shape do to draw the rectangle. The default is `1px`. * `:stroke_color` is the color used for the outline - of the rectangle. The default is `:black`. + of the rectangle. The default is `:white`. * `:opacity` is the opacity as a float between `0.0` and `1.0` where `0.0` is completely transparent @@ -82,7 +82,7 @@ defmodule Image.Shape do iex> {:ok, rectangle} = Image.Shape.rect(50, 100, fill_color: :red, stroke_color: :yellow) """ - @doc since: "1.27.0" + @doc since: "0.27.0" @spec rect(width :: pos_integer(), height :: pos_integer(), options :: Keyword.t()) :: {:ok, Vimage.t()} | {:error, Image.error()} @@ -129,7 +129,7 @@ defmodule Image.Shape do to draw the rectangle. The default is `1px`. * `:stroke_color` is the color used for the outline - of the rectangle. The default is `:black`. + of the rectangle. The default is `:white`. * `:opacity` is the opacity as a float between `0.0` and `1.0` where `0.0` is completely transparent @@ -149,7 +149,7 @@ defmodule Image.Shape do iex> rectangle = Image.Shape.rect!(50, 100, fill_color: :red, stroke_color: :yellow) """ - @doc since: "1.27.0" + @doc since: "0.27.0" @spec rect!(width :: pos_integer(), height :: pos_integer(), options :: Keyword.t()) :: Vimage.t() | no_return() @@ -195,7 +195,7 @@ defmodule Image.Shape do to draw the polygon. The default is `1px`. * `:stroke_color` is the color used for the outline - of the polygon. The default is `:black` + of the polygon. The default is `:white` * `:opacity` is the opacity as a float between `0.0` and `1.0` where `0.0` is completely transparent @@ -353,7 +353,7 @@ defmodule Image.Shape do to draw the polygon. The default is `1px`. * `:stroke_color` is the color used for the outline - of the polygon. The default is `:black`. + of the polygon. The default is `:white`. * `:opacity` is the opacity as a float between `0.0` and `1.0` where `0.0` is completely transparent @@ -522,7 +522,7 @@ defmodule Image.Shape do to draw the circle. The default is `1px`. * `:stroke_color` is the color used for the outline - of the circle. The default is `:black`. + of the circle. The default is `:white`. * `:opacity` is the opacity as a float between `0.0` and `1.0` where `0.0` is completely transparent @@ -539,7 +539,7 @@ defmodule Image.Shape do iex> {:ok, circle} = Image.Shape.circle(50, fill_color: :green, stroke_color: :blue) """ - @doc since: "1.38.0" + @doc since: "0.38.0" @spec circle(radius :: pos_integer(), options :: Keyword.t()) :: {:ok, Vimage.t()} | {:error, Image.error()} @@ -586,7 +586,7 @@ defmodule Image.Shape do to draw the circle. The default is `1px`. * `:stroke_color` is the color used for the outline - of the circle. The default is `:black`. + of the circle. The default is `:white`. * `:opacity` is the opacity as a float between `0.0` and `1.0` where `0.0` is completely transparent @@ -603,7 +603,7 @@ defmodule Image.Shape do iex> circle = Image.Shape.circle!(50, fill_color: :green, stroke_color: :blue) """ - @doc since: "1.38.0" + @doc since: "0.38.0" @spec circle!(radius :: pos_integer(), options :: Keyword.t()) :: Vimage.t() | no_return() @@ -635,7 +635,7 @@ defmodule Image.Shape do to draw the ellipse. The default is `1px`. * `:stroke_color` is the color used for the outline - of the ellipse. The default is `:black`. + of the ellipse. The default is `:white`. * `:opacity` is the opacity as a float between `0.0` and `1.0` where `0.0` is completely transparent @@ -652,7 +652,7 @@ defmodule Image.Shape do iex> {:ok, ellipse} = Image.Shape.ellipse(50, 100, fill_color: :green, stroke_color: :none) """ - @doc since: "1.38.0" + @doc since: "0.38.0" @spec ellipse(x_radius :: pos_integer(), y_radius :: pos_integer(), options :: Keyword.t()) :: {:ok, Vimage.t()} | {:error, Image.error()} @@ -704,7 +704,7 @@ defmodule Image.Shape do to draw the rectangle. The default is `1px`. * `:stroke_color` is the color used for the outline - of the polygon. The default is `:black` + of the polygon. The default is `:white` * `:opacity` is the opacity as a float between `0.0` and `1.0` where `0.0` is completely transparent @@ -721,7 +721,7 @@ defmodule Image.Shape do iex> ellipse = Image.Shape.ellipse!(50, 100, fill_color: :green, stroke_color: :none) """ - @doc since: "1.38.0" + @doc since: "0.38.0" @spec ellipse!(x_radius :: pos_integer(), y_radius :: pos_integer(), options :: Keyword.t()) :: Vimage.t() | no_return() @@ -759,7 +759,7 @@ defmodule Image.Shape do to draw the line. The default is `1px`. * `:stroke_color` is the color used for the outline - of the line. The default is `:black`. + of the line. The default is `:white`. * `:opacity` is the opacity as a float between `0.0` and `1.0` where `0.0` is completely transparent @@ -776,7 +776,7 @@ defmodule Image.Shape do iex> {:ok, line} = Image.Shape.line(5, 5, 50, 50, stroke_width: 10, stroke_color: :white) """ - @doc since: "1.38.0" + @doc since: "0.38.0" @spec line( x1 :: pos_integer(), @@ -837,7 +837,7 @@ defmodule Image.Shape do to draw the rectangle. The default is `1px`. * `:stroke_color` is the color used for the outline - of the polygon. The default is `:black` + of the polygon. The default is `:white` * `:opacity` is the opacity as a float between `0.0` and `1.0` where `0.0` is completely transparent @@ -854,7 +854,7 @@ defmodule Image.Shape do iex> line = Image.Shape.line!(5, 5, 50, 50, stroke_width: 10, stroke_color: :white) """ - @doc since: "1.38.0" + @doc since: "0.38.0" @spec line!( x1 :: pos_integer(), diff --git a/lib/image/text.ex b/lib/image/text.ex index 25c8db58..e339a250 100644 --- a/lib/image/text.ex +++ b/lib/image/text.ex @@ -70,7 +70,7 @@ defmodule Image.Text do `:ultrabold`, `:heavy` or an integer between `1` and `1_000`. The default is `:normal` which is equivalent to `400`. - * `:font_file` is a path to any `.ttf` font file. If specfied, + * `:font_file` is a path to any `.ttf` font file. If specified, the `:font` parameter is also required. Note that this option is not supported on MacOS systems. @@ -96,7 +96,7 @@ defmodule Image.Text do The first integer will be used as the padding for the left and right of the image. The second integer will be used for the top and bottom of the image. Another alternative is - to pass a `t:Vimage.t/0` in which case the padding will be derived + to pass a `t:Vix.Vips.Image.t/0` in which case the padding will be derived from the image dimensions such that the background covers the whole of the image. The default is `[0, 0]`. @@ -241,7 +241,7 @@ defmodule Image.Text do * `:font_size` is an integer font size in pixels. The default is `50`. - * `:font_file` is a path to any `.ttf` font file. If specfied, + * `:font_file` is a path to any `.ttf` font file. If specified, the `:font` parameter is also required. Note that this option is not supported on MacOS systems. @@ -271,7 +271,7 @@ defmodule Image.Text do The first integer will be used as the padding for the left and right of the image. The second integer will be used for the top and bottom of the image. Another alternative is - to pass a `t:Vimage.t/0` in which case the padding will be derived + to pass a `t:Vix.Vips.Image.t/0` in which case the padding will be derived from the image dimensions such that the background covers the whole of the image. The default is `[0, 0]`. @@ -537,7 +537,7 @@ defmodule Image.Text do ### Arguments - * `image` is any `t:Vimage.t/0` but is expected + * `image` is any `t:Vix.Vips.Image.t/0` but is expected to be an image generated by `Image.Text.text/2`. * `options` is a `t:Keyword.t/0` list of options. @@ -608,7 +608,7 @@ defmodule Image.Text do ### Arguments - * `image` is any `t:Vimage.t/0` but is expected + * `image` is any `t:Vix.Vips.Image.t/0` but is expected to be an image generated by `Image.Text.text/2`. * `options` is a `t:Keyword.t/0` list of options. @@ -658,7 +658,7 @@ defmodule Image.Text do ### Arguments - * `image` is any `t:Vimage.t/0` but is expected + * `image` is any `t:Vix.Vips.Image.t/0` but is expected to be an image generated by `Image.Text.add_background/2`. * `options` is a `t:Keyword.t/0` list of options. @@ -681,7 +681,7 @@ defmodule Image.Text do The first integer will be used as the padding for the left and right of the image. The second integer will be used for the top and bottom of the image. Another alternative is - to pass a `t:Vimage.t/0` in which case the padding will be derived + to pass a `t:Vix.Vips.Image.t/0` in which case the padding will be derived from the image dimensions such that the background covers the whole of the image. The default is `[0, 0]`. @@ -763,7 +763,7 @@ defmodule Image.Text do ### Arguments - * `image` is any `t:Vimage.t/0` but is expected + * `image` is any `t:Vix.Vips.Image.t/0` but is expected to be an image generated by `Image.Text.add_background/2`. * `options` is a `t:Keyword.t/0` list of options. @@ -786,7 +786,7 @@ defmodule Image.Text do The first integer will be used as the padding for the left and right of the image. The second integer will be used for the top and bottom of the image. Another alternative is - to pass a `t:Vimage.t/0` in which case the padding will be derived + to pass a `t:Vix.Vips.Image.t/0` in which case the padding will be derived from the image dimensions such that the background covers the whole of the image. The default is `[0, 0]`. @@ -835,7 +835,7 @@ defmodule Image.Text do ### Arguments - * `image` is any `t:Vimage.t/0` + * `image` is any `t:Vix.Vips.Image.t/0` * `options` is a `t:Keyword.t/0` list of options @@ -903,7 +903,7 @@ defmodule Image.Text do ### Arguments - * `image` is any `t:Vimage.t/0` + * `image` is any `t:Vix.Vips.Image.t/0` * `options` is a `t:Keyword.t/0` list of options diff --git a/lib/image/yuv.ex b/lib/image/yuv.ex index 1bde027d..2bd77255 100644 --- a/lib/image/yuv.ex +++ b/lib/image/yuv.ex @@ -320,7 +320,7 @@ defmodule Image.YUV do @doc """ Writes an image to a YUV file as raw YUV data. - It is recommeneded, but not required, that the path + It is recommended, but not required, that the path name use a `.yuv` suffix. ### Arguments @@ -374,7 +374,7 @@ defmodule Image.YUV do ### Arguments - * `image` is any `t:Vimage.t/0`. + * `image` is any `t:Vix.Vips.Image.t/0`. * `encoding` is one of `:C444`, `:C422` or `:C420`. @@ -421,7 +421,7 @@ defmodule Image.YUV do ### Arguments - * `image` is any `t:Vimage.t/0` that is in a YUV + * `image` is any `t:Vix.Vips.Image.t/0` that is in a YUV colorspace such as that returned from `Image.YUV.new_from_file/5` or `Image.YUV.new_from_binary/5`. @@ -548,7 +548,7 @@ defmodule Image.YUV do ### Arguments - * `image` is any `t:Vimage.t/0`. + * `image` is any `t:Vix.Vips.Image.t/0`. * `encoding` is one of `:C444`, `:C422` or `:C420`. @@ -607,7 +607,7 @@ defmodule Image.YUV do ### Arguments - * `image` is any `t:Vimage.t/0` that is in a YUV + * `image` is any `t:Vix.Vips.Image.t/0` that is in a YUV colorspace such as that returned from `Image.YUV.new_from_file/5` or `Image.YUV.new_from_binary/5`.