cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Looking for quick-add? Try the external resource search, it's quicker and gives you access to the most recent version of thousands of libraries. ☝️

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <head>
          
    </header>

  <a name="HOME">HOME</a>
<header><center>
        <div class="text-vcenter"><h1>***Glaser Electronic Portfolio***</div>
    </header>


  
</head>
 
<body>
  
  <p><h3>
  
  
  <table border ="5" CellPadding ="10"  CellSpacing ="20"
    <tr> 
      <td><center><font color="purple">Image from Scratch & Code</td><td>  <center><font color="purple">Original & Modified Photos <td><center><font color="purple">Steganography</td>
      <font color="blue"><h6><ul><tr> 
      <td><center><font color="blue"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/496283/myImage(1).png" width="105%"/<a  href="https://codepen.io/dragonfly/details/yOLeWB/" > </a></td><td><center><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/496283/myImage(3).png" width="50%" /></td><td><a href= "#Steg1">Original 1</a><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/496283/smalluniverse.jpg" width="50%"/><br> </td><font color="blue"><h6><ul><tr> 
      <td><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/496283/First_Original.png"width="105%"/><center><font color="blue"></td><td><img src= "https://s3-us-west-2.amazonaws.com/s.cdpn.io/496283/myImage(5).png" width="90%" /> <td><font color="purple"><a href= "#Steg2">Original 2</a> <center><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/496283/smallmessage.png"/></td>
      <font color="blue"><h6><ul>
        <font color="blue"><h6><ul><tr> 
      <td><h1><em>HTML
        <center><font color="blue"></td><td><center> <a Href="#Part1: Original Image">Click to Part 1: Original Image</a<br><br><br><a Href = "#Original">Click to Part 2: Image To Modify</a><br><a Href ="#Steganography"><br><br>Click to Part 3: Steganography</a>   <center><font color="orange">  <td><a href= "#Steg3"<Hidden Image</a><center><font color="purple"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/496283/myImage(9).png" Width="75%"/></td>
      <font color="blue"><h6><ul><tr> 
        <td><center><h1><font color="black">CSS</td><td>  <center><font color="BLACK"><h1>JAVASCRIPT</td>  <td><font color="purple"><a href= "#Steg4">Extract</a><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/496283/myImage(10).png"></td></tr></table>
       <head>
  
 
<body>
  <p><h1>
  
  <center><em>Glaser Electronic Portfolio <head><br><A name ="Part1: Original Image"></a><br> 
    <img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/496283/myImage(1).png" width ="20%"/><br><br> <h3> CODE: </center><H4><CENTER> 
   var image = new SimpleImage(256,256);<BR>
 for(var pixel of image.values()){<BR>
     if(pixel.getY()>2*image.getHeight()/9 +45*Math.sin(pixel.getX()/20))<BR>
     var x = (pixel.getX()/128.0) - 1;<BR>
     var y = (pixel.getY()/128.0) - 1;<BR>
     var value = (x/y +1)*128;<BR>
     pixel.setRed(10);<BR>
     pixel.setGreen(value);<BR>
     pixel.setBlue(100);<BR>    
 }
 print(image);<BR>
    
    <Center><h2>EXPLANATION </center>
The desired colors for this was green and purple.<br> Therefore, the RGB values were set topixel.setRed(150);<br>     pixel.setGreen(value);     pixel.setBlue(150);
I wanted a wavy effect so tried incorporating the sin wave algo.<br> (At some point, I want to use a dragonfly logo and I think working with this sin function could be useful.) <br> The if statement in the first line of the for loop is computing a sin wave based on the x value. It checks if the y-value is above a certain value or below a certain value. <br> The 2 is the only difference between comparison of the pixel.getY() less than an and the pixel.getY()greater than. <br> The two lines within the loop transform the original (x,y) values from their range of 0…255 to -1..1 as stored in the local variables x and y. <br>  
for(var pixel of image.values()){
     if(pixel.getY()>2*image.getHeight()/9 +45*Math.sin(pixel.getX()/20))
Then, the third line divides x by y which produces interesting results because it “reverses the sign” putting high values (bright) ext to low values (dark) because -1/-1 is a positive value and -1/1 is a negative value.  
     var value = (x/y +1)*128;<br>
The end expression changes the resulting division back from the range -1…1 to Java’s color range of 0…255.<br>
      var value = (x/y +1)*128;<br><br><br><h1><A HREF = "#HOME">BACK TO TOP OF PAGE</a><br><br><br>
      
  <p>     
  
  <em>Glaser Electronic Portfolio<br>Part 2:Code<br>for<br><a name = "Original"> Image & Modified Image</a>    
  <h4></center><center>First Photo of Easter Eggs in Gray Scale<br>
gray scale
var egg = new SimpleImage("eastereggs.jpg");<br>
for (var p of egg.values()) {
    var avg = (p.getGreen() + p.getRed() + p.getBlue()) / 3;<br>
    p.setRed(avg);<br>
    p.setBlue(avg);<br>
    p.setGreen(avg);<br>
}
print(egg);<br>

<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/496283/myImage(3).png" width="25%" /><br><br><img src= "https://s3-us-west-2.amazonaws.com/s.cdpn.io/496283/myImage(5).png" width="50%" /><br>
Converting from Grey Scale to MANY PHOTOS of Colorful Easter Eggs<br>
var image = new SimpleImage("eastereggs.jpg");<br>
w = image.getWidth();<br>
h = image.getHeight();<br>
var outimage= new SimpleImage(2*w,2*h);<br>
for (var pixel of outimage.values()){
 x = pixel.getX();<br>
 y = pixel.getY();<br>
 if (x<=w-1 && y<=h-1){
 var p = image.getPixel(x,y);<br>
 }
 else if (x>w-1 && y<=h-1) {
 var p = image.getPixel((x-w),y);<br>
 }
 else if (x<=w-1){
 var p = image.getPixel(x,(y-h));<br>
 }
 else var p = image.getPixel((x-w),(y-h));
 pixel.setRed(p.getRed());<br>
 pixel.setGreen(p.getGreen());<br>
 pixel.setBlue(p.getBlue());<br>
}
print(outimage);<br>
var image = new SimpleImage("rodger.png");<br>
w = image.getWidth();<br>
h = image.getHeight();<br>
var outimage= new SimpleImage(2*w,2*h);<br>
for (var pixel of outimage.values()){
 x = pixel.getX();<br>
 y = pixel.getY();<br>
 if (x<=w-1 && y<=h-1){
 var p = image.getPixel(x,y);<br>
 }
 else if (x>w-1 && y<=h-1) {
 var p = image.getPixel((x-w),y);<br>
 }
 else if (x<=w-1){
 var p = image.getPixel(x,(y-h));<br>
 }
 else var p = image.getPixel((x-w),(y-h));<br>
 pixel.setRed(p.getRed());<br>
 pixel.setGreen(p.getGreen());<br>
 pixel.setBlue(p.getBlue());<br>
}
print(outimage);
     
      <A HREF = "#HOME"><br><br>BACK TO TOP OF PAGE</a><br><br><br><h3><br><br>
    <head>
    
    <tr> 
      <em><center>Glaser Electronic Portfolio: <a name="Steganography"></a><br>CODE & EXPLANATION<BR><H4>
function pixchange(pixval){
    var x = Math.floor(pixval/16) * 16;
    return x;<BR>
}
function chop2hide(image){
    for(var px of image.values()){
        px.setRed(pixchange(px.getRed()));<BR>
        px.setGreen(pixchange(px.getGreen()));
        px.setBlue(pixchange(px.getBlue()));<BR>
    }
    return image;
}
function shift(im){
  var nim = new SimpleImage(im.getWidth(), 
                            im.getHeight());<BR>
  for(var px of im.values()){
    var x = px.getX();<BR>
    var y = px.getY();<BR>
    var npx = nim.getPixel(x,y);<BR>
    npx.setRed(Math.floor(px.getRed()/16));<BR>
    npx.setGreen(Math.floor(px.getGreen()/16));<BR>
    npx.setBlue(Math.floor(px.getBlue()/16));<BR>
  }
  return nim;<BR>
}
var start = new SimpleImage("smalluniverse.jpg");<BR>
var hide = new SimpleImage("smallmessage.png");<BR>

start = chop2hide(start);<BR>
hide = shift(hide);<BR>
Print(start)
    print(hide);<BR></CENTER><BR><H6><center><h3>Explanation of code: First, the program checks that the two source pictures are the same size.<br> Next, a continuous for (while/true) loop starts to process each pixel.<br> A bitwise ANDed operation processes each color value of the covering image with binary code (1111 1100) to mask out the two lowest bits. <br>The hidden source image is ANDed with 1100 0000 and the bits are shifted 6 places to the lowest bits.<br>  The two bytes are then ORed (any value ORed with 0 is unchanged so the background is unaffected) and the merged byte is formed.   

  <table border ="5" CellPadding ="10"  CellSpacing ="20" 
    <tr> 
        <td><center><font color="purple"><a name ="Steg1">Original Image 1</a></td><td><center><font color="purple"><a name="Steg2"></a>Original Image 2  <td><center><font color="purple"><a name="Steg3"></a> Hidden Image</td><td><center><font color="purple"><a name = "Steg4"></a>Extract Image<tr> 
      <td><center><font color="purple"> </td><td>  <center><font color="purple">  <td><center><font color="purple"></td><td><center><font color="purple"><tr><td><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/496283/smalluniverse.jpg"width="75%" /><td><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/496283/smallmessage.png" width="75%"/><td><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/496283/myImage(9).png"width="75%" /><td><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/496283/myImage(10).png" width="75%" /><center><tr><br></td><br><A HREF = "#HOME"><br><br>BACK TO TOP OF PAGE</a>
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Righteous|Roboto);
h1 {text-align: center; background-color: #cc99ff;}
table border {background-color: black;}
ul {list-style-type:none;}
p {
    background-color: #ff6600;
}
tr {
    background: #99ff99;
}  
h6 {background-color: lightyellow;}
ul{background-color: lightyellow;}

div {
    width: 500px;
    height: 100px;
    border: 3px solid #73AD21;
}
div {
    width: 500px;
    height: 50px;
    border: 3px solid #73AD21;
}



            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console