Returns the ARGB components for all pixels in this image
Returns the ARGB components for all pixels in this image
an array containing ARGB components in that order.
Returns the ARGB components for the pixel at the given coordinates
Returns the ARGB components for the pixel at the given coordinates
the x coordinate of the pixel component to grab
the y coordinate of the pixel component to grab
an array containing ARGB components in that order.
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
the color to match
Returns a new image that is scaled to fit the specified bounds while retaining the same aspect ratio as the original image.
Returns a new image that is scaled to fit the specified bounds while retaining the same aspect ratio as the original image. The dimensions of the returned image will be the same as the result of the scaling operation. That is, no extra padding will be added to match the bounded width and height. For an operation that will scale an image as well as add padding to fit the dimensions perfectly, then use fit()
Requesting a bound of 200,200 on an image of 300,600 will result in a scale to 100,200. Eg, the original image will be scaled down to fit the bounds.
Requesting a bound of 150,200 on an image of 150,150 will result in the same image being returned. Eg, the original image cannot be scaled up any further without exceeding the bounds.
Requesting a bound of 300,300 on an image of 100,150 will result in a scale to 200,300.
Requesting a bound of 100,1000 on an image of 50,50 will result in a scale to 100,100.
the maximum width
the maximum height
A new image that is the result of the binding.
Clears all image data to the given color
Clears all image data to the given color
Returns the color at the given coordinates.
Returns the color at the given coordinates.
the RGBColor value of the pixel
Returns a set of the distinct colours used in this image.
Returns a set of the distinct colours used in this image.
the set of distinct Colors
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.
the composite to use. See com.sksamuel.scrimage.Composite.
the image to apply with the composite.
A new image with the given image applied using the given composite.
Returns an image that is no larger than the given width and height.
Returns an image that is no larger than the given width and height.
If the current image is already within the given dimensions then the same image will be returned. If not, then a scaled image, with the same aspect ratio as the original, and with dimensions inside the constraints will be returned.
the maximum width
the maximum height
the constrained image.
Creates a new image with the same data as this image.
Counts the number of pixels with the given colour.
Counts the number of pixels with the given colour.
the colour to detect.
the number of pixels that matched the colour of the given pixel
Returns the number of pixels in the 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.
the target width
the target height
the type of scaling method to use. Defaults to Bicubic
where to position the image inside the new canvas
a new Image with the original image scaled to cover the new dimensions
Creates an empty Image with the same dimensions of this image.
Returns true if a pixel with the given color exists.
Returns true if a pixel with the given color exists.
the pixel colour to look for.
true if there exists at least one pixel that has the given pixels color
Creates a new Image with the same dimensions of this image and with all the pixels initialized by the given color.
Creates a new Image with the same dimensions of this image and with all the pixels initialized by the given color.
a new Image with the same dimensions as this
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.
the filter to apply. See com.sksamuel.scrimage.Filter.
A new image with the given filter applied.
Apply a sequence of filters in sequence.
Apply a sequence of filters in sequence. This is sugar for image.filter(filter1).filter(filter2)....
the sequence filters to apply
the result of applying each filter in turn
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.
the target width
the target height
the color to use as the "padding" colour should the scaled original not fit exactly inside the new dimensions
the algorithm to use for the scaling operation. See ScaleMethod.
where to position the image inside the new canvas
a new Image with the original image scaled to fit inside
Flips this image horizontally.
Flips this image horizontally.
The result of flipping this image horizontally.
Flips this image vertically.
Flips this image vertically.
The result of flipping this image vertically.
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.
the function to transform pixel x,y with existing value p into new pixel value p' (p prime)
Returns a new Image that is the result of overlaying the supplied image over this image The x / y parameters determine where the (0,0) coordinate of the overlay should be placed.
Returns a new Image that is the result of overlaying the supplied image over this image The x / y parameters determine where the (0,0) coordinate of the overlay should be placed.
If the image to render exceeds the boundaries of the source image, then the excess pixels will be ignored.
the image to overlay.
a new Image with the given image overlaid.
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
the number of pixels to add on each edge
the background of the padded area.
A new image that is the result of the padding
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.
the size of the output canvas width
the size of the output canvas height
the background of the padded area.
A new image that is the result of the padding
Creates a new image by adding the given number of columns/rows on left, top, right and bottom.
Creates a new image by adding the given number of columns/rows on left, top, right and bottom.
the number of columns/pixels to add on the left
the number of rows/pixels to add to the top
the number of columns/pixels to add on the right
the number of rows/pixels to add to the bottom
the background of the padded area.
A new image that is the result of the padding operation.
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.
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.
Returns the pixel at the given coordinates as a integer in RGB format.
the pixel as an integer tuple
the ARGB value of the pixel
Returns the pixels of this image represented as an array of Integers.
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.
the start x coordinate
the start y coordinate
the width of the region
the height of the region
an Array of pixels for the region
Returns the aspect ratio for this 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.
the scaleFactor. 1 retains original size. 0.5 is half. 2 double. etc
where to position the original image after the canvas size change. Defaults to centre.
the color to use for expande background areas. Defaults to White.
a new Image that is the result of resizing the canvas.
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.
the target width
the target height
where to position the original image after the canvas size change
the background color if the canvas was enlarged
a new Image that is the result of resizing the canvas.
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.
where to position the original image after the canvas size change
a new Image that is the result of resizing the canvas.
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.
where to position the original image after the canvas size change
a new Image that is the result of resizing the canvas.
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 a copy of this image rotated 90 degrees clockwise.
Scale will resize the canvas and the image.
Scale will resize the canvas and the image. This is like a "image resize" in Photoshop.
the target increase or decrease. 1 is the same as original.
the type of scaling method to use.
a new Image that is the result of scaling this 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.
the target width
the target height
the type of scaling method to use. Defaults to SmoothScale
a new Image that is the result of scaling this 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
the target height
the type of scaling method to use.
a new Image that is the result of scaling this 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
the target width
the type of scaling method to use.
a new Image that is the result of scaling this 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.
the start x coordinate
the start y coordinate
the width of the subimage
the height of the subimage
a new Image that is the subimage
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.
Extracts a subimage, but using subpixel interpolation.
Extracts a subimage, but using subpixel interpolation.
Extract a patch, centered at a subpixel point.
Extract a patch, centered at a subpixel point.
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
an AsyncImage wrapping this image.
Returns the underlying bufferd image.
Returns the underlying bufferd image. Changes to this buffered image will write back to this image.
the underlying buffered image
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 an image that is the result of translating the image while keeping the same view window.
Returns an image that is the result of translating the image while keeping the same view window. Eg, if translating by 10,5 then all pixels will move 10 to the right, and 5 down. This would mean 10 columns and 5 rows of background added to the left and top.
a new Image with this image translated.
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.
the number of pixels to trim from the left
the number of pixels to trim from the top
the number of pixels to trim from the right
the number of pixels to trim from the bottom
a new Image with the dimensions width-trim*2, height-trim*2
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.
the number of pixels to trim from each edge
a new Image with the dimensions width-trim*2, height-trim*2
Returns a new image that is the result of scaling this image but without changing the canvas size.
Returns a new image that is the result of scaling this image but without changing the canvas size.
This can be thought of as zooming in on a camera - the viewpane does not change but the image increases in size with the outer columns/rows being dropped as required.
how much to zoom by
how to apply the scaling method
the zoomed image