jfrech.com
jblog
table of contents

Sand

2015-10-04, post № 70

programming, Pygame, Python, #art, #background, #bridges, #falling, #grain, #grains, #sand, #shades

This program lets you watch grains of sand fall. The grains shift in color, according to the color algorithm assigned. You also can build bridges to change the sand’s falling behavior.

Controls

  • Left clicking spawns in new grains of sand,
  • Right clicking draws a bridge,
  • ‘Space’ saves a screenshot.
sand-7.png
sand-4.png
sand-10.png
Source code: sand.py

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

JClock V

2015-09-20, post № 66

programming, Pygame, Python, #alternative, #bar, #bar clock, #bars, #clock, #clockface, #time

This alternative clock design may not be particularly readable, but it is nice to look at.

jclock-v-1.png
Source code: jclock-v.py

Text Scrambler

2015-09-19, post № 65

programming, Python, #letters, #mixed, #reading, #scrambled, #text

This program demonstrates an interesting phenomenon regarding reading. It shows, that we are not reading letter by letter, but rather word by word.

Taht is why you can mkae snsee of this sennetce.

text-scrambler.png
Source code: text-scrambler.png

J-Filters II

2015-09-13, post № 64

programming, Pygame, Python, #blur, #color depth, #filter, #image, #image manipulation, #img, #J-Filter, #mix-up

Playing around with pygame and image manipulation, I created another set of filters. My previous filters can be found here.

For demonstration purposes I used an image from my post Stacking Stones.

j-filters-ii_original.jpg

This is a simple blur filter. It takes the average of pixel attached to one another.

j-filters-ii_blur.png

This filter changes the color depth. A usual image has color values from 𝟢 to 𝟤𝟧𝟧 on red, green and blue. The filter changes those values to 𝟢 to 𝟪.

j-filters-ii_color-depth.png

Mix-up repositions the pixels from their original position. So it creates a mixed-up image.

j-filters-ii_mix-up.png
Source code: j-filters-ii_blur.py
Source code: j-filters-ii_color-depth.py
Source code: j-filters-ii_mix-up.py

Primes II

2015-09-12, post № 63

mathematics, programming, Pygame, Python, #black, #black and white, #circle, #circles, #cixel, #gray, #numbers, #prime, #round, #visualization

Inspired by my Cixel filter, I designed another prime visualisation program.

primes-ii.png
Source code: primes-ii.py

Space Adventures

2015-09-06, post № 62

art, #animated, #animated gif, #engine, #flight, #pixel, #pxl, #sky, #space, #spacecraft, #stars

Our little pixel hero tries himself as an astronaut. But on his trip he gets lost in the vastness of space…

space-adventures.gif

J-Filters

2015-09-05, post № 61

programming, Pygame, Python, #art, #change, #filter, #filters, #image, #image filters, #image software, #img, #manipulation, #pic, #picture

Getting into image manipulation, I created a few filters to change the look and feel of digital images. Though the software is not the most efficient, the results are looking good.

For demonstration purposes I used an image from my post Stacking Stones.

j-filters_original.jpg

This filter I call Cixel, because it combines square pixels with round circles.

j-filters_cixel.png

Again working with circles, the Draw filter tries to imitate a drawn picture. The Drawing filter applied

j-filters_drawing.png

Using lines and a fixed point, thed Stretch filter stretches the image to the lower right corner.

j-filters_stretch.png
Source code: j-filters_cixel.py
Source code: j-filters_drawing.py
Source code: j-filters_stretch.py

R-Lines

2015-08-30, post № 60

art, programming, Pygame, Python, #black, #black and white, #draw, #line, #pseudo random, #random, #white

Starting at the screen’s center, this program draws randomly long lines in a random direction. The lines cannot leave the screen.

r-lines-2.png
r-lines-1.png
r-lines-3.png
Source code: r-lines.py