Sign in to follow this  

[.net] Image to ARGB *solved

This topic is 3045 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

is there any library that allows me to load a a file (png, bmp, gif) and get the pixels in a byte array formated as ARGB (or some other format)? [Edited by - Dragon_Strike on August 14, 2009 3:45:42 PM]

Share this post


Link to post
Share on other sites
Yes, stb_image: http://www.gamedev.net/community/forums/topic.asp?topic_id=544348&whichpage=1#3509490

Edit: Sorry, I didn't see that this is .NET forum. In .NET case use System.Drawing.Bitmap class. It can load different kind of image formats. And it also gives direct access to pixel bytes.

[Edited by - bubu LV on August 14, 2009 8:12:09 AM]

Share this post


Link to post
Share on other sites
XNA has Texture2D.GetData<T> which does this, although requiring XNA is a bit much.

I imagine SlimDX has something similar in there, but I don't know offhand.

Share this post


Link to post
Share on other sites
Quote:
Original post by Dragon_Strike
there is no way i can know if its in ARGB, RGB, etc...?

Yes you can. System.Drawing.Bitmap gives information about in what format pixels are (PixelFormat member), and also it gives chance to convert it to needed pixel format with third argument for LockBits method.

Or you can simply create new Bitmap with needed pixel format and copy old bitmap to this new bitmap.

Share this post


Link to post
Share on other sites

This topic is 3045 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this