Improve image quality after downscaling and cropping

I am using the image.scale() function in my code as follows:
img.scale(x_scale=SCALE, roi=[40,0,height,height], hint=image.AREA)
with height being the original max size of 240
my attempt is to crop the image to 240x240 and downsize it with area interpolation for maximum quality.
the result is a 47x47 pixels image.

Sadly if I compare it to the same sized image that i preprocessed in python on my computer, where i also used area interpolation with the opencv library, the quality of my arduino preprocessed image differs a lot from the one preprocessed on my laptop with python.
For reference, the images i am preprocessing are both taken with the Nicla Vision Camera, therefore originally the same resolution.

Is there a way to further improve the quality of the downsized image?

Thanks in advance for any advice.

Hi, can you post both output images and the source image.

We use a fractional area scaling algorithm to downscale an image that’s not a multiple of the image size. It should produce pretty decent images. 47x47 pixels though doesn’t really leave a lot of room for quality though in general.

Hi, sure.
image_cropped
This is the cropped image, in 36x36. I sadly don’t have 47x47 on my laptop right now but the issue is the same.

(I am new to this forum so i am limited to one image per post)

This is the original image:

As comparison this is the image i got with the same preprocessing strategy in python with the cv2 library:
scaled_image
At the same time the files also differ in memory size, which seems legit when looking at the quality.

Hi, from the looks of it our scaling algorithm does exactly what is requested.

The comparison image you posted is from a different source image (the gauge dial and lighting are different).

Regarding the file size, you need to save the image as a bmp file, not jpeg. The files should be the same size then and you can fairly compare the quality.

Hey,
The images are the same, in the python preprocessing I am applying a mask to the background, and flips the image.

But thanks to the tip with saving it in bmp, I’ll check the quality with the new format.