Package com.norconex.commons.lang.img
Class MutableImage
java.lang.Object
com.norconex.commons.lang.img.MutableImage
Holds an image in memory and offers simple ways to do common operations.
- Since:
- 2.0.0
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionMutableImage(@NonNull Image image) MutableImage(@NonNull InputStream imageStream) MutableImage(@NonNull Path imageFile) -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanbooleanstatic MutableImagefromBase64String(String base64Image) Decodes a Base64 image string.longgetArea()intintgetWidth()inthashCode()booleanlargerThan(int width, int height) booleanlargerThan(MutableImage img) booleanlargerThan(Dimension dim) largest(MutableImage img) rotate(double degrees) Rotates this image clockwise by the specified degrees.Rotates this image counterclockwise by 90 degrees.Rotates this image clockwise by 90 degrees.scale(int size) scale(int maxWidth, int maxHeight) scaleFactor(double factor) scaleHeight(int height) scaleHeightFactor(double factor) scaleWidth(int width) scaleWidthFactor(double factor) setResizeQuality(MutableImage.Quality resizeQuality) booleansmallerThan(int width, int height) booleansmallerThan(MutableImage img) booleansmallerThan(Dimension dim) smallest(MutableImage img) stretch(int size) stretch(int width, int height) stretchFactor(double factorWidth, double factorHeight) stretchHeight(int height) stretchHeightFactor(double factor) stretchWidth(int width) stretchWidthFactor(double factor) tallest(MutableImage img) toBase64String(String format) toImage()toInputStream(String format) toString()widest(MutableImage img) voidwrite(@NonNull OutputStream out, @NonNull String format) voidvoid
-
Constructor Details
-
MutableImage
- Throws:
IOException
-
MutableImage
- Throws:
IOException
-
MutableImage
-
-
Method Details
-
getResizeQuality
-
setResizeQuality
-
toImage
-
toBase64String
- Throws:
IOException
-
fromBase64String
Decodes a Base64 image string.- Parameters:
base64Image- Base64 encoded image- Returns:
- a new mutable image or
nullif Base64 image isnull - Throws:
IOException- problem decoding the image- Since:
- 3.0.0
-
toInputStream
- Throws:
IOException
-
write
- Throws:
IOException
-
write
- Throws:
IOException
-
write
public void write(@NonNull @NonNull OutputStream out, @NonNull @NonNull String format) throws IOException - Throws:
IOException
-
getDimension
-
getHeight
public int getHeight() -
getWidth
public int getWidth() -
rotateLeft
Rotates this image counterclockwise by 90 degrees.- Returns:
- this image
-
rotateRight
Rotates this image clockwise by 90 degrees.- Returns:
- this image
-
rotate
Rotates this image clockwise by the specified degrees.- Parameters:
degrees- degrees by which to rotate the image- Returns:
- this image
-
flipHorizontal
-
flipVertical
-
crop
-
stretchWidth
-
stretchHeight
-
stretchWidthFactor
-
stretchHeightFactor
-
stretch
-
stretchFactor
-
stretch
-
stretch
-
scaleWidth
-
scaleHeight
-
scaleWidthFactor
-
scaleHeightFactor
-
scaleFactor
-
scale
-
scale
-
scale
-
largerThan
-
largerThan
-
largerThan
public boolean largerThan(int width, int height) -
largest
-
smallerThan
-
smallerThan
-
smallerThan
public boolean smallerThan(int width, int height) -
smallest
-
tallest
-
widest
-
getArea
public long getArea() -
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-