# Pixelated numbers in a watch

**URL:** https://discourse.processing.org/t/pixelated-numbers-in-a-watch/46816
**Category:** Coding Questions
**Created:** [July 29, 2025, 7:29pm UTC](https://discourse.processing.org/t/pixelated-numbers-in-a-watch/46816 "2025-07-29T19:29:00Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![humano](https://avatars.discourse-cdn.com/v4/letter/h/dbc845/32.png) [@humano](https://discourse.processing.org/u/humano)
#### Post date: [July 29, 2025, 7:29pm UTC](https://discourse.processing.org/t/pixelated-numbers-in-a-watch/46816/1 "2025-07-29T19:29:00Z")

</div>

My last questions are about sharpness. This sketch has an animation, specifically that of a clock. How could I make the numbers look perfectly sharp, without pixels around the edges?

```auto
void setup() {
  size(600, 600);
  textSize(200);
  textAlign(CENTER, CENTER);
}

void draw() {
  background(0); // Clear the background
  String dateTimeString = nf(hour(), 2) + ":" + nf(minute(), 2);
  text(dateTimeString, width/2, height/2); // Display the formatted string
}

```

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [July 29, 2025, 7:36pm UTC](https://discourse.processing.org/t/pixelated-numbers-in-a-watch/46816/2 "2025-07-29T19:36:48Z")

</div>

Hello,

It looked good with P2D renderer!

Do you have scaling set in Windows?  
I have scaling set to 125% and often see this issue with the default renderer which is JAVA2D if it is not added to `size()`.

Try another renderer (JAVA2D is default, FX2D or P2D):

> [@Pixelated images](https://discourse.processing.org/t/pixelated-images/46658):
>
> Hi there! I have been using processing again after sometime and I don’t understand why images are so pixelated. I am using processing 4.4.4 in Java mode in my pc and all the sketches are really pixelated, it doesn’t matter if a have 2 code lines or 200. How can I get clear images, please? size (500,500); background(255); triangle(250,100, 100,400, 400,400); save("image.png");

This shows differences:

> [@Launcher for Multi-Renderer PApplets](https://discourse.processing.org/t/launcher-for-multi-renderer-papplets/46764):
>
> Hello folks! My exploration of a launcher for PApplets with different renderers. This was used primarily for testing Windows scaling on my W10 system and how it affects the sketch window. Code: /\*\* \* Launcher for Multi-Renderer PApplets \* \* Author: glv \* Date: 2025-07-07 \* \* Description: \* Launches four separate Processing sketches (PApplets) using different renderers: \* - JAVA2D \* - P2D \* - P3D \* - FX2D \* \* Each renderer runs in its own thread, with readiness flags for commu…

Search for this in the forum:

`pixelDensity(1)`

It appears to solve a lot of issues.

Reference:

> **[Render Techniques](https://processing.org/tutorials/rendering/)**
>
> Tools for rendering geometries in Processing.

> **[size() / Reference](https://processing.org/reference/size_.html)**
>
> Defines the dimension of the display window width and height in units of pixels. In a program that has the setup() function, the size() function must be the first line of code inside …

`:)`

---

<div class="post-metadata">

### Author: ![humano](https://avatars.discourse-cdn.com/v4/letter/h/dbc845/32.png) [@humano](https://discourse.processing.org/u/humano)
#### Post date: [July 29, 2025, 7:53pm UTC](https://discourse.processing.org/t/pixelated-numbers-in-a-watch/46816/3 "2025-07-29T19:53:21Z")

</div>

you are right! and do you know why text is not centered vertically?

```auto
import processing.javafx.*;
void setup() {
  size(600, 600,FX2D);
  textSize(200);
  textAlign(CENTER, CENTER);
}

void draw() {
  background(0); // Clear the background
  String dateTimeString = nf(hour(), 2) + ":" + nf(minute(), 2);
  text(dateTimeString, width/2, height/2); // Display the formatted string

```

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [July 30, 2025, 12:34am UTC](https://discourse.processing.org/t/pixelated-numbers-in-a-watch/46816/4 "2025-07-30T00:34:33Z")

</div>

> [@humano](#):
>
> do you know why text is not centered vertically?

I do not know why it is WAY off with FX2D.

With JAVA2D and P2D it is a _bit off_ and this code can show that:

```auto

void setup() 
  {
  size(700, 400, P2D);
  
  textSize(200);
  
  println(textAscent());
  println(textDescent());
  }

boolean tog;

void draw() {
  background(0); // Clear the background
  String dateTimeString = "IjTgJyF";
  float ta = textAscent();
  
  //BASELINE
  if(tog)
    {
    textAlign(CENTER, BASELINE);
    line(0, height/2 - ta, width, height/2 -ta);
    line(0, height/2 - ta/2, width, height/2 -ta/2);
    text(dateTimeString, width/2, height/2); 
    }
  // CENTERED
  else
    {
    textAlign(CENTER, CENTER);
    line(0, height/2 - ta/2, width, height/2-ta/2);  
    text(dateTimeString, width/2, height/2); 
    }
 
  stroke(255);
  line(0, height/2, width, height/2);
  line(width/2, 0, width/2, height);  
  }
  
// Press key to toggle
void keyPressed()
  {
  tog = !tog;
  }

```

Look up the references and what it says and compare to what was was drawn.  
What do you notice?

Experiment with:  
_[textAlign() / Reference / Processing.org](https://processing.org/reference/textAlign_.html)_

`:)`

---

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [August 1, 2025, 4:18pm UTC](https://discourse.processing.org/t/pixelated-numbers-in-a-watch/46816/5 "2025-08-01T16:18:32Z")

</div>

> [@glv](#):
>
> I do not know why it is WAY off with FX2D.

To illustrate this:

```auto
import processing.javafx.*; 

void setup() 
  {
  size(700, 400, FX2D);
  textSize(200);
  
  println(textAscent());
  println(textDescent());
  
  noLoop();
  }

boolean tog;

void draw() {
  background(0); // Clear the background
  String str = "IjTgJyF";
  
  float ta = textAscent();
  stroke(0, 255, 0);
  line(0, height/2 - ta/2, width, height/2 - ta/2);  
  
  stroke(255);
  line(0, height/2, width, height/2);
  line(width/2, 0, width/2, height);  
  
  textAlign(CENTER, CENTER);
  text(str, width/2, height/2); 
  }

```

Output:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/3X/e/1/e1639d8758ee7ad0fbf813679dd799f176518c9b.png)

There may be a related issue in one of these repositories:

_[GitHub - processing/processing4: Source code for the Processing Core and Development Environment (PDE)](https://github.com/processing/processing4)_

_[GitHub - processing/processing4-javafx: JavaFX library for Processing 4](https://github.com/processing/processing4-javafx)_

If you do not find one consider submitting one.

`:)`
