I have a photo in JPEG format with resolution 4680x3120. I want to add a white border around this photo, turning it into a 5200x3467 photo (for printing reasons).
Clearly, I am not altering or removing anything from the photo, I am simply adding something. Therefore, in principle this procedure can be lossless. However, if I were to use Paint to add this border, the Saving process of Paint will compress the photo again into the JPEG format, thereby losing information and quality.
Is there a way (some more professional program) to add something to a JPEG photo, like a border, without affecting the original part of the photo, without reducing its quality?




jpegtran's crop function can actually also be used to extend. (Not sure what color the extended borders end up being, though.) – mattdm Mar 16 '15 at 16:42jpegtrancan also extend the image, but it always pads with a hard-coded middle gray, RGB(128,128,128). It does that simply because it's the only easy option, since in DCT coefficient space, you can do it with a simplebzero()call. I tried a wild hack at changing this, which doesn't work, but should give you a sense of the ugliness involved. throws hands up in frustration – Warren Young Mar 16 '15 at 17:43JBLOCK2D arrays, so I'm writing off into memory space I don't own. Feel free to make your own patch, or riff on mine. I think I've chased this rabbit as far down the hole as I care to. – Warren Young Mar 16 '15 at 19:41