This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 25641 - createImageBitmap() options: output size
Summary: createImageBitmap() options: output size
Status: RESOLVED MOVED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 enhancement
Target Milestone: Needs Impl Interest
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL:
Whiteboard:
Keywords:
Depends on: 25639
Blocks:
  Show dependency treegraph
 
Reported: 2014-05-09 21:17 UTC by Ian 'Hixie' Hickson
Modified: 2016-03-16 14:18 UTC (History)
4 users (show)

See Also:


Attachments

Description Ian 'Hixie' Hickson 2014-05-09 21:17:16 UTC
This bug proposes the following new options for createImageBitmap()'s configuration dictionary (as proposed in bug 25639):

  double? width = null // resulting width if image is to be resampled
  double? height = null // resulting height if image is to be resampled
Comment 1 Ian 'Hixie' Hickson 2014-05-09 21:36:00 UTC
Related to this is the idea of using background-size style options to control exactly what these dimensions mean, for the case where you don't know the source image's dimensions but want an output image that is of this size:

  SizeKind size = 'scale' // how to resize the image
    // SizeKind:
    //   'scale' - stretch or shrink to the given width and height, with the
    //       aspect ratio being ignored
    //   'contain' - the given width and height are maximum values, maintain the
    //       original aspect ratio of sourceW:sourceH
    //   'cover' - the image must be scaled, while maintaining the aspect ratio,
    //       to the smallest size that has a width >= the width member and a
    //       height >= the height member.

When the width and height values are both null, they default to the sourceW and sourceH values (which themselves default to the intrinsic dimensions after taking sourceX and sourceY into account).

When width is set and height is null, then the aspect ratio of sourceW:sourceH is used to set height based on width, and vice versa for height set, width null.
Comment 2 Justin Novosad 2014-05-16 16:56:34 UTC
Should there be an image smoothing option here?