Pictures Made in Memory, and How Each Is Shown

A chart or a barcode is often created by the program itself, pixel by pixel, rather than read from a file. Here sixteen such pictures are built in memory, from red, green and blue, from the four printing inks, from a small table of colours, and with a level of transparency for each pixel. Each is then shown another way: with one colour made transparent, through a mask, as a shape filled with the page's colour, upside down, smoothed or left sharp when enlarged, under a colour profile, in one or two press inks, and inside an outline that cuts it.

The second page turns one picture each of the eight ways a camera can record it was held, and gives each the figures the file uses for it. Then a PNG, a JPEG, a BMP and a TIFF are read from files, each with the size it takes on the page at 300 dots per inch and the resolution it states, if it states one. The last one is placed on a layer the reader can hide.

What This Example Shows

  • Pictures built from numbers, with no file to read.
  • One picture turned each of eight ways.
  • Four image formats read, each at its own size.

The Source Code, Complete

Nothing is left out and nothing is simplified: this is the program exactly as it runs, for the developer who uses this library.

Read the Rust source Read the Python source

The Document Itself

Open the document in English Open the document in French Open the document in German Open the document in Spanish Open the document in Italian Open the document in Portuguese

Pictures Made in Memory, and How Each Is Shown, first page

The Same Document in Other Languages

This document weighs 48.3 kB

Examples Near This One

Images on a Page

A photograph that goes in exactly as it came out of the camera, and one with transparent parts that keeps them, each on a page cut to its own size.

A Gallery of Picture Formats

The four picture formats read — JPEG, PNG, BMP and TIFF — shown across every picture shipped with the library, each captioned with what its own file declares.

A Picture Fitted into a Rectangle

One picture fitted into a rectangle of one size eight ways: three ways of sizing it, the same one stood in the top left corner with a 12-point inset, a quarter turn left, a quarter turn right, a turn of 20 degrees, and a left-to-right mirror — every panel drawing the picture at the place and the size the library worked out. A second page adds eight more: the picture at its own size, then twice as large and cut where it hangs over; shrunk only when it is too big; set at nine positions at once; placed a quarter of the way in and down; turned a half turn; and mirrored top to bottom.

Overlong Text in a Narrow Cell

Overlong text in a narrow table cell: left to overflow the column, cut to it, or set smaller in a row that keeps its height.

Two Orders, One Frame, One Bottom Edge

An order of four lines and one of seven, in frames of the same height, both ending on the same bottom edge. Underneath, two notes of unequal length whose lines are moved apart until each reaches the foot of its frame.

Every example, by subject