Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How to create a bitmap image

  1. Jun 24, 2012 #1
    I am trying to create a nano - size pyramid using an FIB - Focused Ion Beam Microscope. The way it works is, it takes a 1000 x 1000 pixel bitmap image as an input. Each pixel is in gray scale. At the start we input a maximum value: lets say we set 'black' as 100 nm. If the pixel is black, then the FIB drills a hole that is a 100 nm deep. If the pixel is say only 40% black, then it drills a hole that is 40 nm deep. If the pixel is white, then it is left alone. So if I need to create a cone, then the bitmap image for the cone would look like a white dot at the centre and grayscale circle extending out from it with increasing tone of black. I hope you get this.

    The question that I have is this. How do I create a bitmap image to this specification? I know that Matlab, photoshop etc does create bitmap images, but I need clear, step by step instructions. I have tried other informational pages but I am usually lost on some basic issue. Any help will be greatly appreciated
  2. jcsd
  3. Jun 24, 2012 #2


    User Avatar
    Science Advisor

    First you need to decide what image format you want to use. There are a lot of them(.bmp, .dib, .gif, .png, ...) Is there an existing program for the FIB that reads bitmap images? If so, what format does it ask for? If not and you need to write this, what format do you want to use? Once you've decided this, you need to write or adapt a program to write the images in this format. Programs like MATLAB or Mathematica will handle the details for you - if you want to write it from scratch, you need to obtain the image format specification and write something that conforms to it. Here's an example starting point.

  4. Mar 26, 2013 #3
    Developed as a raster graphics image file format, BMP (full name: Bitmap) is the standard image file format on Microsoft Windows operating systems. BMP can be divided into two types: Device Dependent Bitmap (DDB) file format and Device Independent Bitmap (DIB) file format.So, which bitmap do you want to creat? And if you wanna see more detail of creating bitmap, check the professional open source site.
  5. Mar 27, 2013 #4


    User Avatar
    Gold Member

    In Mathematica theres an easy way to do this:

    1. Define your function. So for a pyramid I use:

    Code (Text):
    F[x_, y_] := 2 ( (Abs[(1/2 - x)] + Abs[1/2 - y]))
    G[x_,y_]:= If[F[x, y] > 1, 1, F[x, y]]
    The "F" yields a 0-1 value that is the shape of a pyramid. I chose to use the Absolute Values as x goes from 0 to 1, so this way the sum adds to 1 at its max, and 0 at its min. The G makes it so it doesn't go "less" than white. (white = 1, black =0)

    2. Build the table of values, I do:

    Code (Text):

    pix = 1000; (*Define the number of pixels along each axis *)

    data=Table[G[x,y], {x, 1/pix, 1, 1/pix}, {y, 1/pix, 1, 1/pix}]
    Here the values go from 1/1000 to 1 by increments of 1/1000. So exactly 1000 pixels in each direction.

    3. Convert it to an image, and export it. I do this in one step:
    Code (Text):

    Export["C:\\test.bmp",  Image[data, ImageResolution -> pix, Magnification -> 1], ImageResolution -> pix]
    The path is obvious, in Mathematica you'll notice paths are in quotes, and use "\\" for directory structure. I let the image resolution be the same as the table size, and I don't let Mathematica zoom out on the image.

    And it should export the bitmap. It might seem like its hanging, but just give it some time without clicking anything, it should eventually spit it out. Remember, a 1000x1000 bitmap without compression is about 3 megs.

  6. May 6, 2014 #5
    so you may need a simple image control to create bitmap image, check to see this detailed instruction. it will be very easy to create high resolution bitmap with any size you want.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook