Created
June 18, 2025 21:34
-
-
Save ta1hia/b56f0e56834f32b82ff6641dda521c0c to your computer and use it in GitHub Desktop.
pixelate script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let buffer; | |
let pixelSize = 12; | |
let size = 400; | |
function setup() { | |
createCanvas(1000, 1000); | |
textFont('Times New Roman'); | |
textSize(size); | |
noStroke(); | |
buffer = createGraphics(width, height); | |
buffer.background(255); | |
buffer.textFont('Times New Roman'); | |
buffer.textSize(size); | |
buffer.fill(0); | |
buffer.textAlign(CENTER, CENTER); | |
buffer.text('Pixel', width/2, height/2); | |
} | |
function draw() { | |
background(255); | |
for (let x=0; x < buffer.width; x += pixelSize) { | |
for (let y=0; y < buffer.height; y += pixelSize) { | |
let c = buffer.get(x, y); | |
console.log(typeof(c)); | |
fill(c); | |
rect(x, y, pixelSize, pixelSize); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment