
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to apply antialiasing in HTML5 canvas drawImage()?
For antialiasing, you need to set resampling quality.
ctx.imageSmoothingQuality = "low|medium|high"
Use an off-screen canvas to reduce the image to half −
var c = document.createElement('canvas'), ocx = c.getContext('2d'); c.width = img.width * 0.5; c.height = img.height * 0.5; ocxx.drawImage(img, 0, 0, c.width, c.height);
// drawing images reducing to half again and repeating it
ocx.drawImage(c, 0, 0, c.width * 0.5, cc.height * 0.5);
Advertisements