Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
  • Welcome
  • Products
  • Support
  • About
  • More
  • Cancel
MicroStation
  • Product Communities
  • More
MicroStation
[Archived] AskInga Wiki Calculating decimal equivalents from binary numbers
    • Sign in

    • -AskInga
      • +3D MicroStation
      • +AccuDraw Secrets
      • +Animation - Rendering
      • +Behind The Scenes
      • +Cells
      • +Colours
      • +Conversion - Translation
      • +Coordinate Input
      • +Design Settings
      • +Dimensions
      • +DWG
      • +EDG
      • +Element Manipulation
      • +Element Properties
      • +Element Selection
      • +Freeware - Shareware
      • +Interface Look And Feel
      • +Internet - E-Links - Links
      • +Keyins
      • +Levels
      • +Line Styles
      • +Models
      • +MSM Archive
      • +Other
      • +Presentations
      • +Printing - Plotting
      • +Programming - Automation
      • -Rasters - Images
        • Assign rasters to a level
        • Calculating decimal equivalents from binary numbers
        • How to unselect an image
        • Make a raster sandwich with Display Planes
        • Make copies of your raster attachments
        • Maximize image resolution
        • Multipage PDF - Change page
        • Open an image directly in MicroStation
        • Reprojecting images on the fly
        • Stop accidentally deleting your rasters
        • Understanding raster file sizes and more
      • +References
      • +Tags - Data Fields - Fields
      • +Text - Fonts - Annotation
      • +Views
      • +Windows - Interacting With
      • +Workspaces - Configuration
    • graffiti

     
     Questions about this article, topic, or product? Click here. 

    Calculating decimal equivalents from binary numbers

    AskInga logo

    Original Article Date: Sep 8, 2003 

    This is a re-write of an older article and explores how you can calculate the decimal equivalent of a binary number with an slant towards raster imagery. Although not really MicroStation stuff,it may help you understand what 1010 and 1101 really means. (With special thanks to the guy I'm married to for explaining this stuff to me!)

    A bit is the smallest unit of information that is understood by a computer and is either on which is represented by the number 1 or off which is the number 0.

     

    Value

    No. of Bits

    No. of Colours

    Value

    20

    0

    1

    NULL

    21

    1

    2

    0

    22

    2

    4

    00

    23

    3

    8

    000

    24

    4

    16

    0000

    25

    5

    32

    00000

    26

    6

    64

    000000

    27

    7

    128

    0000000

    28

    8

    256

    00000000

    216

    18

    65,536

    000000000

    224

    24

    16,777,216

    Got it?

     

    Note, even though the above chart shows 0's in the last column - it could also be 1's or any combination of 0's and 1's.


    In an 8 bit image, each pixel is described as having 1 of a possible 256 colours which is composed of eight 0's and 1's to represent that colour number in the palette. Similarily, a 4-bit image would have a maximum colour count of 16.

    Image Type

    No. of Colours


    1 Bit

    2

    4 Bit

    16

    8 Bit

    256

    24 Bit

    16 Million

     

    In 4 bit image each pixel is described by four values which in turn represents one colour from a total of 16 available colours. The binary number of each colour is as follows:

    Binary Number

    Colour Number

    0000

    0

    0001

    1

    0010

    2

    0011

    3

    0100

    4

    0101

    5

    0110

    6

    0111

    7

    1000

    8

    1001

    9

    1010

    10

    1011

    11

    1100

    12

    1101

    13

    1110

    14

    1111

    15




    So, how are the colour numbers "calculated" from the binary number? Actually it's easier than you may think. The following table shows the place values for the binary numbering system and it's decimal equivalents. This information will be then be used to calculate the the actual colour number.

    Digit Position

    4

    3

    2

    1

    Binary

    23

    22

    21

    20

    Decimal Equivalent

    8

    4

    2

    1




    So, using the above information, the binary number 0110 can be converted as follows:


    Binary Number

    0

    1

    1

    0

    On/Off Status

    Off

    On

    On

    Off

    Binary

    23

    22

    21

    20

    Decimal Equivalent

    0

    4

    2

    0



    Adding the decimal values, we get 0 + 4 + 2 + 0 = 6 which is the final answer.

    One more example:


    Binary Number

    1

    1

    0

    1

    On/Off Status

    On

    On

    Off

    On

    Binary

    23

    22

    21

    20

    Decimal Equivalent

    8

    4

    0

    1



    In this case the colour number is 8 + 4 + 0 + 1 = 13

    To sum things up, you can calculate the decimal value of a 4-bit binary number, with this little formula:

    Decimal Number = 23 + 22 + 21 + 20

    Remember though, that if the the place value is a 0, it's essentially turned off and ignored. Also, any number raised to the power of zero is always one. Likewise, any number raised to the first power is the number of the base itself.

    AskInga Article #47

    • Raster Images
    • Askinga
    • Article
    • Share
    • History
    • More
    • Cancel
    • Hannah Blye Created by Hannah Blye
    • When: Tue, May 27 2008 2:58 PM
    • Inga Morozoff Last revision by Bentley Colleague Inga Morozoff
    • When: Mon, Jun 14 2010 1:21 PM
    • Revisions: 5
    • Comments: 0
    Recommended
    Related
    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2021 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies