Package com.norconex.commons.lang.img

# Class MutableImage

java.lang.Object
com.norconex.commons.lang.img.MutableImage

public class MutableImage extends Object
Holds an image in memory and offers simple ways to do common operations.

Since:
  2.0.0

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `MutableImage.Quality`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `MutableImage(@NonNull Image image)`
  `MutableImage(@NonNull InputStream imageStream)`
  `MutableImage(@NonNull Path imageFile)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected boolean`
  `canEqual(Object other)`
  `MutableImage`
  `crop(@NonNull Rectangle rectangle)`
  `boolean`
  `equals(Object o)`
  `MutableImage`
  `flipHorizontal()`
  `MutableImage`
  `flipVertical()`
  `static MutableImage`
  `fromBase64String(String base64Image)`
  Decodes a Base64 image string.
  `long`
  `getArea()`
  `Dimension`
  `getDimension()`
  `int`
  `getHeight()`
  `MutableImage.Quality`
  `getResizeQuality()`
  `int`
  `getWidth()`
  `int`
  `hashCode()`
  `boolean`
  `largerThan(int width, int height)`
  `boolean`
  `largerThan(MutableImage img)`
  `boolean`
  `largerThan(Dimension dim)`
  `MutableImage`
  `largest(MutableImage img)`
  `MutableImage`
  `rotate(double degrees)`
  Rotates this image clockwise by the specified degrees.
  `MutableImage`
  `rotateLeft()`
  Rotates this image counterclockwise by 90 degrees.
  `MutableImage`
  `rotateRight()`
  Rotates this image clockwise by 90 degrees.
  `MutableImage`
  `scale(int size)`
  `MutableImage`
  `scale(int maxWidth, int maxHeight)`
  `MutableImage`
  `scale(Dimension maxDimension)`
  `MutableImage`
  `scaleFactor(double factor)`
  `MutableImage`
  `scaleHeight(int height)`
  `MutableImage`
  `scaleHeightFactor(double factor)`
  `MutableImage`
  `scaleWidth(int width)`
  `MutableImage`
  `scaleWidthFactor(double factor)`
  `MutableImage`
  `setResizeQuality(MutableImage.Quality resizeQuality)`
  `boolean`
  `smallerThan(int width, int height)`
  `boolean`
  `smallerThan(MutableImage img)`
  `boolean`
  `smallerThan(Dimension dim)`
  `MutableImage`
  `smallest(MutableImage img)`
  `MutableImage`
  `stretch(int size)`
  `MutableImage`
  `stretch(int width, int height)`
  `MutableImage`
  `stretch(Dimension dimension)`
  `MutableImage`
  `stretchFactor(double factorWidth, double factorHeight)`
  `MutableImage`
  `stretchHeight(int height)`
  `MutableImage`
  `stretchHeightFactor(double factor)`
  `MutableImage`
  `stretchWidth(int width)`
  `MutableImage`
  `stretchWidthFactor(double factor)`
  `MutableImage`
  `tallest(MutableImage img)`
  `String`
  `toBase64String(String format)`
  `BufferedImage`
  `toImage()`
  `InputStream`
  `toInputStream(String format)`
  `String`
  `toString()`
  `MutableImage`
  `widest(MutableImage img)`
  `void`
  `write(@NonNull OutputStream out, @NonNull String format)`
  `void`
  `write(@NonNull Path file)`
  `void`
  `write(@NonNull Path file, String format)`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### MutableImage

    public MutableImage(@NonNull @NonNull Path imageFile) throws IOException
    Throws:
      `IOException`

  - ### MutableImage

    public MutableImage(@NonNull @NonNull InputStream imageStream) throws IOException
    Throws:
      `IOException`

  - ### MutableImage

    public MutableImage(@NonNull @NonNull Image image)

- ## Method Details

  - ### getResizeQuality

    public MutableImage.Quality getResizeQuality()

  - ### setResizeQuality

    public MutableImage setResizeQuality(MutableImage.Quality resizeQuality)

  - ### toImage

    public BufferedImage toImage()

  - ### toBase64String

    public String toBase64String(String format) throws IOException
    Throws:
      `IOException`

  - ### fromBase64String

    public static MutableImage fromBase64String(String base64Image) throws IOException
    Decodes a Base64 image string.
    Parameters:
      `base64Image` - Base64 encoded image
    Returns:
      a new mutable image or `null` if Base64 image is `null`
    Throws:
      `IOException` - problem decoding the image
    Since:
      3.0.0

  - ### toInputStream

    public InputStream toInputStream(String format) throws IOException
    Throws:
      `IOException`

  - ### write

    public void write(@NonNull @NonNull Path file) throws IOException
    Throws:
      `IOException`

  - ### write

    public void write(@NonNull @NonNull Path file, String format) throws IOException
    Throws:
      `IOException`

  - ### write

    public void write(@NonNull @NonNull OutputStream out, @NonNull @NonNull String format) throws IOException
    Throws:
      `IOException`

  - ### getDimension

    public Dimension getDimension()

  - ### getHeight

    public int getHeight()

  - ### getWidth

    public int getWidth()

  - ### rotateLeft

    public MutableImage rotateLeft()
    Rotates this image counterclockwise by 90 degrees.
    Returns:
      this image

  - ### rotateRight

    public MutableImage rotateRight()
    Rotates this image clockwise by 90 degrees.
    Returns:
      this image

  - ### rotate

    public MutableImage rotate(double degrees)
    Rotates this image clockwise by the specified degrees.
    Parameters:
      `degrees` - degrees by which to rotate the image
    Returns:
      this image

  - ### flipHorizontal

    public MutableImage flipHorizontal()

  - ### flipVertical

    public MutableImage flipVertical()

  - ### crop

    public MutableImage crop(@NonNull @NonNull Rectangle rectangle)

  - ### stretchWidth

    public MutableImage stretchWidth(int width)

  - ### stretchHeight

    public MutableImage stretchHeight(int height)

  - ### stretchWidthFactor

    public MutableImage stretchWidthFactor(double factor)

  - ### stretchHeightFactor

    public MutableImage stretchHeightFactor(double factor)

  - ### stretch

    public MutableImage stretch(Dimension dimension)

  - ### stretchFactor

    public MutableImage stretchFactor(double factorWidth, double factorHeight)

  - ### stretch

    public MutableImage stretch(int size)

  - ### stretch

    public MutableImage stretch(int width, int height)

  - ### scaleWidth

    public MutableImage scaleWidth(int width)

  - ### scaleHeight

    public MutableImage scaleHeight(int height)

  - ### scaleWidthFactor

    public MutableImage scaleWidthFactor(double factor)

  - ### scaleHeightFactor

    public MutableImage scaleHeightFactor(double factor)

  - ### scaleFactor

    public MutableImage scaleFactor(double factor)

  - ### scale

    public MutableImage scale(int size)

  - ### scale

    public MutableImage scale(Dimension maxDimension)

  - ### scale

    public MutableImage scale(int maxWidth, int maxHeight)

  - ### largerThan

    public boolean largerThan(MutableImage img)

  - ### largerThan

    public boolean largerThan(Dimension dim)

  - ### largerThan

    public boolean largerThan(int width, int height)

  - ### largest

    public MutableImage largest(MutableImage img)

  - ### smallerThan

    public boolean smallerThan(MutableImage img)

  - ### smallerThan

    public boolean smallerThan(Dimension dim)

  - ### smallerThan

    public boolean smallerThan(int width, int height)

  - ### smallest

    public MutableImage smallest(MutableImage img)

  - ### tallest

    public MutableImage tallest(MutableImage img)

  - ### widest

    public MutableImage widest(MutableImage img)

  - ### getArea

    public long getArea()

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `Object`

  - ### canEqual

    protected boolean canEqual(Object other)

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`