# Proposal: image.slice(x, y, width, height) to slice parts of images

**URL:** <https://es.discourse.group/t/proposal-image-slice-x-y-width-height-to-slice-parts-of-images/2029>\
**Category:** 💡 Ideas\
**Tags:** proposal\
**Created:** [May 1, 2024, 6:28pm UTC](https://es.discourse.group/t/proposal-image-slice-x-y-width-height-to-slice-parts-of-images/2029 "2024-05-01T18:28:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aboudekahil](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/aboudekahil/32/2079_2.png) [@aboudekahil](https://es.discourse.group/u/aboudekahil)\
**Post date:** [May 1, 2024, 6:28pm UTC](https://es.discourse.group/t/proposal-image-slice-x-y-width-height-to-slice-parts-of-images/2029/1 "2024-05-01T18:28:44Z")

</div>

Hey everyone!  
A recent pain I've been having dealing with the `Image` type in js is that I'm constantly working with spritesheets, and I would like to get a slice of an image without drawing it on screen.

Searching for a solution online was hopeless, as the main suggestion was to create a canvas HTML element as buffer, draw the part of the image I want on it and then extract the image from the canvas element. This is painful and there needs to be an alternative.

This is why I am proposing we add a slice method (name not definitive) and want to see the communities opinion on this suggestion.

Thank you!

---

<div class="post-metadata">

**Author:** ![ljharb](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/ljharb/32/8_2.png) [@ljharb](https://es.discourse.group/u/ljharb)\
**Post date:** [May 1, 2024, 7:13pm UTC](https://es.discourse.group/t/proposal-image-slice-x-y-width-height-to-slice-parts-of-images/2029/2 "2024-05-01T19:13:32Z")

</div>

`Image` is in HTML, and this discourse is for the JS language (which doesn't include HTML).

As for the name "slice", that already has an established meaning on lists of things as "produce a sub-list", ie strings, arrays, typed arrays, etc, so it probably isn't a good name for images.

---

<div class="post-metadata">

**Author:** ![aboudekahil](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/aboudekahil/32/2079_2.png) [@aboudekahil](https://es.discourse.group/u/aboudekahil)\
**Post date:** [May 1, 2024, 7:21pm UTC](https://es.discourse.group/t/proposal-image-slice-x-y-width-height-to-slice-parts-of-images/2029/3 "2024-05-01T19:21:14Z")

</div>

oh i misunderstood, sorry!
