Image resize. Require urgent help!

Require urgent help! What am I doing wrong??
Maths is correct, but…

Overview:
To display a source image (example 15000 X 5000 PX) on 1920 X 1080 destination output. (keeping the correct aspect for destination)

Due to source image being > destination size, am selecting initial random positions from source image, holding the correct aspect ratio to the destination, not exceeding an output > a selected area from source. (I.e magnified) , but scaled / reduced accordingly - keeping the original aspect to destination).
Random areas from source are initially calculated and scaled down accordingly (held in an array - top left, bottom right, so to define an area from source), then displayed to destination accordingly

Issue:
Maths is fine, but something wrong with code.
Will not update selected source outputs to display, unless current window is moved via mouse. (Not updating)

Current Code:
(Please help!!)

PImage img;
PImage newimg;

int sxsize;
int sysize;

int xsize;
int ysize;

int points=100;

int[] x1=new int[points+1];
int[] x2=new int[points+1];
int[] y1=new int[points+1];
int[] y2=new int[points+1];

int xpos;
int ypos;

int distx;
int disty;

int i;

float t1;
float t2;

float aspect;

void setup(){

//fullScreen(1);
size (1920,1080);
noSmooth();
frameRate(25);

img=loadImage("1.jpg"); // use image @ 15000 X 5000 PX
sxsize=img.width;
sysize=img.height;

xsize=1920;
ysize=1080;
aspect=float(xsize)/float(ysize);

// set points
setpoints();

}

void draw(){

// get= x,y start width,height

for (i=1; i<=points; i++) {

xpos=x1[i];
ypos=y1[i];

distx=(x2[i]-x1[i]);
disty=(y2[i]-y1[i]);

newimg=img.get(xpos,ypos,distx,disty); // grab image from 1.jgp @ correct aspect ratio already calculated
newimg.resize(xsize,ysize);

image(newimg,0,0);

}

}

void setpoints(){

for (i=1; i<=points; i++) {  

// set y1,y2 in array points
 
while(true){ // find distance in y> output screen size
t1=int(random(sysize));
t2=int(random(sysize));


if(abs(t1-t2)>ysize){
break;
}
}

// if t1<t2 then OK
y1[i]=int(t1);
y2[i]=int(t2);

if (y1[i]>y2[i]){ // if t1>t2 then swap
y1[i]=int(t2);
y2[i]=int(t1);
} // end if




// set x1,x2 points

float xmaxsize=(y2[i]-y1[i])*aspect; // calc max grab width dependant on aspect ratio based upon y1,y2
t1=int(random(sxsize-xmaxsize)); // select a random area from source image less xmagesize
t2=int(((y2[i]-y1[i])*aspect))+t1; // add aspect amount to t1 so to have bottom right coordinate.

x1[i]=int(t1);
x2[i]=int(t2);

if(x1[i]>x2[i]){
x1[i]=int(t2);
x2[i]=int(t1);
}


}

}

Your draw() function is looping through all 100 images and drawing them on top of each other. The only image you will see is the last one. Rather than using a for() loop in draw(), use

void draw() {
   i = frameCount % points;

  // and then the rest of the code in the body of the for loop

}

Keep in mind that your code will then flash each image for only 1/25 of a second since that is what you have the frameRate set to. Quite possibly it will run slower than that, however, since you are get()ing the subimages separately for every draw() call. If you want to loop through the same 100 subimages repeatedly, it would be faster to make an array of PImages once in setup() and just image() from the array. You’d have to do the math to determine if your video card can store all of those. You might get better performance using P2D.

A much more efficient method would be to use P2D, set your large image as a texture() and then each draw(), render a single full screen quad setting its texture coordinates to part of the image you want to show. That would take no additional memory and would let all the pixel fetching and image scaling happen entirely on the GPU.

This will show random portions of your image that are aspect correct and always greater than your display. I’m assuming here that your large image has a wider aspect than your display as in your example (15000/5000 is greater than 1920/1080), so I start by choosing a random height then set the width to match the display aspect. Then choose x and y that keep the subimage contained within the full image.

Leave your frameRate at the default 60 and you can adjust the variable framesToShow below to keep the image constant for that many frames. I set it to 180 so you’ll see each subimage for 3 seconds.

int framesToShow = 180;
float x = 0, y = 0, w = 0, h = 0;

void draw() {
  if( frameCount % framesToShow == 1 ) {
    h = random( height, img.height );
    w = h * width / height;
    x = random( 0, img.width-w );
    y = random( 0, img.height-h );
  }
  noStroke();
  beginShape();
  texture( img );
  vertex( 0, 0, x, y );
  vertex( width, 0, x+w, y );
  vertex( width, height, x+w, y+h );
  vertex( 0, height, x, y+h );
  endShape(CLOSE);
}