# Gamebuino Meta Rotate and flip Image

**URL:** <https://community.gamebuino.com/t/gamebuino-meta-rotate-and-flip-image/210>\
**Category:** English / Anglais\
**Created:** [29 May 2021 09:21 UTC](https://community.gamebuino.com/t/gamebuino-meta-rotate-and-flip-image/210 "2021-05-29T09:21:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sentinel87](https://community.gamebuino.com/user_avatar/community.gamebuino.com/sentinel87/32/88_2.png) [@sentinel87](https://community.gamebuino.com/u/sentinel87)\
**Post date:** [29 May 2021 09:21 UTC](https://community.gamebuino.com/t/gamebuino-meta-rotate-and-flip-image/210/1 "2021-05-29T09:21:24Z")

</div>

Is there any way to Rotate or Flip horizontally/vertically Image by drawImage function? I cannot see any options in the api reference.

---

<div class="post-metadata">

**Author:** ![Steph](https://community.gamebuino.com/user_avatar/community.gamebuino.com/steph/32/395_2.png) [@Steph](https://community.gamebuino.com/u/Steph)\
**Post date:** [29 May 2021 12:13 UTC](https://community.gamebuino.com/t/gamebuino-meta-rotate-and-flip-image/210/2 "2021-05-29T12:13:03Z")

</div>

You can flip images horizontally and vertically with this version of the `drawImage()` function:

```cpp
void drawImage(int16_t x, int16_t y, Image& img, int16_t w2, int16_t h2);

```

You just have to use negative values for `w2` and/or `h2`.

For the rotations, you will have to code them by yourself… 😕

But you can take inspiration from [the work of @bfx](https://gamebuino.com/fr/creations/affine) for this.

---

<div class="post-metadata">

**Author:** ![sentinel87](https://community.gamebuino.com/user_avatar/community.gamebuino.com/sentinel87/32/88_2.png) [@sentinel87](https://community.gamebuino.com/u/sentinel87)\
**Post date:** [29 May 2021 19:44 UTC](https://community.gamebuino.com/t/gamebuino-meta-rotate-and-flip-image/210/3 "2021-05-29T19:44:29Z")

</div>

Omg that’s exactly what I was looking for 😃 In my new project i have a lot of image arrays which are only ‘mirrors’ of the current sprites. Now I can remove them to save a lot sketch and memory place using this little trick. Thank you so much for solution @Steph 🙂

---

<div class="post-metadata">

**Author:** ![Steph](https://community.gamebuino.com/user_avatar/community.gamebuino.com/steph/32/395_2.png) [@Steph](https://community.gamebuino.com/u/Steph)\
**Post date:** [29 May 2021 19:51 UTC](https://community.gamebuino.com/t/gamebuino-meta-rotate-and-flip-image/210/4 "2021-05-29T19:51:43Z")

</div>

Yes, this is precisely the trick to apply to drastically reduce the number of sprites or tiles. And don’t declare your images as global variables to save RAM!

Take a look at [this tutorial](https://community.gamebuino.com/t/new-creation-handling-images-on-the-gamebuino-meta-by-steph/201). You might find some other tips. 👀

---

<div class="post-metadata">

**Author:** ![tarcisiotm](https://community.gamebuino.com/user_avatar/community.gamebuino.com/tarcisiotm/32/132_2.png) [@tarcisiotm](https://community.gamebuino.com/u/tarcisiotm)\
**Post date:** [30 May 2021 03:28 UTC](https://community.gamebuino.com/t/gamebuino-meta-rotate-and-flip-image/210/5 "2021-05-30T03:28:42Z")

</div>

I also recommend the tutorial made and linked here by @Steph. It has helped me a lot so far, getting acquainted with the platform.

---

<div class="post-metadata">

**Author:** ![JMP](https://community.gamebuino.com/user_avatar/community.gamebuino.com/jmp/32/5_2.png) [@JMP](https://community.gamebuino.com/u/JMP)\
**Post date:** [10 June 2021 16:35 UTC](https://community.gamebuino.com/t/gamebuino-meta-rotate-and-flip-image/210/6 "2021-06-10T16:35:11Z")

</div>

> **[Graphics::drawImage - Gamebuino](https://gamebuino.com/academy/reference/graphics-drawimage)**
>
> Descriptionvoid Graphics::drawImage( int16\_t x , int16\_t y , Image img \[, int16\_t w2 , int16\_t h2 \] )
> void Graphics::drawImage( int16\_t x , int16\_t y , Image img , int16\_t source\_x , int16\_t source\_y , int16\_t source\_width , int16\_t source\_height...

API documentation updated 😉
