When I use HTML5 Canvas' drawImage
function, I need to set imageSmoothingEnabled
to false
, so that enlarged pixels (upscaling) won't blur. However, when reducing the copy (downscaling), some colors appear that weren't present in the original image.
For instance, an upscaled image of Brasília, capital of Brazil. The dark gray represent urban areas. There's only one tone of gray.
Now the same area downscaled (and amplified again, just to make my point clear). As you can see, there are many tones of gray now.
How do I downscale with drawImage
without creating any additional color?