pic-ele.f90

I suggest you either typed  this as it appears into the compiler, or as an easier way, just copy and paste it!

Note: I do not claim the program will 100% work, but I give it my best. If it doesn't, try tweaking it yourself, or email me about it, and I'll modify and post the improved version later. Good luck!  

PROGRAM pic_ele
IMPLICIT NONE

INTEGER, DIMENSION(3,3) :: imageforfile, alternative

imageforfile (1, 1:3) = (/35, 41, 30/)
imageforfile (2, 1:3) = (/38, 45, 42/)
imageforfile (3, 1:3) = (/32, 39, 31/)

!Creates a .dat file called image.dat and the pixels are input into them.
OPEN(UNIT=29, FILE="image.dat", STATUS="unknown", ACTION="WRITE")
WRITE(UNIT=29, FMT=10) imageforfile
CLOSE(UNIT=29)

!Read in the data from image.dat into computer. 
OPEN(UNIT=41, FILE="image.dat", STATUS="old", ACTION="READ")
alternative=imageforfile
CLOSE(UNIT=41)

!Averaging to smooth image
alternative(2,2)=sum(alternative)/9

!Save the smoothed image pixels to another file.
OPEN(UNIT=30, FILE="smoothed.dat", STATUS="unknown", ACTION="WRITE")
WRITE(UNIT=30, FMT=10) alternative
CLOSE(UNIT=30)

10 FORMAT (3I3)

END PROGRAM pic_ele