Skip to content

Feature request: (nice to have) output should extend ImageData #300

@yjutard-while-at-atlassian

Description

Hi, thanks for this lib that looks great! (I'm still evaluating)

I'm trying to pass the output to another lib, which requires an ImageData input:

class ImageData {
  data, // Uint8ClampedArray one-dimensional array containing the data in the RGBA order, with integer values between 0 and 255 (inclusive). The order goes by rows from the top-left pixel to the bottom-right.
  colorSpace, // string indicating the color space of the image data.
  height,
  width,
}

Looking at the output of resvg-js, it looks extremely similar:

export class RenderedImage {
  /** Write the image data to Buffer */
  asPng(): Buffer
  /** Get the RGBA pixels of the image */
  get pixels(): Buffer
  /** Get the PNG width */
  get width(): number
  /** Get the PNG height */
  get height(): number
}

My suggestion is to switch the output of resvg-js to the standard API ImageData or provide a conversion function, ex. toImageData()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions