Reading jpg EXIF info

  • Thread starter Thread starter Tim Kelley
  • Start date Start date
T

Tim Kelley

I am working on a program the reads the user comment field of a jpg file.
When I read it in using GetPropertyItem to get the property and saving it to
a variable with item=Encoding.UTF8.GetString(PropItem.Value).Trim() I get a
string that looks like \0\0\0\0\0\0my text here.

Is there a way for me to strip all of the \0s from the string?

Thanks,

Tim
 
I am working on a program the reads the user comment field of a jpg file.
When I read it in using GetPropertyItem to get the property and saving it to
a variable with item=Encoding.UTF8.GetString(PropItem.Value).Trim() I get a
string that looks like \0\0\0\0\0\0my text here.

Is there a way for me to strip all of the \0s from the string?

Thanks,

Tim

How about:

item = item.Replace("\0", "");
 
I am working on a program the reads the user comment field of a jpg file.
When I read it in using GetPropertyItem to get the property and saving it to
a variable with item=Encoding.UTF8.GetString(PropItem.Value).Trim() I get a
string that looks like \0\0\0\0\0\0my text here.

Is there a way for me to strip all of the \0s from the string?

Thanks,

Tim

You could use an old fashioned string.Replace to get rid of the "\0"s
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top