Click here to Skip to main content
15,898,938 members
Home / Discussions / WPF
   

WPF

 
QuestionRe: How to convert xaml files to png and display in one page Pin
Mark Salsbery10-Jul-09 6:24
Mark Salsbery10-Jul-09 6:24 
AnswerRe: How to convert xaml files to png and display in one page Pin
prabhkar27212-Jul-09 20:19
prabhkar27212-Jul-09 20:19 
GeneralRe: How to convert xaml files to png and display in one page Pin
Jeremy Likness26-Jul-09 3:22
professionalJeremy Likness26-Jul-09 3:22 
QuestionPsd file to XAML Pin
krishnan.s9-Jul-09 23:27
krishnan.s9-Jul-09 23:27 
AnswerRe: Psd file to XAML Pin
Pete O'Hanlon9-Jul-09 23:53
mvePete O'Hanlon9-Jul-09 23:53 
GeneralRe: Psd file to XAML Pin
krishnan.s10-Jul-09 0:06
krishnan.s10-Jul-09 0:06 
GeneralRe: Psd file to XAML Pin
Pete O'Hanlon10-Jul-09 0:42
mvePete O'Hanlon10-Jul-09 0:42 
QuestionManipulating a PNG palette Pin
pnart9-Jul-09 11:50
pnart9-Jul-09 11:50 
We want to make it easy for the customer to adjust PNG-8 icons and controls, for a web-based app to match his own branding and color themes. Since PNG-8 uses a palette (ie, indexed colors) all I want to do is read in a PNG file, fiddle with the palette and write it out again. I can do this in any environment but Microsoft. How do we do it in Microsoft? (VS2008, .Net 3.5, WPF)

Just as a test I tried reading it a PNG-8 file, creating a screwy palette, and displaying it, but it didn't do a thing - the original image displayed perfectly:

Stream imageStreamSource = new FileStream(sPath, FileMode.Open, FileAccess.Read, FileShare.Read);
 PngBitmapDecoder decoder = new PngBitmapDecoder(imageStreamSource, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
 BitmapSource OriginalImage = decoder.Frames[0];

 FormatConvertedBitmap newFormatedBitmapSource = new FormatConvertedBitmap();

 newFormatedBitmapSource.BeginInit();
 newFormatedBitmapSource.DestinationFormat = PixelFormats.Indexed8;
 newFormatedBitmapSource.Source = OriginalImage;

 // make a silly palette . . .
 List<System.Windows.Media.Color> colors = new List<System.Windows.Media.Color>();
 for (int i = 0; i < 127; i++)
 {
     colors.Add(System.Windows.Media.Colors.Red);
     colors.Add(System.Windows.Media.Colors.Blue);
 }
 BitmapPalette myPalette = new BitmapPalette(colors);

 newFormatedBitmapSource.DestinationPalette = myPalette;

 newFormatedBitmapSource.EndInit();

 // Draw the Image
 image1.Source = newFormatedBitmapSource;


On the MSDN it says "Only Tagged Image File Format (TIFF) and Graphics Interchange Format (GIF) image formats support image palettes. However, other image types can be used to define a BitmapPalette. Attempting to define a BitmapPalette for an unsupported bitmap format does not result in an exception; the designated BitmapPalette is simply ignored. "

. . . so maybe that's what I'm seeing, but then what IS the way to manipulate PNG palettes?

Thanks in advance.
AnswerRe: Manipulating a PNG palette Pin
Mark Salsbery10-Jul-09 6:54
Mark Salsbery10-Jul-09 6:54 
GeneralRe: Manipulating a PNG palette Pin
pnart13-Jul-09 7:05
pnart13-Jul-09 7:05 
QuestionMultiple progress bars Pin
vsaratkar9-Jul-09 4:10
vsaratkar9-Jul-09 4:10 
AnswerRe: Multiple progress bars Pin
Pete O'Hanlon9-Jul-09 4:13
mvePete O'Hanlon9-Jul-09 4:13 
AnswerRe: Multiple progress bars Pin
#realJSOP9-Jul-09 4:33
professional#realJSOP9-Jul-09 4:33 
AnswerRe: Multiple progress bars Pin
vsaratkar9-Jul-09 8:53
vsaratkar9-Jul-09 8:53 
GeneralRe: Multiple progress bars Pin
#realJSOP9-Jul-09 9:32
professional#realJSOP9-Jul-09 9:32 
GeneralRe: Multiple progress bars Pin
Mark Salsbery10-Jul-09 7:04
Mark Salsbery10-Jul-09 7:04 
QuestionCannot set a property on object 'Identity' because it is in a read-only state. [modified] Pin
ASysSolvers9-Jul-09 3:08
ASysSolvers9-Jul-09 3:08 
AnswerRe: Cannot set a property on object 'Identity' because it is in a read-only state. Pin
Pete O'Hanlon9-Jul-09 3:33
mvePete O'Hanlon9-Jul-09 3:33 
GeneralRe: Cannot set a property on object 'Identity' because it is in a read-only state. Pin
ASysSolvers9-Jul-09 3:50
ASysSolvers9-Jul-09 3:50 
AnswerRe: Cannot set a property on object 'Identity' because it is in a read-only state. Pin
Pete O'Hanlon9-Jul-09 4:13
mvePete O'Hanlon9-Jul-09 4:13 
GeneralRe: Cannot set a property on object 'Identity' because it is in a read-only state. Pin
ASysSolvers9-Jul-09 4:27
ASysSolvers9-Jul-09 4:27 
GeneralRe: Cannot set a property on object 'Identity' because it is in a read-only state. Pin
Pete O'Hanlon9-Jul-09 4:38
mvePete O'Hanlon9-Jul-09 4:38 
GeneralRe: Cannot set a property on object 'Identity' because it is in a read-only state. Pin
ASysSolvers9-Jul-09 5:03
ASysSolvers9-Jul-09 5:03 
QuestionPropertyChanged Nofification Pin
schiebel-t9-Jul-09 1:22
schiebel-t9-Jul-09 1:22 
AnswerRe: PropertyChanged Nofification Pin
Pete O'Hanlon9-Jul-09 1:38
mvePete O'Hanlon9-Jul-09 1:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.