Processingでwidthとheightで大きい方にあわせる
PImage img;
void setup() {
size(800, 300);
img = loadImage("IMG_0266.jpg");
float w, h;
if (img.width>img.height) {
w = (float)width;
h = (float)width/img.width*img.height;
}
else {
w = (float)height/img.height*img.width;
h = (float)height;
}
image(img, 0, 0, w, h);
}