
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
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);
- Related Articles
- HTML5 drawImage() method to draw image onto the canvas
- How to draw an Image with drawImage() in HTML5?
- Apply gravity between two or more objects in HTML5 Canvas
- How to center canvas in HTML5?
- How to detect point on canvas after canvas rotation in HTML5
- How to draw an oval in HTML5 canvas?
- How to Draw Graphics using Canvas in HTML5?
- How to save canvas data to file in HTML5?
- How to draw lines using HTML5 Canvas?
- How to use images with HTML5 canvas?
- How to save HTML5 canvas data to file?
- HTML5 Canvas to PNG File
- HTML5 Canvas fit to window
- How to draw large font on HTML5 Canvas?
- How to draw a rectangle on HTML5 Canvas?

Advertisements