# getPixel to RGB values

**URL:** <https://forum.kirupa.com/t/getpixel-to-rgb-values/216171>\
**Category:** flash\
**Created:** [February 14, 2007, 6:24am UTC](https://forum.kirupa.com/t/getpixel-to-rgb-values/216171 "2007-02-14T06:24:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![theSchtickler](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@theSchtickler](https://forum.kirupa.com/u/theSchtickler)\
**Post date:** [February 14, 2007, 6:24am UTC](https://forum.kirupa.com/t/getpixel-to-rgb-values/216171/1 "2007-02-14T06:24:12Z")

</div>

This has been driving me nuts…

So, I’m using the BitmapData class and getPixel to retrieve the colour of a pixel. It works fine and returns a number like “16706965”. I’m not sure what kind of value this is? If I place a ‘toString(16)’ on the end of it, I get a HEX value, but sometimes it isnt 6 digits long, sometimes 5 sometimes 4, so I can’t just convert it from HEX to RGB.

I can make this number into a string with 6 digits, but then it doesnt recognise when I try to convert it to RGB

I feel like I’m going about this the wrong way, but I’m unsure which is the right way to go.

Any suggestions?
