Skip to content

Commit

Permalink
Do not create an image copy in Resize if the output size is the same …
Browse files Browse the repository at this point in the history
…as the input size
  • Loading branch information
juliabeliaeva committed Dec 19, 2022
1 parent cbc37a3 commit 218fa2f
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public class Resize(
public var enableAntialiasing: Boolean = true
) : Operation<BufferedImage, BufferedImage> {
override fun apply(input: BufferedImage): BufferedImage {
if (input.width == outputWidth && input.height == outputHeight) return input;

val resizedImage = BufferedImage(outputWidth, outputHeight, input.type)
val graphics2D = resizedImage.createGraphics()

Expand Down

0 comments on commit 218fa2f

Please sign in to comment.