# Using convolution to upscale an image

**URL:** https://discourse.processing.org/t/using-convolution-to-upscale-an-image/18632
**Category:** Coding Questions
**Created:** [March 13, 2020, 2:45am UTC](https://discourse.processing.org/t/using-convolution-to-upscale-an-image/18632 "2020-03-13T02:45:11Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![zcream](https://avatars.discourse-cdn.com/v4/letter/z/dc4da7/32.png) [@zcream](https://discourse.processing.org/u/zcream)
#### Post date: [March 13, 2020, 2:45am UTC](https://discourse.processing.org/t/using-convolution-to-upscale-an-image/18632/1 "2020-03-13T02:45:11Z")

</div>

I understand how write code to apply a convolution matrix to a pixel. 🙂 Not that hard. Now each upscaling algorithm can be implemented using a convolution kernel. I am just not sure how to apply this to code. Lets say I have a 1000x1000 px image. And I upscale it to 1500x1500 px. Now each pixel maps to 1.5 pixels. How exactly do you apply your convolution in code ?

Could someone kindly show a sample code or pseudocode algorithm for this?

---

<div class="post-metadata">

### Author: ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)
#### Post date: [March 13, 2020, 4:14am UTC](https://discourse.processing.org/t/using-convolution-to-upscale-an-image/18632/2 "2020-03-13T04:14:50Z")

</div>

I will start by asking in stackoverflow after doing a detailed google research on this topic. A convolution matrix to upscale an image is too generic and even if you show a reference or document about your algorithm, it is very likely the code has already been written out there. Share it if you find any and that would be a better start to discuss this further.

Kf
