[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Duck images

Dave Burt

12/6/2004 5:35:00 AM

Hi,

Phil Tomson recently suggested developing a duck image to represent ruby
instead of the standard red stone thing.

Nikolai Weibull said this has been proposed before, but copyright
encumbrance has been an issue.

Phil said why the lucky stiff has talent. [ruby-talk:121973]

Why the lucky stiff drew what is apparently The Only Copyrightless Duck In
Recent History:
http://www.whythelucky...
An awesome anatid AFAICS.

My ducks are essentially copies of why's.

This is my first small contribution:
http://www.dave.burt.id.au/rub...
(16x16x4bit and 32x32x4bit)

The second is post-scripted as a sig should be.

Cheers,
Dave

_ ___
/ \ / \. |: cc|
(.|:,---,
(.|: \ c|
(. y-'
\ _ /
m m


34 Answers

T. Onoma

12/6/2004 8:33:00 AM

0

On Monday 06 December 2004 12:37 am, Dave Burt wrote:
| Hi,
|
| Phil Tomson recently suggested developing a duck image to represent ruby
| instead of the standard red stone thing.

This may help.

http://www.whyaduck.com...

| Nikolai Weibull said this has been proposed before, but copyright
| encumbrance has been an issue.
|
| Phil said why the lucky stiff has talent. [ruby-talk:121973]
|
| Why the lucky stiff drew what is apparently The Only Copyrightless Duck In
| Recent History:
| http://www.whythelucky...
| An awesome anatid AFAICS.
|
| My ducks are essentially copies of why's.
|
| This is my first small contribution:
| http://www.dave.burt.id.au/rub...
| (16x16x4bit and 32x32x4bit)
|
| The second is post-scripted as a sig should be.
|
| Cheers,
| Dave
|
| _ ___
| / \ / | \. |: cc|
| (.|:,---,
| (.|: \ c|
| (. y-'
| \ _ /
| m m

That is one messed up rabbit!

In fact, that's *no* sig. This is a sig!


.~NM.
+::O:+
.M::::. ,...
.:::D::MMM::=:MM .
.::M:::~:::~D:=DN:M
..M+:M: +:M:::MM,8:::M?::::,O
.M::::~:$M .::7MMMMM:~:::::M,:Z:,M
.M~:::::8~:M? .:N~DM::::::,:,:=:,,,,,M
.M::::::::::DOM .:M:D=O:,::,,,,:,,,,,,,,,+
.M::::::::::~=D: DM88:8:?:::,,=M,,,,,:,,:,,.
.N::?:::::::=::ND .=M:::$:,::::MMMMM,,MMM,,,,.
.D=::+::::::+?8:M .=.M~:8IN:::,:M,MMM,,MMMM,,,.
..M::?~~::::::~?M 8.M+NMN::::,M::~MM,,,,MM,,D.
..MM::::::OD:D .MD~~M:::::=MMMM,,,MMM,,,I
MO:::::7+$~ .ZOZ~::::::,7::,,,,,MM,,M .MM.
.:8::::::$Z~ .~::~::::::::::,,,,,,,,: .M:?:,Z,,.
~:M::::::$~~ 8~:~8:::::::::MM~M::=:?+7I,::MMMD,M.
:I$~::::~D:. ~~O:M8:,::::$,?MM:,::,,ND:::MMM=~,,.
.M:~:$::::?: .M$Z8N::::::::::M::::::::=,,MMMN=Z,,.
.DN:~:::~:~. .M8~N$:7:::::,M~N::::::?::,MMMDO?M,,.
.M$:::~:, .M8:::::=:,:::,,+::::::::,~MMD~8N=,?
.~:::~~M? .II?:D::::::::,::M::::::M:MMM,MN?,,M
.=:N::~:?: $:IMM?M:~,:~:+::,:M::::::,MMD+888,,.
M:Z~?~::~, MDMI~:8~:::::~:,,:: .~:,:MMMNMOM~,M
M:N:~:::I. .::?:N8:~88:~~::,,:M .:,:MMMMM,M,$.
.:$~:::?~ .M::$Z:~~:::D~=::::,M .I:,MMMMMM,
..M~:::M:M.M:M:OO8=::::~:M,::::7 M,,,7ZN,M.
...:~NO~$:8~:::~$=~~:~::::::. M,,,7.
M:::::8=8:~::::::~~::::::+.
.I:I~~::::=:::::::D:::::::M
.=~MNI:~:~:::Z:I:?:::::::D.
M:~::~:Z::~+:::O=::::::Z.
N:7:8Z$:~~~~:8~:+::::~M
M:::I:::+:::::?:::::M
.$N~=~:I:?N:::::::~N8.
.M~~MZ~:~=::OM=~:~M:~M
.OD~~~:~NMMO+?MM=:::::M
M~::~~~~ +M::,:.M .
.DDN.,MM .M?M.M
. . . .


GlassGiant.com

Now that's a duck! Can we call him Type?

:) Do you Ruby?


---
also try:
-http://jpg2asc.hierkl...
-http://www.text-...
-http://www.jave.de/image2ascii/compet... (specail delivery for JEGII)



Dave Burt

12/6/2004 11:14:00 AM

0

#!/usr/local/bin/ruby
# Copyright (c) 2000 Brian Fundakowski Feldman
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $Id: img2ascii.rb,v 1.5 2000/11/01 06:06:14 green Exp green $
#
# Convert an image into greyscale ASCII art.
#
# usage: img2ascii.rb [-hr] [-w width] [-a aspect] file

require 'GD'
require 'getopts'

scrnwidth = 80
aspect_ratio = 6.0 / 10.0

def usage(string = nil)
puts "error: " + string if string
$stderr.puts "usage: #{$0} [-hr] [-w width] [-a aspect] file"
exit 1
end

usage("invalid option") if !getopts("hr", "a:", "w:")
if $OPT_w
scrnwidth = $OPT_w.to_i
if scrnwidth <= 1
usage("bad width")
end
end
if $OPT_a
$OPT_a.gsub(/[[:space:]]/, '') =~
/^([[:digit:]]+\.?[[:digit:]]*?)(\/([[:digit:]]+\.?[[:digit:]]*))?$/
usage("bad number") if !$1 || $1.to_f == 0.0 || ($3 && $3.to_f == 0.0)
aspect_ratio = $3 ? ($1.to_f / $3.to_f) : $1.to_f
usage("negative ratio") if aspect_ratio == 0.0
end

usage("no file name") if !(name = ARGV.shift)
case name
when /\.jpe?g$/i
img = GD::Image.newFromJpeg(open(name, 'r'))
when /\.png$/i
img = GD::Image.newFromPng(open(name, 'r'))
when /\.xbm$/i
img = GD::Image.newFromXbm(open(name, 'r'))
when /\.xpm$/i
img = GD::Image.newFromXpm(open(name, 'r'))
else
usage("invalid file name")
end

gradient =
' .\'`,^:";~-_+<>i!lI?/\|()1{}[]rcvunxzjftLCJUYXZO0Qoahkbdpqwm*WMB8&%$#@'
gradient.reverse! if !$OPT_r
width, height = img.bounds
nwidth = [width, scrnwidth].min
# useful ratios
# xterm: 6x13, netscape <pre>: 6x10
nheight = (height.to_f * aspect_ratio * (nwidth.to_f / width.to_f)).to_i
usage("width too small") if nwidth <= 0
usage("height too small") if nheight <= 0

$stderr.printf("%s: %d x %d, %d colors -> %d x %d\n", name, width, height,
img.colorsTotal, nwidth, nheight)

nimg = GD::Image.new(nwidth, nheight)
img.copyResized(nimg, 0, 0, 0, 0, nwidth, nheight, width, height)

if $OPT_h
filters = [[/[[:space:]]*$/, ''], [/&/, '&amp;'], [/</, '&lt;'],
[/>/, '&gt;'], [/\[/, '&#91;'], [/\]/, '&#93']]
else
filters = [[/[[:space:]]*$/, '']]
end

(0...nheight).each {|h|
line = (0...nwidth).collect {|w|
pixcolor = nimg.getPixel(w, h)
colors = nimg.red(pixcolor) + nimg.green(pixcolor) + nimg.blue(pixcolor)
gradient[((colors.to_f / 765.1) * gradient.size).floor, 1]
}.join
filters.each {|*r| line.gsub!(r[0], r[1])}
puts line
}


Dave Burt

12/6/2004 12:17:00 PM

0

OK, here's another ASCII-style Ruby Duck (Type), this time using Jave (it's
really good!)

,_"oY/..
d/ d,`.|
Y' ' _, ...__
|. Y\/o/P\d|'Y8`Y\\._
'`'.PPPYY ''==oo ,.. '\\_
,_.Y-Yb\. | /\`"-Ybd`." --`YY. .| "\.
_,/"' `.\Y\ .',8Y\o-Y88''' ''-Y.--=. `.
,P"' '\P\\O| ,',8/ //' ``'' ' ` ,/ 'Y '\8 ,b'8``'b.' |.
../ \| | /'P.\ `/O' ,,/+-. ,__ ||
/ . \' \|\ `| '|'\ \/ /8888\. ,d88| |
\ \.-' / 'b|. /||'.',P / .Y/8|\8| .88P88 ,|
`o_'`',,_. | \`| |Y/||b_8YY |''''/8| |'Y'88| |'
'YP.._` | //,| 8|Y/P\' |bob888' |ob88" ./
./` \|,/| ||o|| | \8/P' `8 _ /' ___
/'`` ' '|| ||/|\/| '""" '' /' _,Y-'','"\.
| ' ' |\ ||//.V' _,.ooo-----/\-"'d _/ob. \.
'|,P' . |Y|8 ||| |8, ,Y 88b8' ' _ `' ,/88888|'|
\.'\/ . |\|8 | |`|| ' `/'Y88' `'/ ,8888//8| \_ '"., '/|| / b | ,,d\/ ,888888 P /
`"P._ |/ 8| /,. '' || .8888YY8\| |
,/' | P8 ||/| \ ' \. /888P8PP'' ||
,'._. | \| ||||// ' . `\. ` |8888YP'`` |'
// Y. \/ | 8,||||\\. . '\P. /888888/d' ,/
|' ' |' ||b| |/| ||\\Y'`.. /''\. 88888888\|./
\||`-' '|88 ,8` / ||| ' ,| `.' 88888888`,/'
\.-,\_/ |/| /'\\ \P/. ' || `. 'P8888'",/
'"P.___., /o_/'\|O8 ""\_ ' '' _| `\_ '`/P`_/
''8 "\o ,| Vd' '` ` / 'Y....''
|| ''\\^d' ,|
\ , , '`'' ||
\|'\P.. ' ' ` 8
`\ '.. ' |. ` |/
`\ /'`,` ' '' _ . ,' ,8'
`\. ' ' . /'
'8\_' ` /. ,/8.
||.'\\.. _. / .Y'. _/P''\.
\. '""-P...___o.//"' '\.
`\. || '\`_ ,Pd|
'.'.., ,-/ \.P,/d8'
\' `/ 'P' '


ptkwt

12/6/2004 5:32:00 PM

0

In article <vcSsd.61264$K7.35690@news-server.bigpond.net.au>,
Dave Burt <dave@burt.id.au> wrote:
>Hi,
>
>Phil Tomson recently suggested developing a duck image to represent ruby
>instead of the standard red stone thing.
>

Well, or maybe in addition to the red stone thing... a duck to represent
duck typing.

>Nikolai Weibull said this has been proposed before, but copyright
>encumbrance has been an issue.
>
>Phil said why the lucky stiff has talent. [ruby-talk:121973]
>
>Why the lucky stiff drew what is apparently The Only Copyrightless Duck In
>Recent History:
>http://www.whythelucky...
>An awesome anatid AFAICS.

What is that fox (I'm assuming that's a fox) on the back of the duck
represent? Is he whispering in the duck's ear? I just get the feeling
that the fox (if it is a fox) has some deep psychological meaning perhaps
representing the duck's deap-seated, primordial fear of foxes. Perhaps
it is the Fox of static typing? (appologies, Why, if it's not a fox)

>
>My ducks are essentially copies of why's.
>
>This is my first small contribution:
>http://www.dave.burt.id.au/rub...
>(16x16x4bit and 32x32x4bit)
>
>The second is post-scripted as a sig should be.
>
>Cheers,
>Dave
>
> _ ___
>/ \ / >\. |: cc|
> (.|:,---,
> (.|: \ c|
> (. y-'
> \ _ /
> m m
>
>

I dunno. Looking at this ASCII version, I see a squirrel.

Phil

ptkwt

12/6/2004 5:35:00 PM

0

In article <c5Ysd.61656$K7.46804@news-server.bigpond.net.au>,
Dave Burt <dave@burt.id.au> wrote:
>OK, here's another ASCII-style Ruby Duck (Type), this time using Jave (it's
>really good!)
>
> ,_"oY/..
> d/ d,`.|
> Y' ' _, ...__
> |. Y\/o/P\d|'Y8`Y\\._
> '`'.PPPYY ''==oo ,.. '\\_
> ,_.Y-Yb\. | /\`"-Ybd`." --`YY. .| "\.
> _,/"' `.\Y\ .',8Y\o-Y88''' ''-Y.--=. `.
> ,P"' '\P\\O| ,',8/ //' ``'' ' `> ,/ 'Y '\8 ,b'8``'b.' |.
>./ \| | /'P.\ `/O' ,,/+-. ,__ ||
>/ . \' \|\ `| '|'\ \/ /8888\. ,d88| |
>\ \.-' / 'b|. /||'.',P / .Y/8|\8| .88P88 ,|
>`o_'`',,_. | \`| |Y/||b_8YY |''''/8| |'Y'88| |'
> 'YP.._` | //,| 8|Y/P\' |bob888' |ob88" ./
> ./` \|,/| ||o|| | \8/P' `8 _ /' ___
> /'`` ' '|| ||/|\/| '""" '' /' _,Y-'','"\.
> | ' ' |\ ||//.V' _,.ooo-----/\-"'d _/ob. \.
> '|,P' . |Y|8 ||| |8, ,Y 88b8' ' _ `' ,/88888|'|
> \.'\/ . |\|8 | |`|| ' `/'Y88' `'/ ,8888//8| > \_ '"., '/|| / b | ,,d\/ ,888888 P /
> `"P._ |/ 8| /,. '' || .8888YY8\| |
> ,/' | P8 ||/| \ ' \. /888P8PP'' ||
> ,'._. | \| ||||// ' . `\. ` |8888YP'`` |'
> // Y. \/ | 8,||||\\. . '\P. /888888/d' ,/
> |' ' |' ||b| |/| ||\\Y'`.. /''\. 88888888\|./
> \||`-' '|88 ,8` / ||| ' ,| `.' 88888888`,/'
> \.-,\_/ |/| /'\\ \P/. ' || `. 'P8888'",/
> '"P.___., /o_/'\|O8 ""\_ ' '' _| `\_ '`/P`_/
> ''8 "\o ,| Vd' '` ` / 'Y....''
> || ''\\^d' ,|
> \ , , '`'' ||
> \|'\P.. ' ' ` 8
> `\ '.. ' |. ` |/
> `\ /'`,` ' '' _ . ,' ,8'
> `\. ' ' . /'
> '8\_' ` /. ,/8.
> ||.'\\.. _. / .Y'. _/P''\.
> \. '""-P...___o.//"' '\.
> `\. || '\`_ ,Pd|
> '.'.., ,-/ \.P,/d8'
> \' `/ 'P' '
>
>

This is the one we should dig up whenever anyone posts something about
adding static typing to Ruby. ;-)

Phil

why the lucky stiff

12/6/2004 6:49:00 PM

0

Phil Tomson wrote:

>What is that fox (I'm assuming that's a fox) on the back of the duck
>represent? Is he whispering in the duck's ear? I just get the feeling
>that the fox (if it is a fox) has some deep psychological meaning perhaps
>representing the duck's deap-seated, primordial fear of foxes. Perhaps
>it is the Fox of static typing? (appologies, Why, if it's not a fox)
>
>
It's an upright horse. His name is Audie the Upright Horse. He's the
duck's owner. And, yes, of course he has deep psychological meaning
that ranges from a harsh criticism of existensialism to my own childhood
fear of broken calculators. It's all there.

But, Great Coats! That huge ascii duck is marvellous. You done it
well, Dave Burt.

_why


T. Onoma

12/6/2004 6:57:00 PM

0

Cool! Did you submit to the contest?

On Monday 06 December 2004 06:17 am, Dave Burt wrote:
| #!/usr/local/bin/ruby
| # Copyright (c) 2000 Brian Fundakowski Feldman
| # All rights reserved.
| #
| # Redistribution and use in source and binary forms, with or without
| # modification, are permitted provided that the following conditions
| # are met:
| # 1. Redistributions of source code must retain the above copyright
| # notice, this list of conditions and the following disclaimer.
| # 2. Redistributions in binary form must reproduce the above copyright
| # notice, this list of conditions and the following disclaimer in the
| # documentation and/or other materials provided with the distribution.
| #
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
| PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
| LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
| CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
| SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
| INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
| CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
| ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
| THE POSSIBILITY OF # SUCH DAMAGE.
| #
| # $Id: img2ascii.rb,v 1.5 2000/11/01 06:06:14 green Exp green $
| #
| # Convert an image into greyscale ASCII art.
| #
| # usage: img2ascii.rb [-hr] [-w width] [-a aspect] file
|
| require 'GD'
| require 'getopts'
|
| scrnwidth = 80
| aspect_ratio = 6.0 / 10.0
|
| def usage(string = nil)
| puts "error: " + string if string
| $stderr.puts "usage: #{$0} [-hr] [-w width] [-a aspect] file"
| exit 1
| end
|
| usage("invalid option") if !getopts("hr", "a:", "w:")
| if $OPT_w
| scrnwidth = $OPT_w.to_i
| if scrnwidth <= 1
| usage("bad width")
| end
| end
| if $OPT_a
| $OPT_a.gsub(/[[:space:]]/, '') =~
| /^([[:digit:]]+\.?[[:digit:]]*?)(\/([[:digit:]]+\.?[[:digit:]]*))?$/
| usage("bad number") if !$1 || $1.to_f == 0.0 || ($3 && $3.to_f == 0.0)
| aspect_ratio = $3 ? ($1.to_f / $3.to_f) : $1.to_f
| usage("negative ratio") if aspect_ratio == 0.0
| end
|
| usage("no file name") if !(name = ARGV.shift)
| case name
| when /\.jpe?g$/i
| img = GD::Image.newFromJpeg(open(name, 'r'))
| when /\.png$/i
| img = GD::Image.newFromPng(open(name, 'r'))
| when /\.xbm$/i
| img = GD::Image.newFromXbm(open(name, 'r'))
| when /\.xpm$/i
| img = GD::Image.newFromXpm(open(name, 'r'))
| else
| usage("invalid file name")
| end
|
| gradient =
| ' .\'`,^:";~-_+<>i!lI?/\|()1{}[]rcvunxzjftLCJUYXZO0Qoahkbdpqwm*WMB8&%$#@'
| gradient.reverse! if !$OPT_r
| width, height = img.bounds
| nwidth = [width, scrnwidth].min
| # useful ratios
| # xterm: 6x13, netscape <pre>: 6x10
| nheight = (height.to_f * aspect_ratio * (nwidth.to_f / width.to_f)).to_i
| usage("width too small") if nwidth <= 0
| usage("height too small") if nheight <= 0
|
| $stderr.printf("%s: %d x %d, %d colors -> %d x %d\n", name, width, height,
| img.colorsTotal, nwidth, nheight)
|
| nimg = GD::Image.new(nwidth, nheight)
| img.copyResized(nimg, 0, 0, 0, 0, nwidth, nheight, width, height)
|
| if $OPT_h
| filters = [[/[[:space:]]*$/, ''], [/&/, '&amp;'], [/</, '&lt;'],
| [/>/, '&gt;'], [/\[/, '&#91;'], [/\]/, '&#93']]
| else
| filters = [[/[[:space:]]*$/, '']]
| end
|
| (0...nheight).each {|h|
| line = (0...nwidth).collect {|w|
| pixcolor = nimg.getPixel(w, h)
| colors = nimg.red(pixcolor) + nimg.green(pixcolor) + nimg.blue(pixcolor)
| gradient[((colors.to_f / 765.1) * gradient.size).floor, 1]
| }.join
| filters.each {|*r| line.gsub!(r[0], r[1])}
| puts line
| }



T. Onoma

12/6/2004 7:03:00 PM

0

On Monday 06 December 2004 12:52 pm, Phil Tomson wrote:
| > _   ___
| >/ \ /   | >\. |: cc|
| > (.|:,---,
| > (.|: \ c|
| > (.    y-'
| >  \ _ /
| >   m m
|
| I dunno. Looking at this ASCII version, I see a squirrel.

Which is why is so perfect for representing duck typing. Is it a squirrel? Is
it a rabbit? No! Its Type, the shape-shifting duck!

What a master of disguise! Check him out with his bifocals on:

/ \ /   \. |:-OO-|
(.|:,---,
(.|: \ c|
(.    y-'
 \ _ /
  m m

T.



Michael DeHaan

12/6/2004 7:13:00 PM

0

0>
`O
^^^^^^^^^^^^^^^^^^
Quack.


pat eyler

12/6/2004 7:39:00 PM

0

shouldn't that be:

0< quack
`O
^^^^^^^^^^^^^^^^^^


On Tue, 7 Dec 2004 04:13:22 +0900, Michael DeHaan
<michael.dehaan@gmail.com> wrote:
> 0>
> `O
> ^^^^^^^^^^^^^^^^^^
> Quack.
>
>