Skip to content

How to pixelate images, without resize (Nearest Neighbour) #7660

Answered by nulano
Intenzi asked this question in Q&A
Discussion options

You must be logged in to vote

When a browser is displaying an image, it first calculates the size that is required to fill the HTML image tag. Usually this is the same as the image size, but it can be different (e.g. in Discord).

If the image size is different that the size of the HTML image tag, the browser has to resize the image to display it.
The CSS tag is simply telling the browser which scaling method to use instead of the default.

So you cannot change the default scaling method with any image editor, you can only do it by changing the CSS.


The workaround you found with upscaling the image before adding it to a page works by changing how much resizing the browser has to perform to fill the HTML tag (less resiz…

Replies: 1 comment 11 replies

Comment options

You must be logged in to vote
11 replies
@nulano
Comment options

@Intenzi
Comment options

@Intenzi
Comment options

@nulano
Comment options

Answer selected by Intenzi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants