Jump to content
  • Advertisement
Sign in to follow this  
Whorse

Cropping a .bmp based on colour change

This topic is 2178 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm required to crop an 8-bit bitmap to the nearest unique pixel colour in all directions. I've saved my colour table in this format:


RGBQUAD* colours;


I'm a bit lost now as to how to go about doing this though, I'm using C++ without any external libraries. I've been advised that converting my image to greyscale then using an edge detection algorithm would be the best way to achieve this. Could any one comment? There is a lot of information on 24-bit bitmaps, but not much on how to use achieve my results with an 8-bit bitmap. Edited by UraniumSlug

Share this post


Link to post
Share on other sites
Advertisement
"Cropping" refers to adjusting the boundaries of an image. It has nothing to do with colours, so I'm confused as to what the requirements actually are. Could you perhaps post an example of what you need to accomplish?

Share this post


Link to post
Share on other sites
Looks an awful lot like homework. Jobs don't generally require that sort of thing, and personal projects have bigger issues to hunt down.

Have you asked your teacher or TA?

Share this post


Link to post
Share on other sites

I'm required to crop an 8-bit bitmap to the nearest unique pixel colour in all directions.


I assume that you want to create something like the "Magic Wand" in Photoshop or GIMP? Then your solution using an edge-detection will work.
for instance the sobel-operator is pretty easy to implement: http://en.wikipedia.org/wiki/Sobel_operator


There is a lot of information on 24-bit bitmaps, but not much on how to use achieve my results with an 8-bit bitmap.


what works for 24bit works also for 8bit if you change your datatypes accordingly, just copy-paste of the code will not work.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!