User:Raul Miller/graphics/png

From J Wiki
Jump to navigation Jump to search

The graphics/png addon looks handy but seems to be remarkably undocumented.

A small experiment with it suggests that (4#256) #: readpng filename produces a bitmap representation of the image in ARGB format.

In other words:

  1. indices into the first dimension selects pixels vertically
  2. indices into the second dimension selects pixels horizontally
  3. the third dimension has four elements: alpha intensity, red intensity, green intensity, blue intensity

Logically speaking, it might be advantageous to instead represent these pixels in a more OpenGL style, using 255 %~ (4#256) #: readpng filename .(this way these intensities each range from 0 to 1)