The of the
-resize has a
geometry argument with powerful syntax (see below) to express the desired relation of old and new image dimensions.
To resize one dimension to an explicit value, and resize the other dimension by the same factor, keeping the aspect ratio, you can leave out one of the values in the normal format
950x700 specification like this:
950 for specifying width, or
x700 for height.
convert in.jpg -resize x700 out.jpg
should do what you need.
Regarding getting best possible output, the biggest factor should be recompressing the image. If you output an JPEG image, it is compressed in a slightly different way than before, even with the same compression options and the same software (otherwise, it can be a bigger difference).
The defaults for
-resize are really good, unlike in much other software. You should best just leave them alone.
For fine tuning options affecting the filter step of the resize, I disagree with the answer of @peterph, I do not think it would help experimenting with the options
You can break lots of things, while it's hard to tell what changed.
Resizing and filtering in an optimal way involves a lot more math than one could expect, so unless you have a Masters degree in Math, I'd advise not to tweak the resize options. (But note that it may be a good idea elsewhere: I've seen Adobe getting it wrong.)
I assumed that we are talking about photographic pictures, shots taken with a physical camera from the real world.
If it's something else, like line drawing or a 3D graphics scene, the "correct" resizing may not be what you need; There could be special ways to resize for some situations.
Syntax of argument for
-resize geometry, from www.imagemagick.org:
size General description (actual behavior can vary for different options and settings)
scale% Height and width both scaled by specified percentage.
scale-x%xscale-y% Height and width individually scaled by specified percentages. (Only one % symbol needed.)
width Width given, height automagically selected to preserve aspect ratio.
xheight Height given, width automagically selected to preserve aspect ratio.
widthxheight Maximum values of height and width given, aspect ratio preserved.
widthxheight^ Minimum values of width and height given, aspect ratio preserved.
widthxheight! Width and height emphatically given, original aspect ratio ignored.
widthxheight> Shrinks an image with dimension(s) larger than the corresponding width and/or height argument(s).
widthxheight< Enlarges an image with dimension(s) smaller than the corresponding width and/or height argument(s).
area@ Resize image to have specified area in pixels. Aspect ratio is preserved.