Utilizzando WIC Sono in grado di scrivere informazioni XMP di persone taggate: People Tagging OverviewCome scrivere XMP "persone taggate" Universal Apps [UWP]
Ora sto cercando di fare lo stesso in UWP ma non lo è working:
Quando provo solo a modificare un tag semplice come "/ xmp/Title" sta funzionando.
Ma quando provo a cambiare "PersonDisplayName" o "Rectangle", non funziona.
codice di esempio:
public async void SaveNewPeopleTagged(StorageFile file, string name , string rect)
{
try
{
using (IRandomAccessStream fileStream = await file.OpenAsync(FileAccessMode.ReadWrite),
memStream = new InMemoryRandomAccessStream())
{
BitmapDecoder decoder = await BitmapDecoder.CreateAsync(fileStream);
// Set the encoder's destination to the temporary, in-memory stream.
BitmapEncoder encoder = await BitmapEncoder.CreateForTranscodingAsync(memStream, decoder);
var propertySet = new Windows.Graphics.Imaging.BitmapPropertySet();
BitmapTypedValue btName = new BitmapTypedValue(name, Windows.Foundation.PropertyType.String);
//"/xmp/<xmpstruct>MP:RegionInfo/<xmpbag>MPRI:Regions/PersonDisplayName" **is not working**
propertySet.Add("/xmp/RegionInfo/Regions/PersonDisplayName", btName);
BitmapTypedValue btRect = new BitmapTypedValue(rect, Windows.Foundation.PropertyType.String);
//"/xmp/<xmpstruct>MP:RegionInfo/<xmpbag>MPRI:Regions/Rectangle" **is not working**
propertySet.Add("/xmp/RegionInfo/Regions/Rectangle", btRect);
await encoder.BitmapProperties.SetPropertiesAsync(propertySet);
//**Give a exception... "Value does not fall within the expected range."**
//If I use only : propertySet.Add("/xmp/Title", ...); it is working
await encoder.FlushAsync();
await memStream.FlushAsync();
memStream.Seek(0);
fileStream.Seek(0);
fileStream.Size = 0;
await RandomAccessStream.CopyAsync(memStream, fileStream);
}
}
catch (Exception err)
{
Debug.WriteLine(err.Message);
}
}
Qualcuno ha idee o suggerimenti?
Grazie
posso solo vedere di leggere un file (possibile un file di immagine) dal 'InstalledLocation' e trasformarlo per lo streaming, quindi si utilizza decodificatore e codificatore di 'Bitmap' per fare qualcosa con questo stream, quindi ripristinarlo come file, cosa vuoi fare con questo file? –
Sto cercando di inserire i metadati in una bitmap in UWP, sono in grado di leggere tutti i metadati. Sono in grado di scrivere tutti i metadati in una bitmap, ad eccezione del tag People. Nell'applicazione C++/Desktop funziona con WIC ma in UWP non funziona, – Cassius
Ho anche provato per il mio progetto corrente a taggare le persone ma non ha funzionato. Qualcuno ha trovato una soluzione per questo? – ctron