index > Windows Presentation Foundation ("Avalon") > Reading pixels of BitmapSource

Reading pixels of BitmapSource

Given a bitmapSource, I want to read the pixels natively. As I understand I need to use the CopyPixels call. But understanding the pixels would require the knowledge of Bits per pixel and color Context of the bitmapSource. Though I know the bits per pixel - how do I get to know the color Context.

The PixelFormat class does not allow me much information - the only way to use PixelFormat, as I percieve, is to compare it with the various static pre-defined values of the PixelFormat. Would that be the most generic way?

Essentialy, I want to save the bitmapSource in a RAW format. What would be the best way to go about it?

Abhas

Abhas Kumar

If you do not specify the BitmapCreateOptions.IgnoreColorProfile, the bits received from CopyPixels already have the color profile applied to it.

Can you clarify what you mean by "saving the bitmapsource in a RAW format"? Do you just want to take the array of pixels and save it as a binary blob to disk or database?

Robert A. Wlodarczyk - MSFT
reply 2

You can use google to search for other answers

 

More Articles

• Smart rendering of large amounts of geometries
• App Positioning Per different types of Resolution
• Freezable changes in June CTP
• What's the recommended way to save an bitmapImage to a file
• Reusable 3d Control
• Item Selection Area
• Frame Disappearing on Clicking the ListViewItem
• FindResource Problem
• How to get reference of treeviewitem?
• CAD with WPF: "Capture" External TabletDevice
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• strange behaviour frame in window
• Possible bug: Hyperlink in a ListBox doe
• Polygon.Points Binding TwoWay
• When is Binding.ElementName non-NULL?
• How to control line breaking in TextBloc
• MenuItem ItemsSource
• Stretching Frame Content
• RichTextBox, insert an Inline element at
• How to drag/drop custom control in grid.
• Printing capabilities
• Load image into richtext box
• XamlWriter, MarkupObject How to ?
• IsDisposed equivalent on WPF
• Can i pass URL query strings from one xa
• DP of type BindingBase and XAML

Hot Articles

• x:Static works as element but not as att
• ContextMenu : Cannot find TargetName in
• WPF messageBox
• Is WPF right for my app?
• Getting started with video and animated 3D
• Animating the Web content of Frame?
• Using xaml
• Auto Scrolling text inside a listbox
• Writing reusable effects in XAML
• AddNewRow behaviour with bound ItemsCont
• How to get reference of treeviewitem?
• Force-rendering one control(tree)?
• Image-tag with source requiring username
• Data bound ListView, Subscripts for Chem
• DocumentViewer Style

Recommend Articles

• How can I use an animation on BitmapEffe
• Disable Navigation Hotkeys in a WPF Navi
• how to generate xps document with conten
• PasswordBox Databind or TextBox mask
• Graphical Design Tools for WPF?
• XmlDataProvider - Recommend when using l
• gridview
• How to use a DataTemplateSelector withou
• Changing FillBehaviour at animation end.
• How to populate a WPF TreeView node from
• how to create Hyperlink inside textblock
• Persistent Window state
• VS Extensions for WPF
• DATA BINDING: Problems attaching a Valid
• DropShadowBitmapEffect on a Popup