# Dealing with NaN pixels

When there are NaN pixels in your render you can either use the value of an adjacent pixel or the average of all adjacent pixels to fix it. The latter will probably give better results, but won’t work when there’s another NaN pixel next to the first one. In an expression node, type:

1 |
isnan(r)? r(x+1,y):r |

or

1 |
isnan(r)? ((r(x+1,y)+r(x+1,y+1)+r(x+1,y-1)+r(x,y+1)+r(x,y-1)+r(x-1,y+1)+r(x-1,y)+r(x-1,y-1))/8):r |

Mirroring animation timing using tcl Dealing with Inf or -Inf pixels