ruby_avatar_smith 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8ca3e03d954d4c9ea0aeea0a9f8d8b570197f8304e85ffb1f1ac7910ea76bf24
4
+ data.tar.gz: 73db8f2a0007de828493c16c178fbda12881047105aadf3ca0a637f66fe96f26
5
+ SHA512:
6
+ metadata.gz: 9540509b38c133b516606810bc50f2b4f9863396ad62b2f886fd70af9170157a355ecfc8dec6a6434866222f01d2924e8c3d8c4f87c6cec1154747776c98c421
7
+ data.tar.gz: 1f80f3fc6379cdd12711ce3436e13306e95c5c0e069446a4a2f7c7fa47972dce8b066f23523cb112eeaeea03ad0c3ba895a80c681823fbd7dae46f06490d2a6a
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyAvatarSmith
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rmagick'
4
+ require_relative 'ruby_avatar_smith/version'
5
+
6
+ module RubyAvatarSmith
7
+ class Error < StandardError; end
8
+
9
+ # Generates a random image with the specified width, height, and text annotation.
10
+ #
11
+ # @param width [Integer] The width of the image.
12
+ # @param height [Integer] The height of the image.
13
+ # @param text [String] The text to be annotated on the image.
14
+ # @return [Magick::Image] The generated image with the text annotation.
15
+ def self.create_random_image(width, height, text)
16
+ rand_colour = "rgb(#{rand(0..256)}, #{rand(0..256)}, #{rand(0..256)})"
17
+ randam_bg = Magick::Image.new(width, height) { |col| col.background_color = rand_colour }
18
+
19
+ text_over_image = Magick::Draw.new
20
+ text_over_image.annotate(randam_bg, 0, 0, 0, 0, text) do |x|
21
+ x.fill = 'gray83'
22
+ x.gravity = Magick::CenterGravity
23
+ x.pointsize = 50
24
+ end
25
+
26
+ randam_bg
27
+ end
28
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ruby_avatar_smith
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - KapilDevPal
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-05-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rmagick
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.0'
27
+ description: ruby_avatar_smith is a Ruby gem that provides functionality to generate
28
+ avatars with user initials. It can be used to create profile pictures dynamically.
29
+ email:
30
+ - dev.kapildevpal@gmail.com
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - lib/ruby_avatar_smith.rb
36
+ - lib/ruby_avatar_smith/version.rb
37
+ homepage: https://github.com/KapilDevPal/ruby_avatar_smith
38
+ licenses:
39
+ - MIT
40
+ metadata:
41
+ allowed_push_host: https://rubygems.org
42
+ homepage_uri: https://github.com/KapilDevPal/ruby_avatar_smith
43
+ source_code_uri: https://github.com/KapilDevPal/ruby_avatar_smith
44
+ changelog_uri: https://github.com/KapilDevPal/ruby_avatar_smith/blob/main/CHANGELOG.md
45
+ post_install_message:
46
+ rdoc_options: []
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '3.0'
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubygems_version: 3.5.3
61
+ signing_key:
62
+ specification_version: 4
63
+ summary: A Ruby gem for generating avatars with user initials.
64
+ test_files: []