Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Complete newbie

Options
  • 24-05-2004 9:42pm
    #1
    Closed Accounts Posts: 927 ✭✭✭


    As a part of an art project I want to create a program that'll generate a series of patterns based on binary code. I want the program to generate grids of squares where black squares stand for 1 and white squares for 0 and to display them in sequence like a slide-show or animation.

    I have no programming experience. How would I go about learning how to do this?

    Sorry about my ignorance. Any help would be greatly appreciated.


Comments

  • Closed Accounts Posts: 3,357 ✭✭✭secret_squirrel


    My first suggestion would be to write the code that just takes a series of 1 and 0's and displays them on the screen in the square pattern you want. it should be very easy to do this in something like visual basic. Whilst doing that you can start exploring forms and see how to go about replacing the 0's and 1's with white and black squares.


  • Closed Accounts Posts: 927 ✭✭✭Monkey


    I don't want to create images myself for a couple of reasons. 1) There's going to be an awful lot of them and 2) I want to create a program that can do this and then if it is possible I want to use the binary code from that program as the source for the images so it's kind of like the prgram is making a self-portrait.


  • Registered Users Posts: 1,268 ✭✭✭hostyle


    What operating system are you using? Windows? *nix? Mac OSX? Is there a particular language you would like to learn? Or if you prefer, there are scriptable graphics programs available - Photoshop, Paint Shop Pro, the GIMP.


  • Registered Users Posts: 629 ✭✭✭str8_away


    display them in sequence like a slide-show or animation
    the qustion is how would you like to display them?

    If you want to display them in a GIF then you could use Photoshop, Paint Shop Pro to generate animate GIF.
    or you can create a flash to disply them on web page.
    or use Java, C++ or VB to create a program to display them in an application.


  • Closed Accounts Posts: 927 ✭✭✭Monkey


    Originally posted by str8_away
    or use Java, C++ or VB to create a program to display them in an application.

    I want to do this but I'd also be interested in putting the sequence onto a DVD.


  • Advertisement
  • Closed Accounts Posts: 3,357 ✭✭✭secret_squirrel


    Loads a ways to do this. I assume your'e talking about a pc dvd? If so then then you could just get a screen capture program that will capture a stream of images from the screen, and save it.

    The easy but longwinded way would be to use paint shop pro, and convert the images to an animated gif.

    Flash would prolly be the best way to do it imo. (I know almost nothing about flash Im just guessing)

    If you wanted it readable on a normal dvd player then you are going to have to code in a format like mpeg2. You might be able to get a screen capture utility that will do this for you - you might not.


  • Registered Users Posts: 2,243 ✭✭✭zoro


    The Java Media Framework (JMF) has an awful lot of handy tools for audio/video capture and creation.

    If this program is being done in java, you maybe able to create jpegs of the file's black/white design in say, a 512x512 image and output each image as a frame of an mpeg or gif.

    I'm not sure if this is entirely possible, but it's an idea that you could look into.

    I'm heading into 4th year next year and have been racking my head for a 4th year project. ... this sounds like it could be interesting! You never know, the patterns could spell out some horrific insult on someone's mother if looked at from a certain angle while hanging upside down in a pink jacket :D

    *edit*
    And, what is even more interesting, is that this newly created file would be an excellent way to transfer executables / any file at all, to another person - Imagine running this program and getting an animated gif of what is basically tv-static, compressing it, encrypting it, and then possibly doing it again.
    Bloody horrible to crack I'd say!
    *runs off to patent office* :D


  • Registered Users Posts: 2,243 ✭✭✭zoro


    And I've literally just spent no more than 30 minutes doing a program that reads in from a file and outputs it's binary representation. Yeah I know it took a while, but I spent most of that on the API cause I haven't used any programming for about 3 months :)


  • Registered Users Posts: 19,608 ✭✭✭✭sceptre


    Originally posted by zoro
    *runs off to patent office* :D
    Wouldn't bother I'm afraid - there are a few programs that do this for the truly paranoid and so on. Came across one about three or four years ago.


  • Registered Users Posts: 2,243 ✭✭✭zoro


    I was only kidding :)

    Really? I've never heard of anyhting like it before! I'd imagine it's absolutely horrid to crack :)


  • Advertisement
  • Closed Accounts Posts: 927 ✭✭✭Monkey


    Originally posted by zoro
    And I've literally just spent no more than 30 minutes doing a program that reads in from a file and outputs it's binary representation. Yeah I know it took a while, but I spent most of that on the API cause I haven't used any programming for about 3 months :)

    Care to share it?


  • Registered Users Posts: 2,243 ✭✭✭zoro


    Originally posted by Monkey
    Care to share it?
    "Do my homework"
    "Do my project"
    :D

    Only kidding :)

    Sure no problem, I hope it helps you out!
    It's in java by the way, but I'm sure it'd be easy to convert it to another language.
    import java.io.*;
    
    public class Bitwise
    {
       // ^2 values in a byte (8 bits)
       //  ie: 00110001 == 49 :: 32 + 16 + 1
       private static final int []vals = {128, 64, 32, 16, 8, 4, 2, 1};
    
       public static void main(String [] args)
       {
          if(args.length != 1)
          {
             System.out.println("Usage: java Bitwise <filename>");
             System.exit(1);
          }
          try
          {
             BufferedInputStream in = new BufferedInputStream(new FileInputStream(args[0]));
    
             while (in.available() > 0)
             {
                byte b = 0;
                int position = 0;
                if((b = new Integer(in.read()).byteValue()) >= 0)
                {
                   int thisByte[] = new int[8];
                   while (position < vals.length)
                   {
                      if((b & vals[position]) == vals[position])
                         thisByte[position] = 1;
                      else
                         thisByte[position] = 0;
                      position++;
                   }
                   for (int i = 0; i < thisByte.length; i++)
                   {
                      /*  This is where you can output the black / white
    				      section of the image to a file
                       */
                      System.out.print(thisByte[i]);
                   }
                   System.out.println();
                }
             }
             in.close();
          }
          catch(Exception e){e.printStackTrace();}
       }
    }
    

    And I'm aware that there's probably a better way of doing this :)


  • Registered Users Posts: 2,243 ✭✭✭zoro


    Hmmm ... maybe I'm going about it the wrong way ... it definitely works right, but I think I'm using extrememly time consuming methods of doing it ...

    I modified the program to output black / white pixels to a PNG image, and so long as it's < 250k it's fast enough, but up at 5 megs as I was testing last night, 1%, 2%, 3%, ........ 4% ........................................5% ...

    Hmmm :/ I wonder what's making it take up so much time. I'm gonna have to optimize it if it's going to work with real files.

    *edit*
    well one fix would be changing:
    while (position < vals.length)
    {
       if((b & vals[position]) == vals[position])
          thisByte[position] = 1;
       else
          thisByte[position] = 0;
       position++;
    }
    for (int i = 0; i < thisByte.length; i++)
    {
       /*  This is where you can output the black / white
          section of the image to a file
       */
       System.out.print(thisByte[i]);
    }
    

    - to -
    while (position < vals.length)
    {
       if((b & vals[position]) == vals[position])
          System.out.print("w");//white
       else
          System.out.print("b");//black
       position++;
    }
    


Advertisement