Titanium JIRA Archive
Appcelerator Community (AC)

[AC-4782] Ti.Blob imageAsCompressed function does not exist

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionInvalid
Resolution Date2017-02-08T21:53:47.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsblob, image
ReporterNicholas Thurston
AssigneeShak Hossain
Created2017-02-08T21:11:29.000+0000
Updated2017-02-08T21:53:51.000+0000

Description

The Ti.Blob imageAsCompressed function does not appear to exist. I get "undefined" is not a function when trying to run it. Some code:

compressImage: function(original) {
    var image = this.resizeImage(original);
    return image.imageAsCompressed(.75);
  },
  resizeImage: function(original) {
    if (original.width < maxWidth && original.height < maxHeight) {
      return original;
    }
    
    var aspectRatio = original.width / original.height;
    if (original.width <= original.height) {      
      return original.imageAsResized(aspectRatio * maxHeight, maxHeight);  
    }
    
    return original.imageAsResized(maxWidth, maxWidth / aspectRatio);
  },
The original is response data from an http call. Note that the imageAsResized works fine. Since that should be returning a blob I would expect the imageAsCompressed function to work as well. I have been using Ti ImageFactory which does work, but wanted to see if the SDK function would be more efficient.

Attachments

FileDateSize
Simulator Screen Shot Feb 8, 2017, 4.04.56 PM.png2017-02-08T21:05:07.000+000095834

Comments

  1. Hans Knöchel 2017-02-08

    It's will be available in SDK 6.1.0 and later: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Blob-method-imageAsCompressed

JSON Source