image_paradise 0.1.12

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of image_paradise might be problematic. Click here for more details.

Files changed (115) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.md +38 -0
  3. data/README.md +179 -0
  4. data/USAGE.md +10 -0
  5. data/bin/black_white +10 -0
  6. data/bin/display_text_from_this_image +7 -0
  7. data/bin/image_paradise +7 -0
  8. data/bin/image_paradise_shell +7 -0
  9. data/bin/image_to_ascii +54 -0
  10. data/bin/image_to_pdf +7 -0
  11. data/bin/make_this_image_transparent +7 -0
  12. data/bin/rotate_left +7 -0
  13. data/bin/rotate_right +7 -0
  14. data/doc/README.gen +162 -0
  15. data/doc/TODO_FOR_THE_GTK_GUI.md +1 -0
  16. data/image_paradise.gemspec +50 -0
  17. data/lib/image_paradise.rb +5 -0
  18. data/lib/image_paradise/base/base.rb +91 -0
  19. data/lib/image_paradise/black_white.rb +89 -0
  20. data/lib/image_paradise/confree_generator/class.rb +614 -0
  21. data/lib/image_paradise/confree_generator/constants.rb +61 -0
  22. data/lib/image_paradise/confree_generator/gui/gtk_confree_generator.rb +752 -0
  23. data/lib/image_paradise/confree_generator/gui/insert_button.rb +78 -0
  24. data/lib/image_paradise/confree_generator/reset.rb +61 -0
  25. data/lib/image_paradise/confree_generator/shared/shared.rb +100 -0
  26. data/lib/image_paradise/constants.rb +43 -0
  27. data/lib/image_paradise/constants/image_file_types.rb +21 -0
  28. data/lib/image_paradise/create_animated_gif.rb +47 -0
  29. data/lib/image_paradise/crop/crop.rb +302 -0
  30. data/lib/image_paradise/gm_support.rb +34 -0
  31. data/lib/image_paradise/graphs.rb +36 -0
  32. data/lib/image_paradise/graphs/accumulator_bar.rb +29 -0
  33. data/lib/image_paradise/graphs/area.rb +64 -0
  34. data/lib/image_paradise/graphs/bar.rb +117 -0
  35. data/lib/image_paradise/graphs/bar_conversion.rb +53 -0
  36. data/lib/image_paradise/graphs/base.rb +1392 -0
  37. data/lib/image_paradise/graphs/bezier.rb +45 -0
  38. data/lib/image_paradise/graphs/bullet.rb +115 -0
  39. data/lib/image_paradise/graphs/deprecated.rb +42 -0
  40. data/lib/image_paradise/graphs/dot.rb +129 -0
  41. data/lib/image_paradise/graphs/line.rb +328 -0
  42. data/lib/image_paradise/graphs/mini/bar.rb +42 -0
  43. data/lib/image_paradise/graphs/mini/legend.rb +109 -0
  44. data/lib/image_paradise/graphs/mini/pie.rb +42 -0
  45. data/lib/image_paradise/graphs/mini/side_bar.rb +41 -0
  46. data/lib/image_paradise/graphs/net.rb +133 -0
  47. data/lib/image_paradise/graphs/photo_bar.rb +106 -0
  48. data/lib/image_paradise/graphs/pie.rb +139 -0
  49. data/lib/image_paradise/graphs/scatter.rb +264 -0
  50. data/lib/image_paradise/graphs/scene.rb +216 -0
  51. data/lib/image_paradise/graphs/side_bar.rb +144 -0
  52. data/lib/image_paradise/graphs/side_stacked_bar.rb +116 -0
  53. data/lib/image_paradise/graphs/spider.rb +163 -0
  54. data/lib/image_paradise/graphs/stacked_area.rb +73 -0
  55. data/lib/image_paradise/graphs/stacked_bar.rb +68 -0
  56. data/lib/image_paradise/graphs/stacked_mixin.rb +30 -0
  57. data/lib/image_paradise/graphs/themes.rb +117 -0
  58. data/lib/image_paradise/graphviz/README.md +2 -0
  59. data/lib/image_paradise/graphviz/generate_graphviz_image.rb +274 -0
  60. data/lib/image_paradise/gui/gtk/control_panel.rb +126 -0
  61. data/lib/image_paradise/identify.rb +145 -0
  62. data/lib/image_paradise/image_border.rb +231 -0
  63. data/lib/image_paradise/image_manipulations.rb +320 -0
  64. data/lib/image_paradise/image_paradise.rb +150 -0
  65. data/lib/image_paradise/image_to_ascii/image_to_ascii.rb +187 -0
  66. data/lib/image_paradise/image_to_pdf/image_to_pdf.rb +99 -0
  67. data/lib/image_paradise/label/README.md +2 -0
  68. data/lib/image_paradise/label/simple_label.rb +206 -0
  69. data/lib/image_paradise/optimizer.rb +483 -0
  70. data/lib/image_paradise/project/project.rb +29 -0
  71. data/lib/image_paradise/random_text_to_image.rb +363 -0
  72. data/lib/image_paradise/requires/common_base_requires.rb +17 -0
  73. data/lib/image_paradise/requires/require_colours.rb +9 -0
  74. data/lib/image_paradise/requires/require_gtk_components.rb +8 -0
  75. data/lib/image_paradise/requires/require_image_to_ascii.rb +7 -0
  76. data/lib/image_paradise/requires/require_the_image_paradise_project.rb +24 -0
  77. data/lib/image_paradise/requires/require_toplevel_methods.rb +21 -0
  78. data/lib/image_paradise/rotate/README.md +2 -0
  79. data/lib/image_paradise/rotate/rotate.rb +98 -0
  80. data/lib/image_paradise/shell/interactive.rb +156 -0
  81. data/lib/image_paradise/svg/README.md +5 -0
  82. data/lib/image_paradise/svg/circle.rb +106 -0
  83. data/lib/image_paradise/svg/feature.rb +48 -0
  84. data/lib/image_paradise/svg/rectangle.rb +154 -0
  85. data/lib/image_paradise/svg/svg.rb +102 -0
  86. data/lib/image_paradise/to_gif.rb +91 -0
  87. data/lib/image_paradise/to_jpg.rb +90 -0
  88. data/lib/image_paradise/toplevel_methods/add_black_border_to_this_image.rb +56 -0
  89. data/lib/image_paradise/toplevel_methods/crop.rb +28 -0
  90. data/lib/image_paradise/toplevel_methods/e.rb +16 -0
  91. data/lib/image_paradise/toplevel_methods/esystem.rb +19 -0
  92. data/lib/image_paradise/toplevel_methods/extract_text_from_this_image.rb +56 -0
  93. data/lib/image_paradise/toplevel_methods/file_related_code.rb +25 -0
  94. data/lib/image_paradise/toplevel_methods/flip_image_left_right.rb +32 -0
  95. data/lib/image_paradise/toplevel_methods/greyscale_this_image.rb +59 -0
  96. data/lib/image_paradise/toplevel_methods/help.rb +30 -0
  97. data/lib/image_paradise/toplevel_methods/make_this_image_transparent.rb +30 -0
  98. data/lib/image_paradise/toplevel_methods/menu.rb +92 -0
  99. data/lib/image_paradise/toplevel_methods/merge_these_images.rb +49 -0
  100. data/lib/image_paradise/toplevel_methods/mirror_image.rb +28 -0
  101. data/lib/image_paradise/toplevel_methods/misc.rb +31 -0
  102. data/lib/image_paradise/toplevel_methods/png_to_svg.rb +34 -0
  103. data/lib/image_paradise/toplevel_methods/roebe.rb +17 -0
  104. data/lib/image_paradise/toplevel_methods/to_png.rb +105 -0
  105. data/lib/image_paradise/toplevel_methods/wallpaper.rb +37 -0
  106. data/lib/image_paradise/toplevel_methods/write_this_text.rb +76 -0
  107. data/lib/image_paradise/version/version.rb +19 -0
  108. data/test/16x16_red_square_image_for_testing.png +0 -0
  109. data/test/testing_confree_generator.rb +8 -0
  110. data/test/testing_crop.rb +19 -0
  111. data/test/testing_image_magick_commands.rb +39 -0
  112. data/test/testing_image_paradise.rb +49 -0
  113. data/test/testing_the_svg_component.html +261 -0
  114. data/test/testing_the_svg_component.rb +106 -0
  115. metadata +217 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cc6e0fea2cf16f3e33ffc160b00a7948393ec93c3fdef26cd4072dc33cb41fee
4
+ data.tar.gz: 41c6bfef80f3d324db9c9fe26d7e076ac3406029c29a31287d6cbfd2f2e10622
5
+ SHA512:
6
+ metadata.gz: 40db871132c2848d0e30a2494bc50d3d6d2a5017c1523203586edcc6d4c1f53eeab9b3b051b0ac15ad5dc237cc2f271187746938fcb26a880556b76609ac6de4
7
+ data.tar.gz: 2d807e4ea173b4b1367d73efeba6248ad65a7f8518ee59e47fcf4d449f0f32573bc81f6e41277321dbf605a68d7d922a365cb53d536ffeda35d6931452850981
@@ -0,0 +1,38 @@
1
+ The code in the graphs/ subdirectory is based on the gem called gruff
2
+ and thus the MIT license (I kept the MIT license for that code since I
3
+ believe that this is only fair even though you could change the license
4
+ to require a similar GPL-distribution clause of your modifications,
5
+ since topfunky made it available for his gruff project via the MIT
6
+ license; for my own projects written from scratch I prefer the GPL-2.0
7
+ version though):
8
+
9
+ Copyright (c) 2005-2012 Topfunky Corporation boss@topfunky.com
10
+ Copyright (c) 2015 Robert A. Heiler
11
+
12
+ MIT License
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining
15
+ a copy of this software and associated documentation files (the
16
+ "Software"), to deal in the Software without restriction, including
17
+ without limitation the rights to use, copy, modify, merge, publish,
18
+ distribute, sublicense, and/or sell copies of the Software, and to
19
+ permit persons to whom the Software is furnished to do so, subject to
20
+ the following conditions:
21
+
22
+ The above copyright notice and this permission notice shall be
23
+ included in all copies or substantial portions of the Software.
24
+
25
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32
+
33
+ ------------------------------------------------------------------------
34
+
35
+ The rest of the code base in image_manipulation is GPL-2.0 and has been
36
+ written by me:
37
+
38
+ Copyright (c) 2014-2015 Robert A. Heiler
@@ -0,0 +1,179 @@
1
+ [![forthebadge](http://forthebadge.com/images/badges/built-with-love.svg)](https://www.gobolinux.org/)
2
+ [![forthebadge](http://forthebadge.com/images/badges/made-with-ruby.svg)](https://www.ruby-lang.org/en/)
3
+ [![Gem Version](https://badge.fury.io/rb/image_paradise.svg)](https://badge.fury.io/rb/image_paradise)
4
+
5
+ ## Flip-flopping an image from left-to-right
6
+
7
+ If you want to flip an image left-to-right, you can use
8
+ class <b>FlipImageLeftRight</b>. The file resides at
9
+ <b>image_paradise/toplevel_methods/flip_image_left_right.rb/</b>.
10
+
11
+ ## Rotating an image
12
+
13
+ (Technically this is similar to flip-flop, but I added this functionality
14
+ at a later point, so the flip-flop subsection here shall remain for the
15
+ time being.)
16
+
17
+ The commandline API for rotating an image called **FOOBAR.png**, in
18
+ regards to image_paradise, may go so:
19
+
20
+ imgparadise FOOBAR.png --rotate=33%
21
+ imgparadise foo.png --rotate=90%
22
+ imgparadise *.png --rotate=90%
23
+
24
+ Simply pass the rotation-value that you wish to use into --rotate.
25
+
26
+ Be careful, though - this command will overwrite the image, so **make
27
+ sure to backup your old image** before applying this command.
28
+
29
+ ## Transparent images
30
+
31
+ You can use this API to make an image transparent:
32
+
33
+ ImageParadise.make_this_image_transparent
34
+
35
+ This will try to make use of ImageMagick's **convert** ability.
36
+
37
+ ## Merging image files together
38
+
39
+ You can use the toplevel method **ImageParadise.merge_these_images**
40
+ in order to merge several image files together. This depends on the
41
+ binary called **convert**, from ImageMagick.
42
+
43
+ As first argument simply pass an Array of the files that you wish
44
+ to merge, such as:
45
+
46
+ ImageParadise.merge_these_images(%w( foo.png bar.png bla.png ))
47
+ ImageParadise.merge(%w( foo.png bar.png bla.png )) # <- This also works.
48
+
49
+ ## Greyscaling images
50
+
51
+ You can grayscale images via:
52
+
53
+ ImageParadise.greyscale_this_image()
54
+ ImageParadise.grayscale_this_image()
55
+
56
+ This currently (Jan 2019) depends on the gem called **mini_magick**. In
57
+ the future we may add some more flexibility to this method, but for the
58
+ time being mini_magick is a dependency if you wish to make use of
59
+ these **toplevel methods**.
60
+
61
+ Greyscaling an image may be useful if you wish to use this for
62
+ **optical character recognition**, aka recognising written text
63
+ on it.
64
+
65
+ ## Borders
66
+
67
+ You can add some borders to images.
68
+
69
+ The toplevel method **ImageParadise.add_black_border_to_this_image()**
70
+ can be used to add a black border to an image. The first argument to
71
+ this method is the path to the image at hand. The second argument
72
+ specifies the size of the border, in **pixels**. So the number **3**
73
+ as second argument would mean draw a border 3 pixel wide around the
74
+ image at hand.
75
+
76
+ Invocation example for the file called **foobar.png**:
77
+
78
+ ImageParadise.add_black_border_to_this_image('foobar.png',3)
79
+
80
+ Obviously for this to work, the file must exist.
81
+
82
+ ## class ImageParadiseImageToAscii
83
+
84
+ This class can convert images to ASCII files, if ImageMagick
85
+ (and the rmagick bindings) are available.
86
+
87
+ To specifically require this class, do this:
88
+
89
+ require 'image_paradise/requires/require_image_to_ascii.rb'
90
+
91
+ Then pass the filename into the class:
92
+
93
+ result = ImageParadise::ImageToAscii['foobar.jpg']
94
+ result = ImageParadise.image_to_ascii('foobar.jpg')
95
+
96
+ or
97
+
98
+ _ = ImageParadise::ImageToAscii.new '/foo/bar.png'
99
+ _.to_ascii # Generate the ascii "image" here specifically, via this method call.
100
+
101
+ or
102
+
103
+ print ImageParadise::ImageToAscii('yo.png').to_ascii(width: 50)
104
+
105
+ +--------------------------------------------------+
106
+ |oooooooooooooooooooooooooooooooooooooooooooooooooo|
107
+ |oooooooooooooooooooooooooooooooooooooooooooooooooo|
108
+ |oooooooooooooooooooooooooooooooooooooooooooooooooo|
109
+ |oooooooooooooooooo===++++====ooooooooooooooooooooo|
110
+ |ooooooooooooo=+:~.~........~~~:+=ooooooooooooooooo|
111
+ |oooooooooo==:~...~~:++++++:~~..~~:+=oooooooooooooo|
112
+ |oooooooo=+:...~++====oooo====+:~..~:+=oooooooooooo|
113
+ |ooooooo=+~..~:++==ooooooooooo=++:~..~+=ooooooooooo|
114
+ |oooooo=+~.~:+=+~.~~~~~~~~:~~~.~:++:~.~+=oooooooooo|
115
+ |ooooo=+~~.+===~................~+==:.~~+=ooooooooo|
116
+ |ooooo=:~~:+=+:~................~~+=+:~.:=ooooooooo|
117
+ |ooooo=~.~+==+~.......XXXXX.......+==+~.:=ooooooooo|
118
+ |ooooo=~~~+==:~.......XXXXX.......:==+~.:=ooooooooo|
119
+ |ooooo=~~~:==+~.......XXXXX......~+==+~.~=ooooooooo|
120
+ |ooooo=:~~~+=++~.................:+=+~~~:=ooooooooo|
121
+ |ooooo=+:..~+==+~~...........~~~+==+~..:+=ooooooooo|
122
+ |ooooooo+:..~:+=o=+:........:+====:~.~:==oooooooooo|
123
+ |oooooooo=+~.~~:+==+~......~+==+:~..~:+oooooooooooo|
124
+ |ooooooooo=+:~..~~:~~.......~:~~..~:+oooooooooooooo|
125
+ |oooooooooooo=+~~..............~:+=oooooooooooooooo|
126
+ |ooooooooooooooo==++:~~~~~~:++==ooooooooooooooooooo|
127
+ |oooooooooooooooooooooooooooooooooooooooooooooooooo|
128
+ |oooooooooooooooooooooooooooooooooooooooooooooooooo|
129
+ |oooooooooooooooooooooooooooooooooooooooooooooooooo|
130
+ +--------------------------------------------------+
131
+
132
+ Add colours via the "colour" option
133
+
134
+ require 'image_paradise'
135
+ a = ImageParadise::ImageToAscii.new "http://www.evangogh.org/images/paintings/self-portrait.jpg"
136
+ puts a.to_ascii(color: true)
137
+
138
+ Command Line examples:
139
+
140
+ image_to_ascii ~/Desktop/foo.png # Local file.
141
+ image_to_ascii http://www.google.com/images/foo.png # Remote image.
142
+ image_to_ascii -c -f html ~/foobar.jpg > ~/Desktop/ascii-as-html.html # Output via HTML.
143
+ image_to_ascii -w 50 -c -f html ~/foo/bar.jpg > ~/Desktop/saturdaynight.html # Or smaller.
144
+
145
+ To display help:
146
+
147
+ image_to_ascii -h
148
+
149
+ Usage: image_to_ascii [options] <path_or_url>
150
+ -w, --width WIDTH Width of the finished Ascii Image (Default: 150)
151
+ -f, --format [text/html] output format (Default: text)
152
+ -c, --color Switch to use colored terminal output (Default: false)
153
+ -i, --invert-chars Invert the character map. *Depending on background and image color - this can make the result clearer.*
154
+ -v, --version Show the version of this project
155
+ -h, --help Show this message
156
+
157
+ ## SVG
158
+
159
+ ImageParadise now has a submodule called **Svg**, for svg-related
160
+ objects. Documentation is currently missing for this part. Hopefully
161
+ I will have more time in the future to add the missing
162
+ documentation here. :\
163
+
164
+
165
+ ## Contact information
166
+
167
+ If your creative mind has ideas and specific suggestions to make this
168
+ gem more useful in general, feel free to drop me an email at any
169
+ time, via:
170
+
171
+ shevegen@gmail.com
172
+
173
+ (Do keep in mind that responding to emails may take some time, depending
174
+ on the amount of work I may have at that moment, due to reallife. I will,
175
+ however had, read feedback. Patches and code changes are welcome too
176
+ of course, as long as they are in the spirit of the project at
177
+ hand, e. g. fitting to the general theme.)
178
+
179
+ Thank you.
@@ -0,0 +1,10 @@
1
+ = Usage of this Library
2
+
3
+ == Requiring it
4
+
5
+ require 'image_paradise'
6
+
7
+ == Using it in a project
8
+
9
+ _ = ImageParadise.new("path_to_an_image")
10
+ _.run
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # This small executable will turn a coloured image into a black-white
6
+ # image, an operation that is more aptly called "grayscaling".
7
+ # =========================================================================== #
8
+ require 'image_paradise'
9
+
10
+ ImageParadise.black_white(ARGV)
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'image_paradise/toplevel_methods/extract_text_from_this_image.rb'
6
+
7
+ puts ImageParadise.extract_text_from_this_image(ARGV, :default, :do_show_the_command)
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'image_paradise'
6
+
7
+ ImageParadise.menu(ARGV)
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'image_paradise'
6
+
7
+ ImageParadise.interactive_shell
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # This is the executable for class ImageParadise::ImageToAscii.
6
+ # =========================================================================== #
7
+ require 'image_paradise/requires/require_image_to_ascii.rb'
8
+ require 'optparse'
9
+
10
+ OPTIONS = {}
11
+ invert_chars = false
12
+
13
+ option_parser = OptionParser.new { |opts|
14
+ opts.banner = 'Usage: asciiart [options] <path_or_url>'
15
+
16
+ opts.on('-w', '--width WIDTH', 'Width of the finished Ascii Art (Default: 100)') { |width|
17
+ OPTIONS[:width] = width.to_i
18
+ }
19
+ opts.on('-f', '--format [text/html]', 'output format (Default: text)') { |format|
20
+ OPTIONS[:format] = format
21
+ }
22
+ opts.on('-c', '--color', 'Switch to use colored terminal output (Default: false)') {
23
+ OPTIONS[:color] = true
24
+ }
25
+ opts.on('-i', '--invert-chars', 'Invert the character map. Depending on your '\
26
+ 'terminal and image this can make the image clearer (or a lot worse)') {
27
+ invert_chars = true
28
+ }
29
+ opts.on_tail('-v', '--version', 'Show AsciiArt version') {
30
+ puts 'AsciiArt version '+AsciiArt::VERSION
31
+ exit
32
+ }
33
+ opts.on_tail('-h', '--help', 'Show this message') {
34
+ puts opts
35
+ exit
36
+ }
37
+ }
38
+
39
+ begin
40
+ option_parser.parse!
41
+ rescue OptionParser::MissingArgument => e
42
+ puts "ERROR: #{e.message.capitalize}\n#{option_parser}"
43
+ exit
44
+ end
45
+
46
+ if ARGV.length == 0
47
+ puts "ERROR: You must specify a path or URL to convert\n#{option_parser}"
48
+ exit
49
+ end
50
+
51
+ _ = ImageParadise::ImageToAscii.new(ARGV.first)
52
+ _.image_chars = _.image_chars.reverse if invert_chars
53
+
54
+ puts _.to_ascii(OPTIONS)
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'image_paradise/image_to_pdf/image_to_pdf.rb'
6
+
7
+ ImageParadise::ImageToPdf.new(ARGV)
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'image_paradise/class_methods/make_this_image_transparent.rb'
6
+
7
+ ImageParadise.make_this_image_transparent(ARGV)
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'image_paradise/rotate/rotate.rb'
6
+
7
+ ImageParadise.rotate_left(ARGV)
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ require 'image_paradise/rotate/rotate.rb'
6
+
7
+ ImageParadise.rotate_right(ARGV)
@@ -0,0 +1,162 @@
1
+ ADD_RUBY_HEADER
2
+
3
+ ## Flip-flopping an image from left-to-right
4
+
5
+ If you want to flip an image left-to-right, you can use
6
+ class <b>FlipImageLeftRight</b>. The file resides at
7
+ <b>image_paradise/toplevel_methods/flip_image_left_right.rb/</b>.
8
+
9
+ ## Rotating an image
10
+
11
+ (Technically this is similar to flip-flop, but I added this functionality
12
+ at a later point, so the flip-flop subsection here shall remain for the
13
+ time being.)
14
+
15
+ The commandline API for rotating an image called **FOOBAR.png**, in
16
+ regards to image_paradise, may go so:
17
+
18
+ imgparadise FOOBAR.png --rotate=33%
19
+ imgparadise foo.png --rotate=90%
20
+ imgparadise *.png --rotate=90%
21
+
22
+ Simply pass the rotation-value that you wish to use into --rotate.
23
+
24
+ Be careful, though - this command will overwrite the image, so **make
25
+ sure to backup your old image** before applying this command.
26
+
27
+ ## Transparent images
28
+
29
+ You can use this API to make an image transparent:
30
+
31
+ ImageParadise.make_this_image_transparent
32
+
33
+ This will try to make use of ImageMagick's **convert** ability.
34
+
35
+ ## Merging image files together
36
+
37
+ You can use the toplevel method **ImageParadise.merge_these_images**
38
+ in order to merge several image files together. This depends on the
39
+ binary called **convert**, from ImageMagick.
40
+
41
+ As first argument simply pass an Array of the files that you wish
42
+ to merge, such as:
43
+
44
+ ImageParadise.merge_these_images(%w( foo.png bar.png bla.png ))
45
+ ImageParadise.merge(%w( foo.png bar.png bla.png )) # <- This also works.
46
+
47
+ ## Greyscaling images
48
+
49
+ You can grayscale images via:
50
+
51
+ ImageParadise.greyscale_this_image()
52
+ ImageParadise.grayscale_this_image()
53
+
54
+ This currently (Jan 2019) depends on the gem called **mini_magick**. In
55
+ the future we may add some more flexibility to this method, but for the
56
+ time being mini_magick is a dependency if you wish to make use of
57
+ these **toplevel methods**.
58
+
59
+ Greyscaling an image may be useful if you wish to use this for
60
+ **optical character recognition**, aka recognising written text
61
+ on it.
62
+
63
+ ## Borders
64
+
65
+ You can add some borders to images.
66
+
67
+ The toplevel method **ImageParadise.add_black_border_to_this_image()**
68
+ can be used to add a black border to an image. The first argument to
69
+ this method is the path to the image at hand. The second argument
70
+ specifies the size of the border, in **pixels**. So the number **3**
71
+ as second argument would mean draw a border 3 pixel wide around the
72
+ image at hand.
73
+
74
+ Invocation example for the file called **foobar.png**:
75
+
76
+ ImageParadise.add_black_border_to_this_image('foobar.png',3)
77
+
78
+ Obviously for this to work, the file must exist.
79
+
80
+ ## class ImageParadiseImageToAscii
81
+
82
+ This class can convert images to ASCII files, if ImageMagick
83
+ (and the rmagick bindings) are available.
84
+
85
+ To specifically require this class, do this:
86
+
87
+ require 'image_paradise/requires/require_image_to_ascii.rb'
88
+
89
+ Then pass the filename into the class:
90
+
91
+ result = ImageParadise::ImageToAscii['foobar.jpg']
92
+ result = ImageParadise.image_to_ascii('foobar.jpg')
93
+
94
+ or
95
+
96
+ _ = ImageParadise::ImageToAscii.new '/foo/bar.png'
97
+ _.to_ascii # Generate the ascii "image" here specifically, via this method call.
98
+
99
+ or
100
+
101
+ print ImageParadise::ImageToAscii('yo.png').to_ascii(width: 50)
102
+
103
+ +--------------------------------------------------+
104
+ |oooooooooooooooooooooooooooooooooooooooooooooooooo|
105
+ |oooooooooooooooooooooooooooooooooooooooooooooooooo|
106
+ |oooooooooooooooooooooooooooooooooooooooooooooooooo|
107
+ |oooooooooooooooooo===++++====ooooooooooooooooooooo|
108
+ |ooooooooooooo=+:~.~........~~~:+=ooooooooooooooooo|
109
+ |oooooooooo==:~...~~:++++++:~~..~~:+=oooooooooooooo|
110
+ |oooooooo=+:...~++====oooo====+:~..~:+=oooooooooooo|
111
+ |ooooooo=+~..~:++==ooooooooooo=++:~..~+=ooooooooooo|
112
+ |oooooo=+~.~:+=+~.~~~~~~~~:~~~.~:++:~.~+=oooooooooo|
113
+ |ooooo=+~~.+===~................~+==:.~~+=ooooooooo|
114
+ |ooooo=:~~:+=+:~................~~+=+:~.:=ooooooooo|
115
+ |ooooo=~.~+==+~.......XXXXX.......+==+~.:=ooooooooo|
116
+ |ooooo=~~~+==:~.......XXXXX.......:==+~.:=ooooooooo|
117
+ |ooooo=~~~:==+~.......XXXXX......~+==+~.~=ooooooooo|
118
+ |ooooo=:~~~+=++~.................:+=+~~~:=ooooooooo|
119
+ |ooooo=+:..~+==+~~...........~~~+==+~..:+=ooooooooo|
120
+ |ooooooo+:..~:+=o=+:........:+====:~.~:==oooooooooo|
121
+ |oooooooo=+~.~~:+==+~......~+==+:~..~:+oooooooooooo|
122
+ |ooooooooo=+:~..~~:~~.......~:~~..~:+oooooooooooooo|
123
+ |oooooooooooo=+~~..............~:+=oooooooooooooooo|
124
+ |ooooooooooooooo==++:~~~~~~:++==ooooooooooooooooooo|
125
+ |oooooooooooooooooooooooooooooooooooooooooooooooooo|
126
+ |oooooooooooooooooooooooooooooooooooooooooooooooooo|
127
+ |oooooooooooooooooooooooooooooooooooooooooooooooooo|
128
+ +--------------------------------------------------+
129
+
130
+ Add colours via the "colour" option
131
+
132
+ require 'image_paradise'
133
+ a = ImageParadise::ImageToAscii.new "http://www.evangogh.org/images/paintings/self-portrait.jpg"
134
+ puts a.to_ascii(color: true)
135
+
136
+ Command Line examples:
137
+
138
+ image_to_ascii ~/Desktop/foo.png # Local file.
139
+ image_to_ascii http://www.google.com/images/foo.png # Remote image.
140
+ image_to_ascii -c -f html ~/foobar.jpg > ~/Desktop/ascii-as-html.html # Output via HTML.
141
+ image_to_ascii -w 50 -c -f html ~/foo/bar.jpg > ~/Desktop/saturdaynight.html # Or smaller.
142
+
143
+ To display help:
144
+
145
+ image_to_ascii -h
146
+
147
+ Usage: image_to_ascii [options] <path_or_url>
148
+ -w, --width WIDTH Width of the finished Ascii Image (Default: 150)
149
+ -f, --format [text/html] output format (Default: text)
150
+ -c, --color Switch to use colored terminal output (Default: false)
151
+ -i, --invert-chars Invert the character map. *Depending on background and image color - this can make the result clearer.*
152
+ -v, --version Show the version of this project
153
+ -h, --help Show this message
154
+
155
+ ## SVG
156
+
157
+ ImageParadise now has a submodule called **Svg**, for svg-related
158
+ objects. Documentation is currently missing for this part. Hopefully
159
+ I will have more time in the future to add the missing
160
+ documentation here. :\
161
+
162
+ ADD_CONTACT_INFORMATION