Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
adam.ts
About Me:
i am adam
adam.ts's Profile
3
Posts
43
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
Simple image Steganography
[1 Reply]
15-Jul-2010 03:08 PM
Forum:
Share your Work
http://en.wikipedia.org/wiki/Steganography
I have created a simple steganography creator and interpreter
to use copy the programs, and run the first one stegcreator
pick the image you want to hide first, the cover one second, and the image steg.png will be created in your sketch folder.
To unhide your image copy steg.png into the other sketch folder, and run the other sketch click the screen and there is your image
ps. not for use by terrorists
hiding sketch
PImage steg,hide;
int hidr =0;
int hidg =0;
int hidb =0;
String hidePath,maskPath;
//created by adam schmidt
void setup(){
frame.setTitle("Athaddiustego");
hidePath = selectInput();
maskPath = selectInput();
hide = loadImage(hidePath);
steg = loadImage(maskPath);
// image(steg,0,0);
steg.loadPixels();
hide.loadPixels();
for(int x =0;x<1000;x++){
for(int y =0;y<1000;y++){
if(x<hide.width&&y<hide.height){
int hidcol =hide.pixels[x+y*hide.width];
hidr = (hidcol >> 16) & 0xFF; // Faster way of getting red(argb)
hidg = (hidcol >> 8) & 0xFF; // Faster way of getting green(argb)
hidb = hidcol & 0xFF; //0xff==0000000000011111111
//
hidr= hidr>>5;//only 3 bitsout of 8
//
//
hidg=hidg>>5;
//
//
hidb=hidb>>5;
}else{
hidr =0;
hidb =0;
hidg =0;
}
int col =steg.pixels[x+y*steg.width];
int r = (col >> 16) & 0xFF; // Faster way of getting red(argb)
int g = (col >> 8) & 0xFF; // Faster way of getting green(argb)
int b = col & 0xFF; // Faster way of getting blue(argb)
b= b&248;//11111000= 254 0&0 =0; 1&0 =0 1&1=0;// clears only last one//down 2^bit-1 from 255 per bit
b = b|hidb;//1||0 = hidb; b= 0; | so 0&0 =0; 1&0 =1 1&1=0;
r= r&248;//11111000= 254 0&0 =0; 1&0 =0 1&1=0;// clears only last one
r = r|hidr;//1||0 = hidb; b= 0; | so 0&0 =0; 1&0 =1 1&1=0;
g= g&248;//11111000= 254 0&0 =0; 1&0 =0 1&1=0;// clears only last one
g = g|hidg;//1||0 = hidb; b= 0; | so 0&0 =0; 1&0 =1 1&1=0;
steg.pixels[x+y*steg.width]=color(r,g,b);
}
}
steg.updatePixels();
steg.save("steg.png");
}
void draw(){
}
uncovering sketch
PImage steg;
int c =1;
int t =0;
//created by adam schmidt
void setup(){
steg = loadImage("steg.png");
size(steg.width,steg.height);
image(steg,0,0);
}
void draw(){
t=0;
image(steg,0,0);
}
void mouseClicked(){
steg.loadPixels();
for(int x =0;x<width;x++){
for(int y =0;y<width;y++){
int col =steg.pixels[x+y*width];
int r = (col >> 16) & 0xFF; // Faster way of getting red(argb)
int g = (col >> 8) & 0xFF; // Faster way of getting green(argb)//n from 0-7
int b = col & 0xFF;
//if((b&0x1)==0){//just like normal color mask this one is only las bit tho
steg.pixels[x+y*width]=color((r&0x7)<<5,(g&0x7)<<5,(b&0x7)<<5);
// }2^bit-1//0x7=111
// if((b&0x1)==1){
// steg.pixels[x+y*width]=color(255);
// }
}
}
steg.updatePixels();
}
this type of steganography masks the last 3 bits so it supports (i think) 512 colors
metaballs
[19 Replies]
13-Jul-2010 01:59 PM
Forum:
Share your Work
here is a sketch i made it uses the metaball equation.
the black areas are negative metaballs.
I am going to try to expand it to 3d
Frames and Gravity
[7 Replies]
18-Jun-2010 07:50 PM
Forum:
Share your Work
here is the program i have been working on it experiments on windows shaped as circles with gravity also clicking inverts gravity
PFont font;
import java.awt.event.*;
//import javax.swing.*;
import java.awt.*;
int pl = int(random(20,200));
Planet[] planets = new Planet[pl];
import com.sun.awt.AWTUtilities;
import java.awt.GraphicsDevice.*; // PC only
import java.awt.Shape;
import java.awt.Robot;
import java.awt.AWTException;
import java.awt.event.InputEvent;
import java.awt.MouseInfo;
import java.awt.geom.*;
//import javax.swing.*;
Robot robby;
int d =500;
int y =d/2;
int x = d/2;
boolean press = false;
public void init(){
// to make a frame not displayable, you can
// use frame.removeNotify()
frame.removeNotify();
frame.setUndecorated(true);
// addNotify, here i am not sure if you have
// to add notify again.
//frame.addNotify();
// frame.removeNotify();
super.init();
}
void setup() {
try
{
robby = new Robot();
}
catch (AWTException e)
{
println("Robot class not supported by your system!");
exit();
}
size(d,d);
background(255);
//frame.setUndecorated(true);
frame.setSize(int(d), int(d));
noStroke();
frame.setAlwaysOnTop(true);
frame.setLocation(0,0);
AWTUtilities.setWindowOpaque(frame, false);
AWTUtilities.setWindowOpacity(frame, 0.01f);
//frame.setBackground(new Color(0,0,0,255));
//frame.setVisible(true);
Shape shape = null;
shape = new Ellipse2D.Float(0, 0, d, d);
AWTUtilities.setWindowShape(frame, shape);
for (int i = 0; i< planets.length; i++ ) {
float x = random(1,1000);
float y = random(1,1000);
int xy = int (x*1);
int yx= int (y*1);
int co = int(random(1,255));
int col = int(random(1,255));
int colo = int(random(1,255));
float dimeter = random(6,40);
float velx1 = random(0,5);
float vely1 = random(0,5);
// float vely1 = -velx1;
// if (i == planets.length-1){
// xy = screen.width/2;
// yx = screen.height/2;
// dimeter = 250;
// velx1 = 0;
// vely1 = 0;
// co =255;
// col =255;
// colo = 0;
// }
planets[i] = new Planet(dimeter,xy,yx,co,col,colo,i,velx1,vely1);
}
}
void draw() {
if(mousePressed == true){
press = true;
}
else{
press = false;
}
background(0);
x = int(MouseInfo.getPointerInfo().getLocation().x)-d/2;
y =int(MouseInfo.getPointerInfo().getLocation().y)-d/2;
frame.setLocation(x,y);
for (int i = 0; i < planets.length; i++ ) {
// planets[i].display(i);
planets[i].update();
// planets[i].checkEdges();
planets[i].daw(i);
}
//println(MouseInfo.getPointerInfo().getLocation() + " | ");
}
class Planet extends PApplet implements MouseListener {
Frame frame;
final static int SIZE = 20;
int t;
float xcc = 0;
float ycc = 0;
float xpos;
float ypos;
float diameter;
int sunypos = 500;
int sunxpos = 500;
float gravmax = .1;
int col1;
int col2;
int col3;
int curplanet;
int num;
int i = 1;
//public void init(){
// addMouseListener(this);
//}
Planet(float diameter_,float xpos_,float ypos_,int co1,int co2,int co3,int planet,float velx,float vely) {
diameter = diameter_;
xpos = (xpos_);
ypos = (ypos_);
col1 = co1;
col2 =co2;
col3 =co3;
curplanet = planet;//planet number
xcc = velx;
ycc= vely;
frame = new Frame();
// frame.getContentPane().add(new MyComponent());
frame.setUndecorated(true);
frame.setSize(int(diameter), int(diameter));
frame.setLocation(floor(xpos), floor(ypos));
frame.setAlwaysOnTop(true);
frame.setBackground(new java.awt.Color(col1, col2, col3,255));//due to 1.1
frame.setVisible(true);
Shape shape = null;
shape = new Ellipse2D.Float(0, 0, diameter, diameter);
AWTUtilities.setWindowShape(frame, shape);
// AWTUtilities.setWindowOpaque(this.frame, false);
//AWTUtilities.setWindowOpacity(this.frame, 1f);
//println(AWTUtilities.getWindowOpacity(frame));
ypos = ypos-diameter/2;
xpos = xpos-diameter/2;
}
void update() {
// float area = (((diameter/2)*(diameter/2))*3.1415);
for (int i = 0;i < planets.length; i++) {
if(i == curplanet){
continue;
}
float area1 = ((((planets[i].diameter/2))*(planets[i].diameter/2)*(planets[i].diameter/2))*3.1415);
float disty = (planets[i].ypos-ypos);
float distx = (planets[i].xpos-xpos);
float distfull = sqrt(distx*distx+disty*disty);
if (distfull < (planets[i].diameter/2)){
continue;
}
float acc = (.01) *(area1/(distfull*distfull));
// print(" dist x="+distx);
// print(" dist y="+disty);
// print(" full="+distfull);
// println(" acc="+acc);
//.0000000000667*distx
xcc = xcc + (acc*distx/distfull);
ycc = ycc + (acc*disty/distfull);
}
//if(curplanet!=planets.length-1){
if(press ==true){
float area1 = 20000;
int x = int(MouseInfo.getPointerInfo().getLocation().x)-int(diameter/2);
int y =int(MouseInfo.getPointerInfo().getLocation().y)-int(diameter/2);
float disty = (y-ypos);
float distx = (x-xpos);
float distfull = sqrt(distx*distx+disty*disty);
float acc = (-2) *(area1/(distfull*distfull));
// print(" dist x="+distx);
// print(" dist y="+disty);
// print(" full="+distfull);
// println(" acc="+acc);
//.0000000000667*distx
xcc = xcc + (acc*distx/distfull);
ycc = ycc + (acc*disty/distfull);
}
// public void mousePressed(MouseEvent me){
// float area1 = 20000;
// int x = int(MouseInfo.getPointerInfo().getLocation().x)-int(diameter/2);
//int y =int(MouseInfo.getPointerInfo().getLocation().y)-int(diameter/2);
// float disty = (y-ypos);
// float distx = (x-xpos);
// float distfull = sqrt(distx*distx+disty*disty);
//
// float acc = (-2) *(area1/(distfull*distfull));
// // print(" dist x="+distx);
// // print(" dist y="+disty);
// // print(" full="+distfull);
// // println(" acc="+acc);
// //.0000000000667*distx
// xcc = xcc + (acc*distx/distfull);
// ycc = ycc + (acc*disty/distfull);
//
// }
xcc=xcc*.999999;
ycc=ycc*.999999;
xpos = xpos + xcc;
ypos = ypos + ycc;
//}
/*if(curplanet== 0 && xpos < 625 && xpos > 375 && ypos < 625 && ypos > 375){
background(255);
fill (0);
font = loadFont("BookAntiqua-Bold-150.vlw");
textFont(font);
text("THE END", 150, 500);
delay(10000);
if(1==1){
exit();
}
}
if(curplanet== 0 && xpos < 50 && xpos > 50 && ypos < 50 && ypos > 50){
background(255);
fill (0);
font = loadFont("BookAntiqua-Bold-150.vlw");
textFont(font);
text("WIN", 150, 500);
delay(10000);
if(1==1){
exit();
}
}*/
}
void daw(int ti) {
// frame.setBackground(new java.awt.Color(col1, col2, col3,255));
t = ti+1;
if (xpos < 0) {
xpos = 0;
xcc *= -1;
}
if (xpos > screen.width - diameter) {
xpos = screen.width - diameter;
xcc *= -1;
}
if (ypos < 0) {
ypos = 0;
ycc *= -1;
}
if (ypos > screen.height - diameter) {
ypos = screen.height - diameter;
ycc *= -1;
}
//frame.setColor(new java.awt.Color(255,0,0));
//stroke(255);
//line(0,0,100,100);
frame.setLocation(floor(xpos),floor(ypos));
}
// public void paint(Graphics g) {
// Graphics2D g2 = (Graphics2D) g;
// g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
// RenderingHints.VALUE_ANTIALIAS_ON);
//
// g2.setPaint(Color.white);
// int x = 5;
// int y = 7;
//
// g2.draw(new Line2D.Double(0, 0, 200, 200));
// g2.drawString("Line2D", x, 250);
//
// }
}
void mouseReleased(){
frame.setLocation(-500,-500);
robby.mousePress(InputEvent.BUTTON1_MASK);
delay(30);
robby.mouseRelease(InputEvent.BUTTON1_MASK);
frame.setLocation(x,y);
}
«Prev
Next »
Moderate user : adam.ts
Forum