com.sksamuel.scrimage

MutableImage

class MutableImage extends Image

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. MutableImage
  2. Image
  3. WritableImageLike
  4. ImageLike
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new MutableImage(awt: BufferedImage)

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. def _draw(target: BufferedImage): Unit

    Definition Classes
    Image
  7. def _fill(color: Color): Image

    Definition Classes
    Image
  8. def _flip(tx: AffineTransform): MutableImage

    Definition Classes
    MutableImageImage
  9. def _mapInPlace(f: (Int, Int, Int) ⇒ Int): Unit

    Definition Classes
    Image
  10. def _rotate(angle: Double): Image

    Definition Classes
    Image
  11. def argb: Array[Array[Int]]

    Returns the ARGB components for all pixels in this image

    Returns the ARGB components for all pixels in this image

    returns

    an array containing ARGB components in that order.

    Definition Classes
    ImageLike
  12. def argb(x: Int, y: Int): Array[Int]

    Returns the ARGB components for the pixel at the given coordinates

    Returns the ARGB components for the pixel at the given coordinates

    x

    the x coordinate of the pixel component to grab

    y

    the y coordinate of the pixel component to grab

    returns

    an array containing ARGB components in that order.

    Definition Classes
    ImageLike
  13. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  14. def autocrop(color: Color): Image

    Crops an image by removing cols and rows that are composed only of a single given color.

    Crops an image by removing cols and rows that are composed only of a single given color.

    Eg, if an image had a 20 pixel border of white at the top, and this method was invoked with Color.White then the image returned would have that 20 pixel border removed.

    This method is useful when images have an abudance of

    color

    the color to match

    returns

    Definition Classes
    Image
  15. def bound(boundedWidth: Int, boundedHeight: Int): Image

    Creates a new image which is this image scaled so that it does not exceed the given bounds.

    Creates a new image which is this image scaled so that it does not exceed the given bounds. The resultant image will retain the aspect ratio.

    Eg, requesting a bound of 200,200 on an image of 300,600 will result in a scale to 100,200.

    Eg2, requesting a bound of 150,200 on an image of 150,50 will result in a scale to 35,50

    Eg3, requesting a bound of 300,300 on an image of 100,150 will result in a scale to 200,300

    boundedWidth

    the maximum width

    boundedHeight

    the maximum height

    returns

    A new image that is the result of the padding

    Definition Classes
    Image
  16. lazy val center: (Int, Int)

    Definition Classes
    ImageLike
  17. def clear(color: Color = Color.WHITE): Image

    Clears all image data to the given color

    Clears all image data to the given color

    Definition Classes
    MutableImageImageImageLike
  18. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. def col(x: Int): Array[Int]

    Definition Classes
    ImageLike
  20. def composite(composite: Composite, applicative: Image): Image

    Apply the given image with this image using the given composite.

    Apply the given image with this image using the given composite. The original image is unchanged.

    composite

    the composite to use. See com.sksamuel.scrimage.Composite.

    applicative

    the image to apply with the composite.

    returns

    A new image with the given image applied using the given composite.

    Definition Classes
    Image
  21. def copy: Image

    Creates a new image with the same data as this image.

    Creates a new image with the same data as this image. Any operations to the copied image will not write back to the original. Images can be copied multiple times as well as copies copied etc.

    returns

    A copy of this image.

    Definition Classes
    ImageImageLike
  22. def count(pixel: Int): Int

    Counts the number of pixels with the given colour.

    Counts the number of pixels with the given colour.

    pixel

    the colour to detect.

    returns

    the number of pixels that matched the colour of the given pixel

    Definition Classes
    ImageLike
  23. def count: Int

    Returns the number of pixels in the image.

    Returns the number of pixels in the image.

    returns

    the number of pixels

    Definition Classes
    ImageLike
  24. def cover(targetWidth: Int, targetHeight: Int, scaleMethod: ScaleMethod = Bicubic, position: Position = Center): Image

    Returns a copy of the canvas with the given dimensions where the original image has been scaled to completely cover the new dimensions whilst retaining the original aspect ratio.

    Returns a copy of the canvas with the given dimensions where the original image has been scaled to completely cover the new dimensions whilst retaining the original aspect ratio.

    If the new dimensions have a different aspect ratio than the old image then the image will be cropped so that it still covers the new area without leaving any background.

    targetWidth

    the target width

    targetHeight

    the target height

    scaleMethod

    the type of scaling method to use. Defaults to Bicubic

    position

    where to position the image inside the new canvas

    returns

    a new Image with the original image scaled to cover the new dimensions

    Definition Classes
    Image
  25. def dimensions: (Int, Int)

    Definition Classes
    ImageLike
  26. def drawPoly(color: Color, points: Seq[Point]): Image

    Definition Classes
    Image
  27. def drawRect(color: Color, x: Int, y: Int, w: Int, h: Int): Image

    Definition Classes
    Image
  28. def drawString(font: Font, color: Color, x: Int, y: Int, text: String): Image

    Definition Classes
    Image
  29. def empty: Image

    Creates an empty Image with the same dimensions of this image.

    Creates an empty Image with the same dimensions of this image.

    returns

    a new Image that is a clone of this image but with uninitialized data

    Definition Classes
    ImageImageLike
  30. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  31. def equals(other: Any): Boolean

    Definition Classes
    ImageImageLike → AnyRef → Any
  32. def exists(pixel: Int): Boolean

    pixel

    the pixel colour to look for.

    returns

    true if there exists at least one pixel that has the given pixels color

    Definition Classes
    ImageLike
  33. def fillPoly(color: Color, points: Seq[Point]): Image

    Definition Classes
    Image
  34. def fillRect(color: Color, x: Int, y: Int, w: Int, h: Int): Image

    Definition Classes
    Image
  35. def filled(color: Color): MutableImage

    Creates a new Image with the same dimensions of this image and with all the pixels initialized to the given color

    Creates a new Image with the same dimensions of this image and with all the pixels initialized to the given color

    returns

    a new Image with the same dimensions as this

    Definition Classes
    MutableImageImage
  36. def filled(color: Int): MutableImage

    Creates a new Image with the same dimensions of this image and with all the pixels initialized to the given color

    Creates a new Image with the same dimensions of this image and with all the pixels initialized to the given color

    returns

    a new Image with the same dimensions as this

    Definition Classes
    MutableImageImage
  37. def filter(filter: Filter): MutableImage

    Creates a copy of this image with the given filter applied.

    Creates a copy of this image with the given filter applied. The original (this) image is unchanged.

    filter

    the filter to apply. See com.sksamuel.scrimage.Filter.

    returns

    A new image with the given filter applied.

    Definition Classes
    MutableImageImageImageLike
  38. def filter(filters: Filter*): Image

    Apply a sequence of filters in sequence.

    Apply a sequence of filters in sequence. This is sugar for image.filter(filter1).filter(filter2)....

    filters

    the sequence filters to apply

    returns

    the result of applying each filter in turn

    Definition Classes
    Image
  39. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  40. def fit(targetWidth: Int, targetHeight: Int, color: Color = java.awt.Color.WHITE, scaleMethod: ScaleMethod = Bicubic, position: Position = Center): Image

    Returns a copy of this image with the given dimensions where the original image has been scaled to fit completely inside the new dimensions whilst retaining the original aspect ratio.

    Returns a copy of this image with the given dimensions where the original image has been scaled to fit completely inside the new dimensions whilst retaining the original aspect ratio.

    targetWidth

    the target width

    targetHeight

    the target height

    color

    the color to use as the "padding" colour should the scaled original not fit exactly inside the new dimensions

    scaleMethod

    the algorithm to use for the scaling operation. See ScaleMethod.

    position

    where to position the image inside the new canvas

    returns

    a new Image with the original image scaled to fit inside

    Definition Classes
    ImageImageLike
  41. def fitToHeight(targetHeight: Int, color: Color = java.awt.Color.WHITE, scaleMethod: ScaleMethod = Bicubic, position: Position = Center): Image

    Definition Classes
    ImageLike
  42. def fitToWidth(targetWidth: Int, color: Color = java.awt.Color.WHITE, scaleMethod: ScaleMethod = Bicubic, position: Position = Center): Image

    Definition Classes
    ImageLike
  43. def flipX: Image

    Flips this image horizontally.

    Flips this image horizontally.

    returns

    The result of flipping this image horizontally.

    Definition Classes
    Image
  44. def flipY: Image

    Flips this image vertically.

    Flips this image vertically.

    returns

    The result of flipping this image vertically.

    Definition Classes
    Image
  45. def forall(f: (Int, Int, Int) ⇒ Boolean): Boolean

    Definition Classes
    ImageLike
  46. def foreach(f: (Int, Int, Int) ⇒ Unit): Unit

    Definition Classes
    ImageLike
  47. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  48. def hashCode(): Int

    Definition Classes
    Image → AnyRef → Any
  49. lazy val height: Int

    Definition Classes
    ImageImageLike
  50. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  51. def map(f: (Int, Int, Int) ⇒ Int): Image

    Maps the pixels of this image into another image by applying the given function to each point.

    Maps the pixels of this image into another image by applying the given function to each point.

    The function accepts three parameters: x,y,p where x and y are the coordinates of the pixel being transformed and p is the current pixel value in ABGR format.

    f

    the function to transform pixel x,y with existing value p into new pixel value p' (p prime)

    returns

    Definition Classes
    ImageImageLike
  52. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  53. final def notify(): Unit

    Definition Classes
    AnyRef
  54. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  55. def pad(size: Int, color: Color = java.awt.Color.WHITE): Image

    Creates a new image which is the result of this image padded with the given number of pixels on each edge.

    Creates a new image which is the result of this image padded with the given number of pixels on each edge.

    Eg, requesting a pad of 30 on an image of 250,300 will result in a new image with a canvas size of 310,360

    size

    the number of pixels to add on each edge

    color

    the background of the padded area.

    returns

    A new image that is the result of the padding

    Definition Classes
    ImageLike
  56. def padTo(targetWidth: Int, targetHeight: Int, color: Color = java.awt.Color.WHITE): Image

    Creates a new image which is the result of this image padded to the canvas size specified.

    Creates a new image which is the result of this image padded to the canvas size specified. If this image is already larger than the specified pad then the sizes of the existing image will be used instead.

    Eg, requesting a pad of 200,200 on an image of 250,300 will result in keeping the 250,300.

    Eg2, requesting a pad of 300,300 on an image of 400,250 will result in the width staying at 400 and the height padded to 300.

    targetWidth

    the size of the output canvas width

    targetHeight

    the size of the output canvas height

    color

    the background of the padded area.

    returns

    A new image that is the result of the padding

    Definition Classes
    ImageImageLike
  57. def patches(patchWidth: Int, patchHeight: Int): IndexedSeq[() ⇒ Image]

    Returns all the patches of a given size in the image, assuming pixel alignment (no subpixel extraction).

    Returns all the patches of a given size in the image, assuming pixel alignment (no subpixel extraction).

    The patches are returned as a sequence of closures.

    Definition Classes
    Image
  58. def pixel(x: Int, y: Int): Int

    Returns the pixel at the given coordinates as a integer in RGB format.

    Returns the pixel at the given coordinates as a integer in RGB format.

    x

    the x coordinate of the pixel to grab

    y

    the y coordinate of the pixel to grab

    returns

    the ARGB value of the pixel

    Definition Classes
    ImageImageLike
  59. def pixel(p: (Int, Int)): Int

    Returns the pixel at the given coordinates as a integer in RGB format.

    Returns the pixel at the given coordinates as a integer in RGB format.

    p

    the pixel as an integer tuple

    returns

    the ARGB value of the pixel

    Definition Classes
    ImageLike
  60. def pixels: Array[Int]

    Returns the pixels of this image represented as an array of Integers.

    Returns the pixels of this image represented as an array of Integers.

    returns

    Definition Classes
    ImageImageLike
  61. def pixels(x: Int, y: Int, w: Int, h: Int): Array[Int]

    Returns a rectangular region within the given boundaries as a single dimensional array of integers.

    Returns a rectangular region within the given boundaries as a single dimensional array of integers.

    Eg, pixels(10, 10, 30, 20) would result in an array of size 600 with the first row of the region in indexes 0,..,29, second row 30,..,59 etc.

    x

    the start x coordinate

    y

    the start y coordinate

    w

    the width of the region

    h

    the height of the region

    returns

    an Array of pixels for the region

    Definition Classes
    ImageLike
  62. lazy val points: Seq[(Int, Int)]

    Definition Classes
    ImageLike
  63. lazy val radius: Int

    Definition Classes
    ImageLike
  64. def ratio: Double

    returns

    Returns the aspect ratio for this image.

    Definition Classes
    ImageLike
  65. def removeTransparency(color: Color): Image

    Definition Classes
    Image
  66. def resize(scaleFactor: Double, position: Position = Center, background: Color = Color.WHITE): Image

    Resize will resize the canvas, it will not scale the image.

    Resize will resize the canvas, it will not scale the image. This is like a "canvas resize" in Photoshop.

    scaleFactor

    the scaleFactor. 1 retains original size. 0.5 is half. 2 double. etc

    position

    where to position the original image after the canvas size change. Defaults to centre.

    background

    the color to use for expande background areas. Defaults to White.

    returns

    a new Image that is the result of resizing the canvas.

    Definition Classes
    ImageLike
  67. def resizeTo(targetWidth: Int, targetHeight: Int, position: Position = Center, background: Color = Color.WHITE): Image

    Resize will resize the canvas, it will not scale the image.

    Resize will resize the canvas, it will not scale the image. This is like a "canvas resize" in Photoshop.

    If the dimensions are smaller than the current canvas size then the image will be cropped.

    The position parameter determines how the original image will be positioned on the new canvas.

    targetWidth

    the target width

    targetHeight

    the target height

    position

    where to position the original image after the canvas size change

    background

    the background color if the canvas was enlarged

    returns

    a new Image that is the result of resizing the canvas.

    Definition Classes
    ImageImageLike
  68. def resizeToHeight(targetHeight: Int, position: Position = Center, background: Color = Color.WHITE): Image

    Resize will resize the canvas, it will not scale the image.

    Resize will resize the canvas, it will not scale the image. This is like a "canvas resize" in Photoshop.

    position

    where to position the original image after the canvas size change

    returns

    a new Image that is the result of resizing the canvas.

    Definition Classes
    ImageLike
  69. def resizeToWidth(targetWidth: Int, position: Position = Center, background: Color = Color.WHITE): Image

    Resize will resize the canvas, it will not scale the image.

    Resize will resize the canvas, it will not scale the image. This is like a "canvas resize" in Photoshop.

    position

    where to position the original image after the canvas size change

    returns

    a new Image that is the result of resizing the canvas.

    Definition Classes
    ImageLike
  70. def rgb: Array[Array[Int]]

    Definition Classes
    ImageLike
  71. def rgb(x: Int, y: Int): Array[Int]

    Definition Classes
    ImageLike
  72. def rotateLeft: Image

    Returns a copy of this image rotated 90 degrees anti-clockwise (counter clockwise to US English speakers).

    Returns a copy of this image rotated 90 degrees anti-clockwise (counter clockwise to US English speakers).

    returns

    Definition Classes
    Image
  73. def rotateRight: Image

    Returns a copy of this image rotated 90 degrees clockwise.

    Returns a copy of this image rotated 90 degrees clockwise.

    returns

    Definition Classes
    Image
  74. def row(y: Int): Array[Int]

    Definition Classes
    ImageLike
  75. def scale(scaleFactor: Double, scaleMethod: ScaleMethod = Bicubic): Image

    Scale will resize the canvas and the image.

    Scale will resize the canvas and the image. This is like a "image resize" in Photoshop.

    scaleFactor

    the target increase or decrease. 1 is the same as original.

    scaleMethod

    the type of scaling method to use.

    returns

    a new Image that is the result of scaling this image

    Definition Classes
    ImageLike
  76. def scaleTo(targetWidth: Int, targetHeight: Int, scaleMethod: ScaleMethod = Bicubic): Image

    Scale will resize both the canvas and the image.

    Scale will resize both the canvas and the image. This is like a "image resize" in Photoshop.

    The size of the scaled instance are taken from the given width and height parameters.

    targetWidth

    the target width

    targetHeight

    the target height

    scaleMethod

    the type of scaling method to use. Defaults to SmoothScale

    returns

    a new Image that is the result of scaling this image

    Definition Classes
    ImageImageLike
  77. def scaleToHeight(targetHeight: Int, scaleMethod: ScaleMethod = Bicubic): Image

    Scale will resize the canvas and scale the image to match.

    Scale will resize the canvas and scale the image to match. This is like a "image resize" in Photoshop.

    This overloaded version of scale will scale the image so that the new image has a height that matches the given targetHeight and the same aspect ratio as the original.

    Eg, an image of 200,300 with a scaleToHeight of 450 will result in a scaled image of 300,450

    targetHeight

    the target height

    scaleMethod

    the type of scaling method to use.

    returns

    a new Image that is the result of scaling this image

    Definition Classes
    ImageLike
  78. def scaleToWidth(targetWidth: Int, scaleMethod: ScaleMethod = Bicubic): Image

    Scale will resize the canvas and scale the image to match.

    Scale will resize the canvas and scale the image to match. This is like a "image resize" in Photoshop.

    This overloaded version of scale will scale the image so that the new image has a width that matches the given targetWidth and the same aspect ratio as the original.

    Eg, an image of 200,300 with a scaleToWidth of 400 will result in a scaled image of 400,600

    targetWidth

    the target width

    scaleMethod

    the type of scaling method to use.

    returns

    a new Image that is the result of scaling this image

    Definition Classes
    ImageLike
  79. def setPixel(x: Int, y: Int, pixel: Int): Unit

  80. def subimage(x: Int, y: Int, w: Int, h: Int): Image

    Returns a new Image that is a subimage or region of the original image.

    Returns a new Image that is a subimage or region of the original image.

    x

    the start x coordinate

    y

    the start y coordinate

    w

    the width of the subimage

    h

    the height of the subimage

    returns

    a new Image that is the subimage

    Definition Classes
    Image
  81. def subpixel(x: Double, y: Double): Int

    Uses linear interpolation to get a sub-pixel.

    Uses linear interpolation to get a sub-pixel.

    Legal values for x and y are in [0, width) and [0, height), respectively.

    Definition Classes
    Image
  82. def subpixelSubimage(x: Double, y: Double, subWidth: Int, subHeight: Int): Image

    Extracts a subimage, but using subpixel interpolation.

    Extracts a subimage, but using subpixel interpolation.

    Definition Classes
    Image
  83. def subpixelSubimageCenteredAtPoint(x: Double, y: Double, xRadius: Double, yRadius: Double): Image

    Extract a patch, centered at a subpixel point.

    Extract a patch, centered at a subpixel point.

    Definition Classes
    Image
  84. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  85. def toAsync(implicit executionContext: ExecutionContext): AsyncImage

    Creates an AsyncImage instance backed by this image.

    Creates an AsyncImage instance backed by this image.

    The returned AsyncImage will contain the same backing array as this image.

    To return back to an image instance use asyncImage.toImage

    returns

    an AsyncImage wrapping this image.

    Definition Classes
    Image
  86. def toBufferedImage: BufferedImage

    Returns the underlying bufferd image.

    Returns the underlying bufferd image. Changes to this buffered image will write back to this image.

    returns

    the underlying buffered image

    Definition Classes
    Image
  87. def toMutable: MutableImage

    Creates a MutableImage instance backed by this image.

    Creates a MutableImage instance backed by this image.

    Note, any changes to the mutable image write back to this Image. If you want a mutable copy then you must first copy this image before invoking this operation.

    returns

    Definition Classes
    Image
  88. def toString(): String

    Definition Classes
    AnyRef → Any
  89. def trim(left: Int, top: Int, right: Int, bottom: Int): Image

    Definition Classes
    Image
  90. def trim(amount: Int): Image

    Removes the given amount of pixels from each edge; like a crop operation.

    Removes the given amount of pixels from each edge; like a crop operation.

    amount

    the number of pixels to trim from each edge

    returns

    a new Image with the dimensions width-trim*2,height-trim*2

    Definition Classes
    Image
  91. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  92. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  93. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  94. def watermark(text: String, fontSize: Int, alpha: Double): Image

    Definition Classes
    Image
  95. def watermark(text: String): Image

    Definition Classes
    Image
  96. lazy val width: Int

    Definition Classes
    ImageImageLike
  97. def write(out: OutputStream, format: Format[_ <: ImageWriter]): Unit

    Definition Classes
    WritableImageLike
  98. def write(out: OutputStream): Unit

    Definition Classes
    WritableImageLike
  99. def write(file: File, format: Format[_ <: ImageWriter]): Unit

    Definition Classes
    WritableImageLike
  100. def write(file: File): Unit

    Definition Classes
    WritableImageLike
  101. def write(path: String, format: Format[_ <: ImageWriter]): Unit

    Definition Classes
    WritableImageLike
  102. def write(path: String): Unit

    Definition Classes
    WritableImageLike
  103. def write(format: Format[_ <: ImageWriter]): Array[Byte]

    Definition Classes
    WritableImageLike
  104. def write: Array[Byte]

    Definition Classes
    WritableImageLike
  105. def writer[T <: ImageWriter](format: Format[T]): T

    Definition Classes
    ImageWritableImageLike

Inherited from Image

Inherited from WritableImageLike

Inherited from ImageLike[Image]

Inherited from AnyRef

Inherited from Any

Ungrouped