sksamuel/scrimage

Autocrop not working properly when on small images

QazCetelic opened this issue · 2 comments

I was trying to learn how this library worked and noticed that the autocrop feature only removes half of the padding.

val resources = File("${System.getProperty("user.dir")}/src/main/resources")
val pngFile = resources.resolve("image.png")
val newPngFile = resources.resolve("new_image.png")
newPngFile.delete()

val pngImage: ImmutableImage = ImmutableImage.loader().fromFile(pngFile).autocrop()
pngImage.output(PngWriter.NoCompression, newPngFile)

image.png
image
new_image.png
new_image

It does work when specifying colors. .autocrop(Color.BLACK)

Thanks for the bug report. Fixed in 4.0.23 !