locked
InkManager - get an isf file?

    Question

  • I want save from the ink manager into isf format. I don't want to use the gif format, because it will take up much more space in my database, and I only ever read it in my own application so I can display it from isf format.

    However the documentation says that it stores the isf file inside a gif but there is no documentation or sample of how to extract it.  Where would I find this information?

    Thanks,
    Stefan

    Monday, May 05, 2014 3:18 AM

Answers

All replies

  • The ISF is embedded in the GIF metadata. See standard GIF docs for how that is encoded. You may be able to extract the stream with a BitmapDecoder's BitmapProperties, but I haven't tried that with GIF metadata.

    You can find the ISF spec at http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/InkSerializedFormat(ISF)Specification.xps .

    --Rob


    Monday, May 05, 2014 3:24 AM
    Owner
  • Hi Rob,

    Thanks for the answer. Unfortunately the ISF spec doesn't tell me what the metadata name would be.  I have managed to extract the bitmap properties, using this code:

    using (var stream = await file.OpenAsync(FileAccessMode.Read))
    {
        BitmapDecoder decoder = await BitmapDecoder.CreateAsync(BitmapDecoder.GifDecoderId, stream);
    
        var properties = await decoder.BitmapProperties.GetPropertiesAsync(new List<string>());
        foreach (var prop in properties)
        {
            Debug.WriteLine("from BitmapProperties:" + prop.Key);
            BitmapPropertiesView view = (BitmapPropertiesView) prop.Value.Value;
            foreach (var viewProp in await view.GetPropertiesAsync(new List<string>()))
            {
                Debug.WriteLine("from BitmapPropertiesView:" + viewProp.Key);
            }
        }
        await inkManager.LoadAsync(stream);
    }

    And none of these would suggest that they are storing an ISF file:
    from BitmapProperties:/imgdesc
    from BitmapPropertiesView:/SortFlag
    from BitmapPropertiesView:/LocalColorTableFlag
    from BitmapPropertiesView:/Width
    from BitmapPropertiesView:/Height
    from BitmapPropertiesView:/Top
    from BitmapPropertiesView:/InterlaceFlag
    from BitmapPropertiesView:/Left
    from BitmapPropertiesView:/LocalColorTableSize
    from BitmapProperties:/grctlext
    from BitmapPropertiesView:/UserInputFlag
    from BitmapPropertiesView:/Disposal
    from BitmapPropertiesView:/TransparentColorIndex
    from BitmapPropertiesView:/Delay
    from BitmapPropertiesView:/TransparencyFlag

    Where is the documentation on exactly which meta data name is used by the ISF file?

    Thanks,

    Stefan

    Monday, May 05, 2014 4:27 AM
  • It appears that it is stored in the comment field:

    But given the relatively limited documentation around BitmapDecoder, it's extremely difficult to figure out how to extract that comment

    Monday, May 05, 2014 4:52 AM
  • Solved it using imagetools (http://imagetools.codeplex.com/), which actually does you to access the comments. I presume this should be possible with the WinRT API, but the documentation is so thin, it's very difficult to figure it out.  Would be great if the documentation could be expanded a little bit.  There isn't even a C# example for this API:
    http://msdn.microsoft.com/en-us/library/windows/apps/br226250.aspx
    • Marked as answer by StefanOlson Monday, May 05, 2014 5:24 AM
    Monday, May 05, 2014 5:24 AM