Graphics

 View Only
  • 1.  Exporting images through the API

    Posted 01-04-2014 01:33
    Hello everyone,

    First of all, I wish you all a Happy Newyear!

    I have a question regarding the export of images through the API.

    I've succeeded in generating imagefiles of the different scenes I have however I've only succeeded in exporting them as BMP-files.

    First of all here is the code I'm using:



    xpScene selectedScene;

    xpImage img;

    engine.GetSceneByName("Test", out selectedScene);

    selectedScene.GetRenderedFrame(40, 1920, 1080, out img);

    xpTools.xpImageToFile(img, IMAGE_TYPE.IT_BMP, @"C:test.bmp");



    This is working fine, but I would like to export the images as JPG or PNG. Now I remember in VB6 I had 4 different formats I could choose (BMP, JPG, PNG and TGA). In C# I only seem to be able to select the BMP as image type.

    Do I need to do something additional?

    Kenneth


  • 2.  RE: Exporting images through the API

    Posted 01-04-2014 14:46
    I think in C# you can ignore the IMAGE_TYPE parameter and simply give it the filename of "test.png" and it will automatically use the PNG format.

    It's been a while since I've tried this, so I can't remember 100% though.

    This is assuming you are using the .NET dlls and not the COM object reference in your Visual Studio project.

    #XPression


  • 3.  RE: Exporting images through the API

    Posted 01-07-2014 23:56
    Hi Brian,

    I've referenced the xpression.net.dll file in my project.

    However I can't ignore the value, it's a mandatory argument...

    Kenneth

    #XPression


  • 4.  RE: Exporting images through the API

    Posted 01-08-2014 01:52
    Have you tried this?

    xpTools.xpImageToFile(img, IMAGE_TYPE.IT_BMP, @"C:test.png");

    #XPression


  • 5.  RE: Exporting images through the API

    Posted 01-13-2014 13:21
    Hi Brian,

    I did try this but eventhough it changes the extension to .png, it still remains a bmp. So if you try to open it in Photoshop you won't be able to open it. However if you change the extension manually to .bmp then it opens fine in Photoshop.

    By the way, in close regards to this question, is there a way to identify on which fame the Preview marker has been placed? Because I want to create my own templatepicture so I would like to use the Preview-marker to determine which frame it is so I can pass it along in the image which I generate.

    Kenneth

    #XPression