jblog
toc

J-Filters III

2015-10-03, post № 69

programming, Pygame, Python, #filter, #image, #image manipulation, #img, #soft

This filter swaps the red and blue color values. It results in a rather soft image.

The original image (can also be found on my Stacking Stones post).

j-filters-iii_original.jpg

RGB Swap (just swaps the red and blue color value, that is why the lake appears red).

j-filters-iii_rgb-swap.png
Source code: j-filters-iii_rgb-swap.py

Pygame Bug

2015-09-27, post № 68

programming, Pygame, Python, #aa, #aacirlce, #anti-aliased, #antialiased, #approach, #buf, #circle, #color, #colors, #draw, #gfx, #gfxdraw, #n-gon, #pattern, #Pygame bug

Tinkering around with circles and colors, I created a program which creates interesting images, both with pygame.draw.circle() (left) and pygame.gfxdraw.circle() (right). (Both images at 𝟦𝟢𝟢 ⨉ 𝟦𝟢𝟢 pixels.)

pygame-bug_img-3_400x400-draw.png
pygame-bug_img-2_400x400-gfx.png

To get a smoother and nicer result, I tried using the pygame.gfxdraw.aacircle() function, which draws antialiased circles.

pygame-bug_img-1_400x400-aagfx.png

As expected, the antialiased function gets rid of the black spots between the colored circles.

Wanting a higher resolution, I used the same code on a 𝟣𝟢𝟢𝟢 ⨉ 𝟣𝟢𝟢𝟢 pixel wide surface.

pygame-bug_img-4_1000x1000-aagfx.png

Again, it is a smooth and neat result. But as I got higher and higher resolutions, I got this interesting result. (At 𝟥𝟢𝟢𝟢 ⨉ 𝟥𝟢𝟢𝟢 pixels)

pygame-bug_img-7_3000x3000-aagfx.png

To make sure, the problem is on pygame.gfxdraw.aacircle()’s side, I created images of equal size with both pygame.draw.circle() (left) and pygame.gfxdraw.circle() (right). (Both images again at 𝟥𝟢𝟢𝟢 ⨉ 𝟥𝟢𝟢𝟢 pixels.)
To ensure, the problem is not on my operating system’s side, I used the exact same code on Mac OSX, Debian Linux and Windows 7 and 8.1 and got the same result each time.

pygame-bug_img-9_3000x3000-draw.png
pygame-bug_img-8_3000x3000-gfx.png

At last, I used all three functions at 𝟦𝟢𝟢𝟢 ⨉ 𝟦𝟢𝟢𝟢 pixels. (pygame.draw.circle() on the left, pygame.gfxdraw.cirlce() on the right and pygame.gfxdraw.aacircle() on the bottom.)

pygame-bug_img-12_4000x4000-draw.png
pygame-bug_img-11_4000x4000-gfx.png
pygame-bug_img-10_4000x4000-aagfx.png
Source code: pygame-bug.py

Pastel

2015-09-26, post № 67

programming, Pygame, Python, #background, #beautiful, #color, #colors, #lines, #pseudo random, #random, #wallpaper

This program uses two positions and a color to create beautiful images.

Usage

  • ‘q’ saves the current image,
  • ‘Space’ pauses and resumes the image’s creation.
pastel-2.png
pastel-18.png
pastel-23.png
Source code: pastel.py
Jonathan Frech's blog; built 2021/04/16 21:21:49 CEST