Project: titanium
Issue TIMOB-16882: iOS: Converting a blob into a valid image does not maintain dimensions
h6.Issue description Looking for a cross-platform way to create image thumbnail files asynchronously. Titanium is able to read an image file asynchronously into a buffer and then a blob. If we assign that blob to the image property of an ImageView, it displays as I expect. However, the blob is not recognised as an image by any of the Ti.Blob.image* methods. The blob has a mime type of "application/octet-stream" and a height and width of 0. Meanwhile Android is able to get height and width properly. h6.Steps to reproduce # Launch sample app. You can see that the fishImage ImageView loads its image directly from a file path in its "image" property. # earthImage is loaded in index.js asynchronously using a file stream. Once the file contents are read completely, they are assigned to the image property of $.earthImage. # Notice, the blob you get as a result of "earthBuffer.toBlob()" can't be used for any other image manipulation (e.g. creating thumbnails). It doesn't have a valid mimeType, height, or width on iOS. E.G. {code} $.earthImage.image = earthBuffer.toBlob(); Ti.API.info( $.earthImage.image.height + ' . '+ $.earthImage.image.width + ' . '+ $.earthImage.image.mimeType); {code} h6.Android {code} 04-24 15:11:03.812: I/TiAPI(28395): 1600 . 2560 . application/octet-stream {code} h6.iOS {code} [INFO] : 0 . 0 . application/octet-stream {code}
Story points: 3