Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Blob to image

Hi

Is there a function/routine/script to convert a blob to an image like jpeg, png, etc?

Thanks!

— asked March 30th 2010 by Peter Lum
  • blob
  • conversion
  • image
  • jpeg
  • png
0 Comments

2 Answers

  • Accepted Answer

    Assuming mobile…

    var filename = Titanium.Filesystem.applicationDataDirectory + "/image.jpg";
    f = Titanium.Filesystem.getFile(filename);
    f.write( blob );
    

    You need to use applicationDataDirectory.

    — answered March 30th 2010 by TZ Martin
    permalink
    2 Comments
    • Why jpg? Is the image format that is standard in a blob or is the format saved in the file determined by the extension that you give the filename?

      — commented June 26th 2014 by Joshua Austin
    • Thanx…

      — commented December 31st 2014 by Nabeel Munawar
  • Thanks, it works!

    — answered March 30th 2010 by Peter Lum
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.