Reputation: 2094
So I'm building simple UI and wanted to add pixel art to it.
I have this image in 20px x 20px, and when I resize it with looking glass or in any software, it just gets pixelated, which is fine:
However, when I add the image with tag and set its width and height like:
<img src={helmetSlot} style={{width: 64, height: 64}}/>
It looks terribly blurry: http://prntscr.com/np1flc
What is the cause of this? How can I prevent that?
SOLVED: Used image-rendering: pixelated; css proeprty to fix it. Never knew about existance of this property
Upvotes: 0
Views: 1295
Reputation: 497
Because you are setting the height and width to be bigger than your source file. Why don't you export your pixel art at a higher resolution and then downres it.
Example: export it at 128px x 128px. Then displaying it at 64 x 64 should be no problem.
Upvotes: 0