# Scale without blurring?

**URL:** <https://discourse.libcinder.org/t/scale-without-blurring/389>\
**Category:** Using Cinder\
**Created:** [November 14, 2016, 4:09pm UTC](https://discourse.libcinder.org/t/scale-without-blurring/389 "2016-11-14T16:09:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![SuperRockG](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@SuperRockG](https://discourse.libcinder.org/u/SuperRockG)\
**Post date:** [November 14, 2016, 4:09pm UTC](https://discourse.libcinder.org/t/scale-without-blurring/389/1 "2016-11-14T16:09:31Z")

</div>

Hi,

I am trying to scale an image to larger than its original size when rendering. I am using the below code but it is blurring the image. My scale is set in the ci::mat4 returned by GetTransform().

```
ci::gl::enableAlphaBlending(m_bPremultiplied); 
ci::gl::pushModelView();
ci::gl::multModelMatrix(m_pPosition->GetTransform());

ci::gl::color(m_Color);

ci::gl::draw(m_pTexture, m_pPosition->GetRect());

ci::gl::popModelView();
ci::gl::disableAlphaBlending();

```

For comparison, I can load my image in photoshop/gimp and zoom in to view individual pixels. I would like to recreate that level of zoom.

---

<div class="post-metadata">

**Author:** ![dashandslash](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/dashandslash/32/112_2.png) [@dashandslash](https://discourse.libcinder.org/u/dashandslash)\
**Post date:** [November 14, 2016, 4:53pm UTC](https://discourse.libcinder.org/t/scale-without-blurring/389/2 "2016-11-14T16:53:18Z")

</div>

Hi SuperRockG,

you should set you m\_pTexture to GL\_NEAREST instead of GL\_LINEAR.

assuming that you m\_pTexture is a gl::Texture2dRef, something like:

```auto
gl::Texture2d::Format format;
format.setMagFilter( GL_LINEAR );
format.setMinFilter( GL_LINEAR );
m_pTexture = Texture2d::create(width, height, format);

```

Edit (just to be correct):

```auto
gl::Texture2d::Format format;
format.setMagFilter( GL_NEAREST );
m_pTexture = Texture2d::create(width, height, format);

```

I hope this will solve your issue.

L

---

<div class="post-metadata">

**Author:** ![paul.houx](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/paul.houx/32/31_2.png) [@paul.houx](https://discourse.libcinder.org/u/paul.houx)\
**Post date:** [November 14, 2016, 5:53pm UTC](https://discourse.libcinder.org/t/scale-without-blurring/389/3 "2016-11-14T17:53:05Z")

</div>

To be more precise: change your `magFilter()` to `GL_NEAREST` to disable linear interpolation when zooming in (magnifying your texture).

---

<div class="post-metadata">

**Author:** ![dashandslash](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/dashandslash/32/112_2.png) [@dashandslash](https://discourse.libcinder.org/u/dashandslash)\
**Post date:** [November 14, 2016, 10:49pm UTC](https://discourse.libcinder.org/t/scale-without-blurring/389/4 "2016-11-14T22:49:05Z")

</div>

> [@paul.houx](#):
>
> magFilter()

Ops I wrote exactly the opposite than what SuperRockG needed…  
True, for zooming just the magFilter is involved.

L

---

<div class="post-metadata">

**Author:** ![SuperRockG](https://avatars.discourse-cdn.com/v4/letter/s/fbc32d/32.png) [@SuperRockG](https://discourse.libcinder.org/u/SuperRockG)\
**Post date:** [November 19, 2016, 4:17pm UTC](https://discourse.libcinder.org/t/scale-without-blurring/389/5 "2016-11-19T16:17:44Z")

</div>

Thanks, works great.
