I must admit this baffles me a little. Width and heights are measured in pixels.
The number of pixels of an image is width x height (eg a raw image 256x256 means it has 256*256 = 65.536 pixels = 262.144 bytes - if RGBA8). I cannot reduce its pixels and keep the same width and height or viceversa.
I can
a) reduce the quality of an image with a lossy compression (in download if you select jpg you can reduce the quality which will in turn reduce the file size)
b) scale an image when displayed in a browser (canvas.style.width > canvas.width) but the underlying image will still be canvas.width
Apologies, by dimensions, I did mean aspect ratio. All I mean is keep the same image, but reduce the number of pixels, and lose some clarity, to reduce the size of the file.
Your suggestion above doesn't work. Try it. It keeps the picture aspect ratio, but it crops the picture. I don't want to crop it, I want to shrink the number of pixels but keep the same image (with loss of clarity because reducing pixels).
MS Paint, Resize/Skew option. Ctrl-W is the hotkey.
It allows you to resize either in terms of pixel count or percentage. The percentage approach is very nice for just putting 50 in both horizontal and vertical fields and getting an image half as large in both dimensions, but showing the same image (with reduced quality, because fewer pixels) and at the same aspect ratio.
Maybe I'm missing something