Image size formating: What is the best way to do it?

This is not an AI question, but what I want to do is to take an image containing a character and format it to the size that my AI will accept which is 32,32. the problem is that when I use this:

for (int i=0;i<32;i++){
for (int j=0;j<32;j++){
col = img1.get(left + j * scax, top + i * scay);
img2.set(j,i,col);
}
}

The result is that the left side of the image is cut off

Depending on the value of “left” you start reading from img1 not at pos 0 but at pos “left” (e.g. 17).
Set left to 0. :wink:

By the way, did you look at the command resize() in the reference?

Depending on value of scax and scay (3) you also maybe read only
the 3rd or so pixel of the img1. So the resulting image is a very rough copy.

Alternatively, you could average the colors of all pixels in each rectangle between 0,0 and scax,scay and repeat this for all rectangles in img1.
But there must be articles about this.
(see Image scaling - Wikipedia
This article is wrong: Image compression - Wikipedia )

Chrisir