Skip to content

Commit 492dbf2

Browse files
committed
Split image and netpbm
1 parent 262fe42 commit 492dbf2

18 files changed

+123
-69
lines changed

README.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,11 @@ Includes Linux concepts and utilities that work on Linux, not necessarily in the
188188
1. [Book](book.md): PDF, DJVU.
189189
1. [Dictionary](dictionary.md): dictionary formats
190190
1. [Game](game.md): games, emulation
191-
1. [Image](image/): images, photos
191+
1. [Image](image.md)
192192
1. [GIMP](gimp.md)
193-
1. [gnuplot](gnuplot)
194-
1. [imagemagick](imagemagick.md)
193+
1. [NetPBM](netpbm/)
194+
1. [gnuplot](gnuplot/)
195+
1. [ImageMagick](imagemagick.md)
195196
1. [Video](video.md): videos, films, subtitles
196197
1. File sharing
197198
1. [Dropbox](dropbox.md)

book/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Formats that contain image, text, fonts such as PDF or DJVU but not not formats
3030

3131
- MOBI: Mobipocket company, free format, bought by Amazon. TODO vs EPUB.
3232

33-
- RTF: Rich Text Format, proprietary Microsoft
33+
- RTF: Rich Text Format, proprietary Microsoft. Can be opened with `fbreader`.
3434

3535
## Viewers
3636

dev-filesystem.md

+10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Contains device driver files, and things related to device drivers like symlinks that give nice names to device drives.
44

5+
Files are documented under `man 4`.
6+
57
To understand what is going on, make a minimal device driver yourself. This is not documented here. Prerequisites you will learn when you do that:
68

79
- what do the type, major and minor numbers mean
@@ -248,3 +250,11 @@ Bash also implements it as a built-in magic path.
248250
Useful when annoying programs don't follow the usual convention of `-` for stdout / stdin in the place of files, e.g.: <http://www.serverfault.com/questions/329150/is-there-a-way-to-make-objdump-read-from-stdin-instead-of-file>
249251

250252
But it does not work all the time, since those programs may not implement `-` because they rely on `seek` calls which are not supported on pipes.
253+
254+
## /dev/rtc
255+
256+
man rtc
257+
258+
Real time clock.
259+
260+
TODO example.

image/README.md renamed to image.md

-32
Original file line numberDiff line numberDiff line change
@@ -64,38 +64,6 @@ Bit by bit, no compression.
6464

6565
Specified by Microsoft.
6666

67-
### Netpbm
68-
69-
- PBM: black and white (1 or 0!)
70-
- PGM: gray scale
71-
- PPM: color
72-
73-
Those three formats are also collectively knows as PNM, Portable aNymap Format.
74-
75-
Mainly used in Linux.
76-
77-
Bad browser support.
78-
79-
Very simple to edit on a text editor because ASCII based.
80-
81-
Not compressed, so not very memory efficient.
82-
83-
Magic numbers: first thing in file, specifies the exact format. Cannot be determined by extension alone because of binary/ASCII forms.
84-
85-
- `P1`: PBM ASCII
86-
- `P2`: PGM ASCII
87-
- `P3`: PPM ASCII
88-
- `P4`: PBM binary
89-
- `P5`: PGM binary
90-
- `P6`: PPM binary
91-
92-
An example to differentiate ASCII from binary. For PBM:
93-
94-
- ASCII: 1 byte per pix.
95-
- in binary 1 *bit* per pixel.
96-
97-
To view the minimalistic examples in this repo, open them with an image editor and do a huge zoom.
98-
9967
### TIF
10068

10169
Lossless or lossy, in practice lossless applications only.

image/.gitignore

-1
This file was deleted.

image/Makefile

-7
This file was deleted.

image/pbm.pbm

-5
This file was deleted.

image/pgm.pgm

-8
This file was deleted.

image/ppm.ppm

-6
This file was deleted.

image/svg.svg

-3
This file was deleted.

imagemagick.md

+31-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ Resize to fixed width of 100 px, height maintains original proportion:
5858

5959
convert large.png -resize 100x small.png
6060

61+
Fixed height:
62+
63+
convert large.png -resize x100 small.png
64+
65+
Force modififed aspect ratio:
66+
67+
convert large.png -resize '50x100!' small.png
68+
6169
### crop
6270

6371
`10x10`: rectangle to keep:
@@ -76,7 +84,7 @@ Cannot give top left corner in percentage
7684

7785
Bottom 50 percent:
7886

79-
convert -gravity south -crop 100x50% a.jpg b.jpg
87+
convert -gravity south -crop 100x50% a.jpg b.jpg
8088

8189
### color
8290

@@ -104,6 +112,28 @@ Bottom 50 percent:
104112

105113
convert -level -100,100 a.jpg b.jpg
106114

115+
### extent
116+
117+
Keep only the 50x50 central square of an image:
118+
119+
convert in.png -gravity center -extent 50x50 out.png
120+
121+
Percentage version:
122+
123+
convert in.png -gravity center -extent '50%x50%' out.png
124+
125+
### append
126+
127+
Paste multimple images into one vertically: <http://superuser.com/questions/290656/combine-multiple-images-using-imagemagick>
128+
129+
convert -append in-*.jpg out.jpg
130+
131+
Size is not corrected automatically.
132+
133+
Horizontally:
134+
135+
convert +append in-*.jpg out.jpg
136+
107137
### Transparency to white
108138

109139
<http://stackoverflow.com/questions/2322750/replace-transparency-in-png-images-with-white-background>

netpbm/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.png

netpbm/Makefile

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.POSIX:
2+
.PHONY: all clean
3+
4+
all:
5+
convert pbm.pbm pbm.png
6+
convert pgm.pgm pgm.png
7+
convert ppm.ppm ppm.png
8+
9+
clean:
10+
rm *.png

netpbm/README.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# NetPBM
2+
3+
Simple text based or binary family of uncompressed image formats.
4+
5+
Suitable for simple script generation.
6+
7+
Those formats are also collectively knows as PNM, Portable aNymap Format.
8+
9+
Mainly used in Linux.
10+
11+
Bad browser support, but can be viewed well with many Linux viewers, including `eog` and Krusader. Make sure to do a huge zoom. Those viewers may do dithering by default.
12+
13+
Magic numbers: first thing in file, specifies the exact format. Cannot be determined by extension alone because of binary/ASCII forms.
14+
15+
- `P1`: `.pbm` ASCII
16+
- `P2`: `.pgm` ASCII
17+
- `P3`: `.ppm` ASCII
18+
- `P4`: `.pbm` binary
19+
- `P5`: `.pgm` binary
20+
- `P6`: `.ppm` binary
21+
22+
Where:
23+
24+
- `.pbm`: binary
25+
- `.pgm`: grayscale
26+
- `.ppm`: RGB

netpbm/pbm.pbm

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
P1
2+
# The image is 3 x 2.
3+
3 2
4+
0 1 0
5+
1 0 1

netpbm/pgm.pgm

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
P2
2+
# Image is 3 x 3.
3+
3 3
4+
# 9 is the maxium value (white) for each pixel.
5+
9
6+
0 1 2
7+
4 5 6
8+
7 8 9

netpbm/ppm.ppm

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
P3
2+
# The image is 3 x 2.
3+
3 2
4+
# 255 is the maximum value for RGB.
5+
255
6+
# Alignment is optional: a single space would do
7+
255 0 0 0 255 0 0 0 255
8+
255 255 0 255 255 255 0 0 0

sysfs.md

+19-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ which is provided by the hwdata package <https://git.fedorahosted.org/hosted/hwd
8888
8086 Intel Corporation
8989
0154 3rd Gen Core processor DRAM Controller
9090

91-
### TODO
91+
TODO:
9292

9393
- why do many devices are shown under PCI, but I think PCI was replaced by PCIe a long time ago.
9494

@@ -100,17 +100,34 @@ Updates
100100

101101
Block devices.
102102

103+
Convenience only: all device directories point to `/sys/devices`
104+
103105
<https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-block>
104106

105107
### removable
106108

107109
<http://unix.stackexchange.com/questions/125961/how-to-tell-if-a-scsi-device-is-removable>
108110

109-
TODO what does it mean exacly? My main hard disk was not removable, but my USB was:
111+
TODO what does it mean exactly? My main hard disk was not removable, but my USB was:
110112

111113
cat /sys/block/sda/removable
112114
cat /sys/block/sdb/removable
113115

116+
## /sys/class
117+
118+
Devices grouped by category.
119+
120+
This is only for convenience: all device directories are symlinks to `/sys/devices`.
121+
122+
E.g.:
123+
124+
ls -l /sys/class/rtc/
125+
126+
Gives the `rtc0` device directory:
127+
128+
total 0
129+
lrwxrwxrwx 1 root root 0 Sep 25 09:46 rtc0 -> ../../devices/pnp0/00:02/rtc/rtc0
130+
114131
### Bibliography
115132

116133
<http://prefetch.net/articles/linuxpci.html>

0 commit comments

Comments
 (0)