# Image conversion without resizing

**URL:** <https://discourse.gohugo.io/t/image-conversion-without-resizing/32429>\
**Category:** support\
**Created:** [April 18, 2021, 9:11pm UTC](https://discourse.gohugo.io/t/image-conversion-without-resizing/32429 "2021-04-18T21:11:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [April 18, 2021, 9:11pm UTC](https://discourse.gohugo.io/t/image-conversion-without-resizing/32429/1 "2021-04-18T21:11:49Z")

</div>

If I want to convert an image from BMP to JPG without resizing, this is the only approach I know of:

```auto
{{ $i := resources.Get "image.bmp" }}
{{ $resizeOptions := printf "%dx%d jpg" $i.Width $i.Height }}
{{ $i = $i.Resize $resizeOptions }}

```

Is there a better way?

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [April 18, 2021, 9:53pm UTC](https://discourse.gohugo.io/t/image-conversion-without-resizing/32429/2 "2021-04-18T21:53:15Z")

</div>

> [@jmooring](#):
>
> Is there a better way?

Currently no, but I have thought about adding a `Convert` method.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [April 18, 2021, 9:59pm UTC](https://discourse.gohugo.io/t/image-conversion-without-resizing/32429/3 "2021-04-18T21:59:44Z")

</div>

While the body’s open, how about a `Rotate` method as well?

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [April 18, 2021, 10:11pm UTC](https://discourse.gohugo.io/t/image-conversion-without-resizing/32429/4 "2021-04-18T22:11:32Z")

</div>

Well, you could imagine:

```auto
{{ $img = $img.Convert "webp r90" }}
{{ $img = $img.Convert "r90" }}

```

As in `Convert` does no scaling, but allows “all the other keywords”.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [April 18, 2021, 10:31pm UTC](https://discourse.gohugo.io/t/image-conversion-without-resizing/32429/5 "2021-04-18T22:31:19Z")

</div>

Perfect.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [April 20, 2021, 11:19pm UTC](https://discourse.gohugo.io/t/image-conversion-without-resizing/32429/6 "2021-04-20T23:19:51Z")

</div>

Closed on April 20, 2021, 11:19pm UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
