pixel_raster 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +11 -5
- data/VERSION +1 -1
- data/lib/img2pixel.rb +11 -5
- data/lib/pixel_raster.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50dd69369485bc474f0f6cad44a37cff12f9b84aaa3ddaf705b54b16e33af02d
|
4
|
+
data.tar.gz: a650bec739e058ed2830d57f7868c6a75d82a16bb21489171dd7b54d409a3e1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2be80f33d0a55b25ea3baf6779ffb6b035e3635232117dc8749903ac7110338ed1f39a34bc6c9cd81a110764e98bd5f8d5bd3f94228f9d927d91254be094793a
|
7
|
+
data.tar.gz: 78c3033647eb003475a26d085c6c008e7cf0ce7c8a303bd0530576d502a34096839672839d9afe106c876e9c0322e12f4e21258bd15acf2b6f16b943ef2ddfde
|
data/README.md
CHANGED
@@ -13,14 +13,20 @@ columns and rows of pixels the image consists of as well as the color
|
|
13
13
|
The most easy case is a black and white image where each pixel is
|
14
14
|
represented by one bit.
|
15
15
|
|
16
|
-
## A paint yourself
|
16
|
+
## A paint yourself pixel image
|
17
17
|
|
18
18
|
To explain how an image is represented as data it can help to show
|
19
19
|
paint-yourself raster versions (see [images.pdf](images.pdf)).
|
20
20
|
|
21
|
-
##
|
21
|
+
## img2pixel
|
22
|
+
|
23
|
+
The script takes images from the command line as input and
|
24
|
+
outputs `svg` or [`tikz`](https://ctan.org/pkg/pgf) code to stdout.
|
22
25
|
|
23
|
-
|
24
|
-
|
26
|
+
See `img2pixel -h`.
|
27
|
+
|
28
|
+
## xpm2tikz
|
25
29
|
|
26
|
-
|
30
|
+
If you have problems installing RMagick you may want to use an older
|
31
|
+
(crappier) version instead: [`pixel_raster_xpm`](https://github.com/Lapizistik/pixel_raster_xpm).
|
32
|
+
It can only take simple xpm images as input and produces tikz.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
data/lib/img2pixel.rb
CHANGED
@@ -90,20 +90,26 @@ module PixelRaster
|
|
90
90
|
outmode = mode
|
91
91
|
end
|
92
92
|
|
93
|
+
p.on('-r', '--resize [SPEC]',
|
94
|
+
'Resize image to given dimensions.',
|
95
|
+
'See ImageMagick resize specification.') do |spec|
|
96
|
+
params[:resize] = spec
|
97
|
+
end
|
98
|
+
|
93
99
|
p.on('-l','--light2dark',
|
94
|
-
'
|
95
|
-
'Default:
|
100
|
+
'Color numbering direction.',
|
101
|
+
'Default: dark2light (unless 2 color imgs)') do
|
96
102
|
params[:light2dark] = true
|
97
103
|
end
|
98
104
|
|
99
105
|
p.on('-L','--dark2light',
|
100
|
-
'
|
101
|
-
'Default:
|
106
|
+
'Color numbering direction.',
|
107
|
+
'Default: dark2light, (unless 2 color imgs)') do
|
102
108
|
params[:light2dark] = false
|
103
109
|
end
|
104
110
|
|
105
111
|
p.on('-d', '--dir DIR',
|
106
|
-
'
|
112
|
+
'Directory for output files.',
|
107
113
|
'Must exist and be writeable.',
|
108
114
|
"Default: same as INFILE") do |dir|
|
109
115
|
outdir = dir
|
data/lib/pixel_raster.rb
CHANGED
@@ -171,7 +171,7 @@ module PixelRaster
|
|
171
171
|
# representation of images!
|
172
172
|
# We therefore assume light2dark _unless_ it's a 2-color image
|
173
173
|
# if it is not explicitely set:
|
174
|
-
light2dark = colors.length
|
174
|
+
light2dark = colors.length == 2 if light2dark.nil?
|
175
175
|
colors.reverse! if light2dark
|
176
176
|
colors.each_with_index do |p,i|
|
177
177
|
colormap[p]=i
|