dexdz
dexdz

Reputation: 43

How to fix "OutOfMemoryError: java.lang.OutOfMemoryError: Java heap space" in JES

Im trying to grayscale an image in JES, the image is about 3000x2000 in size. Whenever I run it, gives me OutOfMemoryError: java.lang.OutOfMemoryError: Java heap space.

Im fairly new to this language so Im not sure if its my code thats the problem.

def grayscale(pic):
 for p in getPixels(pic):
  intensity = (getRed(p) + getGreen(p) + getBlue(p))/3
  setColor(p, makeColor(intensity, intensity, intensity))

The output should just be a grayscaled version of the image

Upvotes: 1

Views: 369

Answers (0)

Related Questions