This question does not make much sense, because "extensions" means nothing. First, in fact, there are no file "extension". They were in obsolete file systems, but now the word "extension" is still used, but in a difference sense, just as a part of file name, and is still used to denote "file type". It does not affect any functionality pe se. Secondly, "extension" only suggests some file type, but say little or nothing about actual content. For example, *.TIFF means TIFF container which can use no compression, lossy or lossless compression of different types. So, just forget about "extension". It's probably that you need some lossless algorithm, by I cannot be sure that you really need it, taking into account that with lossy algorithm you can get much smaller size without noticeable loss in visible quality.
Also, "resolution", in contrast to common belief, has nothing to do with the size of the image in pixel. Moreover, resolution, being a part of
metadata does not affect the view of the image on screen, not at all. This is just the suggested default which can be used, for example, to print the image to "default" size in sm or inches.
It's not clear what "to minimal size" may mean. If you mean size of the image file in bytes, it should apparent, that you can reduce the size due to lossless compression, but not much. It's very important to understand that the "near-optimal" algorithm really depends on each individual image: for one, one algorithm with some set of parameters can be used, with different image, a different algorithm and parameter set can be better. You can experiment with different methods and choose the one which gives you better results, perhaps on image-to-image basis.
Please see:
http://en.wikipedia.org/wiki/Lossless_compression[
^],
http://en.wikipedia.org/wiki/Data_compression[
^],
http://en.wikipedia.org/wiki/Lossy_compression[
^],
http://en.wikipedia.org/wiki/Data_compression[
^].
You can experiment with the algorithms listed in the articles referenced above.
—SA