Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-27997] iOS: Ti.Blob images from device (via Ti.UI.View#toImage()) would report dimensions in points, not pixels

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2020-08-06T10:21:31.000+0000
Affected Version/sRelease 9.0.3
Fix Version/sRelease 9.1.0
ComponentsiOS
Labelsparity
ReporterChristopher Williams
AssigneeChristopher Williams
Created2020-07-02T20:35:42.000+0000
Updated2021-02-11T10:45:35.000+0000

Description

On Android, if we generate a Ti/Blob image from calling Ti.UI.View#toImage(), it reports width/height/size properly. On iOS, it will report width and height in points, not pixels. size is therefore also incorrect. Say we have a 10px x 10px view rendered to image on a 3x scale device. The blob will report width of 3, height of 3 and size of 9. The device will report density factor of 3. So naively multiple by that still gives us wrong values (of 9, 9, 81 respectively instead of 10, 10, 100). UIImage holds a scale value for cases like this and we should multiply width/height by that on iOS to get true pixel values. (Doing so in this case we actually do end up with 10, 10, 100 because presumably the image scale is recorded as something like 3.3333?)

Comments

  1. Christopher Williams 2020-07-02

    https://github.com/appcelerator/titanium_mobile/pull/11803
  2. Samir Mohammed 2020-07-09

    FR Passed, waiting on Jenkins build.
  3. Christopher Williams 2020-07-13

    Merged to master for 9.1.0 target
  4. Sohail Saddique 2020-08-06

    Fix verified on build 9.1.0.v20200804082025. Closing ticket.

JSON Source