Sha256: 22e2fcf640fb38d119761cffb981e73385d465d34281a9f02a25fe55dded79c5

Contents?: true

Size: 936 Bytes

Versions: 1

Compression:

Stored size: 936 Bytes

Contents

#!/ur/local/bin/ruby
# $premshree$ $2005-03-18 03:13$

require 'GD'
include GD

img = Image.newFromPng(File.new('firefox.png', 'rb'))
text = 'FIREFOX'

width = img.width
height = img.height
temps = [0]*3
skip_pixels = 1
skip_lines = 2
char_next = 0
print '<pre style="background: #FFFFFF">'
height.times { |i|
	if temps[2] == 0
		width.times { |j|
			if temps[1] == 0
				idx = img.getPixel(j, i)
				color = img.rgb(idx)
				print "<span style=\"color: rgb(#{color[0]}, #{color[1]},
				 #{color[2]}); font-size:10px;\">#{text.split('')[char_next]}</span>"
				char_next = char_next + 1
				if char_next == text.split('').length then char_next = 0 end
			end
			temps[1] = temps[1] + 1
			if temps[1] == skip_pixels then temps[1] = 0 end
			if temps[0] == width
				print '<br />'
				temps[0] = 0
			end
			temps[0] = temps[0] + 1			
		}
	end
	temps[2] = temps[2] + 1
	if temps[2] == skip_lines then temps[2] = 0 end
}
print '</pre>'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
carats-0.3.0 lib/carat-dev/premshree.rb