Add to Technorati Favorites
Welcome to ThePowerShellGuy.com Sign in | Join | Help

PoSH Challenge part 6

Level 7 is the first level in the the python challenge that involves working with bitmaps,

before I give my answer to this level of the Python challenge

I made a small PoSH version ,

* Reader Challenge * what text is hidden in the following picture ?

 

to get you going you can take a look at my solution for level 7 of the Python challenge :

<?xml version="1.0"?>
[System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")

$bm = [System.Drawing.Bitmap]::FromFile( 'C:\_spons\oxygen.png' )
$a = 0..607 |% {$bm.GetPixel($_,50)} |% {$_.r}
$line = ""
for ($i=0;$i -lt 607;$i+=7) {$line += [char]$a[$i]}
$line

$ofs = ''
"$([regex]::Match($line,'\[(.*)\]').groups[1].value.split(',') |% {[char][int]$_.trim()})"

and as my PowerShell example is a bit simpler as the Python one, 3 lines should do for it (including loading of system.drawing namespace and opening the piano.png picture ;-)

More PowerShell bitmap fun later in this series.

Enjoy,

Greetings /\/\o\/\/

PS. anonymous comments are disabled as I got to much spam,  to be able to post your answer to the comments, you need to register. You can find a link to the registration page on the top right corner of the blog,  this is an easy process, without a need to provide personal data

Published Thursday, January 17, 2008 4:40 PM by MoW
Attachment(s): piano.PNG

Comments

# PoSH Challenge part 8

And another update at the PoSH Challenge front, I'm arrived at Level 20 ,(had to cheat a bit at&#160;

Monday, January 21, 2008 5:44 PM by The PowerShell Guy

# More fun with Bitmaps in Powershell ( PoSH Challenge part 10 )

As I entered another level about bitmaps, I will reflect a bit more about the way of working with bitmaps

Monday, January 28, 2008 4:46 PM by The PowerShell Guy
Anonymous comments are disabled