Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - png metadata

 
 
Old 02-28-2006   #1 (permalink)
StefanT


 
 

png metadata

Hi guys,

I want to use the png tEXT metadata, can some help with some code sample
of some link to web resources about this topic.



Best regards,
Stefan

My System SpecsSystem Spec
Old 02-28-2006   #2 (permalink)
robertwl@nospam.microsoft.com


 
 

re: png metadata

Hi Stefan,

The query string to get to Png Metadata (tEXT) is: “/text/comment”. You can replace “comment” with any of the tEXT fields, like Author or Keywords.

From a PngBitmapDecoder or from a BitmapFrame, try this:

System.Windows.Media.Imaging.BitmapMetadata metadata = decoder.Metadata;

if ( metadata != null )
{
foreach ( string query in metadata )
{
object o = metadata.GetQuery ( query );
}
}

Alternatively if you know what metadata you’re looking for, you can look for it using .GetQuery(“/text/comment”) [for example]. In order to set Metadata on the BitmapFrame, use the .SetQuery(…) method.

Thanks,

Robert.

-----Original Message-----
From: stefan_tabaranu
Posted At: Monday, February 27, 2006 10:36 PM
Posted To: microsoft.public.windows.developer.winfx.avalon
Conversation: png metadata
Subject: png metadata


Hi guys,

I want to use the png tEXT metadata, can some help with some code sample
of some link to web resources about this topic.



Best regards,
Stefan
My System SpecsSystem Spec
Old 03-01-2006   #3 (permalink)
StefanT


 
 

re: png metadata

Hi Robert,

Thx a lot for your response, I try to render some simple text on an image
like this:

RenderTargetBitmap rtb = new RenderTargetBitmap(500, 500, 30, 30,
PixelFormats.Pbgra32);
DrawingVisual dv = new DrawingVisual();
DrawingContext dc = dv.RenderOpen();

dc.DrawText(
new FormattedText("Test .... drawing some text",
CultureInfo.CurrentUICulture,
FlowDirection.LeftToRight,
new Typeface("Verdana"),
36, Brushes.Black),
new Point(200, 116));
dc.Close();

rtb.Render(dv);

PngBitmapEncoder png = new PngBitmapEncoder();

png.Metadata = new BitmapMetadata("/tEXT/"); //error - Property
could not be found

png.Frames.Add(BitmapFrame.Create(rtb));
using (Stream stm = File.Create("c:/foo.png"))
{
png.Save(stm);
}

When I try to create a new instance of the metadata object I get an error
message "Property could not be found".
I make something wrong ? I have a Beta 1 version of winfx sdk, shall I try
with another version ?

Best regards,
Stefan

"robertwl@nospam.microsoft.com" wrote:

> Hi Stefan,
>
> The query string to get to Png Metadata (tEXT) is: “/text/comment”. You can replace “comment” with any of the tEXT fields, like Author or Keywords.
>
> From a PngBitmapDecoder or from a BitmapFrame, try this:
>
> System.Windows.Media.Imaging.BitmapMetadata metadata = decoder.Metadata;
>
> if ( metadata != null )
> {
> foreach ( string query in metadata )
> {
> object o = metadata.GetQuery ( query );
> }
> }
>
> Alternatively if you know what metadata you’re looking for, you can look for it using .GetQuery(“/text/comment”) [for example]. In order to set Metadata on the BitmapFrame, use the .SetQuery(…) method.
>
> Thanks,
>
> Robert.
>
> -----Original Message-----
> From: stefan_tabaranu
> Posted At: Monday, February 27, 2006 10:36 PM
> Posted To: microsoft.public.windows.developer.winfx.avalon
> Conversation: png metadata
> Subject: png metadata
>
>
> Hi guys,
>
> I want to use the png tEXT metadata, can some help with some code sample
> of some link to web resources about this topic.
>
>
>
> Best regards,
> Stefan
>

My System SpecsSystem Spec
Old 03-02-2006   #4 (permalink)
glennrp@gmail.com


 
 

Re: png metadata

The PNG text chunk is "tEXt" not "tEXT"

Glenn

My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Who keep metadata from XP ? Vista file management
WSD and Metadata using SSL Vista security
metadata Vista General
metadata Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46