Multiple JPGs from same buffer from ESP32-CAM

I'm going to start with my desires or goals.

I have a ESP32-CAM (several actually) that I'm using as a cam webserver and taking a photo every 10 minutes. I plan on changing the trigger later.... The photo is simply loading the camera frame buffer into a file. My goal is to have the buffer load into two files, one sxga resolution, the other one a qvga resolution.

Function that saves the picture.

 String savePhoto() {
   String getAll;
   String getBody;
   String tempFilename = timeToFilename();
   String fullFilename = tempFilename+".jpg";
   String fullFilename_thumb = tempFilename+"_thumb.jpg";
   Serial.println(fullFilename);
 
   // Get picture into buffer
   camera_fb_t * fb = NULL;
   fb = esp_camera_fb_get();
   if(!fb) {
     Serial.println("Camera capture failed");
     delay(15000);
     ESP.restart();  // try again maybe
     //return;
   }
   // make the file
   // initialize EEPROM with predefined size
   //EEPROM.begin(EEPROM_SIZE);
   //pictureNumber = EEPROM.read(0) + 1;
 
   // Path where new picture will be saved in SD Card
 
   fs::FS &fs = SD_MMC; 
 
   String path = "/" + fullFilename +"";
   Serial.printf("Picture file name: %s\n", path.c_str());
   File file = fs.open(path.c_str(), FILE_WRITE);
   if(!file){
     Serial.println("Failed to open file in writing mode");
   } else {
     file.write(fb->buf, fb->len); // payload (image), payload length
     Serial.printf("Saved file to path: %s\n", path.c_str());
   //  EEPROM.write(0, pictureNumber);
   //  EEPROM.commit();
   }
   file.close();
   esp_camera_fb_return(fb);
}

I've tried duplicating the file create and write section, and output it to a second file. The problem is I can't figure out how to change the resolution. All I end up with is a second copy of the frame buffer. Same resolution.

The purpose for the second significantly smaller file is so I can send it to a Telegram Bot. Telegram won't take the larger picture size.

But I have the Larger picture being transferred via SFTP to a backend file server, the better resolution is admissible as evidence if necessary, where as a QVGA would not be.

Any help would be appreciated.

Thanks

PS - I did find this
ESP32-cam frame buffer manipulation possible?
And in reading the thread, I think what the requestor was looking for is very different than what I'm looking for.

I think the README for 'esp32_camera' has some useful information:

There doesn't seem to be a way to fetch different image resolutions without re-configuring the camera. You can convert a non-JPEG frame to JPEG with frame2jpg() but it looks like you can only set the JPEG 'Quality', not the dimensions.

That's what I was afraid of.

So my best hope is to create a function that generates a thumbnail picture from the file just created.
ESP32-cam frame buffer manipulation possible? might be useful after all.

looks like I'll need to load the picture into the buffer, do a bilinear interpolation and save a new file. Does this sound right?

Thanks again

Check out the converters that are available in 'img_converters.h'. Perhaps you could use them to process one buffer into several JPG images of the required size / quality.