Image processing in Neptyne

Legacy spreadsheets support images but you can’t do much with them other than show them. In Neptyne images are first class citizens. If you’ve done image processing in Python you’ve probably used the Pillow library. Good news! All images in Neptyne are Pillow images and can be processed accordingly. Let’s start by putting an image in a sheet:

=Image (IMAGE_URL)
A
B
C
D
1
2
3
4
5
6
7
8
9
10
11
12

The Image method fetches an image from the provided url and puts that image directly into the sheet. The IMAGE_URL is defined in code since it is a rather long url pointing to wikipedia, see the code below.

Let’s write a quick function to adjust the the brightness of the image using Pillow

from PIL import ImageEnhance

IMAGE_URL = "https://tinyurl.com/2p9cd2j4"
def brighter(img, level):
    enhancer = ImageEnhance.Brightness(img)
    return enhancer.enhance(level)

So we import ImageEnhance and then call Brightness on an image for a certain level. Now that we’ve created this, we can call it straight from the spreadsheet to create a very simple image editor

=brighter(A1,B14)
A
B
C
D
13
Level:
1.2
14
15
16
17
18
19
20
21
22
23
24
25

We call “brighter” on the original image and B14, which contains the desired brightness level. Any time we change the value, the image in A15 changes brightness accordingly!

Try it out at: https://app.neptyne.com/-/ex90d0x6vn