Task: Resize an image and add a frame to it so the final size fits 1024x768.
Solution: As adding a frame to an image increases its size this task requires some advance planning to be completed successfully. You should first decide on the type of the frame you are adding (single or double) and border width you will use for it. If, for example, you will have a single frame with border width of 10 pixels then it will increase both horizontal and vertical sizes of the image by 20 pixels (the value is doubled because a frame goes all around an image). Therefore, before adding a frame you should have your image resized to 1004x748 pixels.
At this point things get a little bit more complicated. Say the original image size is 3456x2304 pixels. Resizing it to 1004x748 pixels will have two outcomes depending on the state of "Keep aspect ratio" option. If that option is enabled the resized image will be 1004x669 pixels, not the expected 1004x748. That happened because we told the program to keep the image's aspect, i.e. image's original 3:2 proportion, and proportion in 1004x748 is different. If you now proceed as planned and add a 10 pixels frame to the resized image you will get 1024x689 image as the end result, somewhat short of targeted 1024x768.
Of course, you can disable "Keep aspect ratio" option and get the original image resized to 1004x748 pixels exactly, which further leads to 1024x768 end result you wanted, but bear in mind that resizing without "Keep aspect ratio" option results in image distorsion when target size is not in the same proportion as the original. In some cases that will be acceptable, in some not and you will have to make a decision which way to go on a case by case basis.