WRITE/ READ VALUE TO/FROM EEPROM - Storing Image on EEPROM through processing

I am trying to store an image on EEPROM through processing. First, I upload the code you see below on Arduino and then pass the values through from processing to ARDUINO and EEPROM. In the arduino script I write on EEPROM and then I try to read the value I wrote and print it back to the serial..but the value I get is different from what I wrote or nonsense. First code is arduino and the second of processing for storing the image. Is this way to achieve what I want right? and if yes why I don't read the values that I write? Any help very appreciated.

ARDUINO CODE:

  #include <Wire.h> //I2C library
  byte inByte;
  int addr = 0;
  int pass = 0;

  // WARNING: address is a page address, 6-bit end will wrap around
  // also, data can be maximum of about 30 bytes, because the Wire library has a buffer of 32 bytes
  void i2c_eeprom_write_page( int deviceaddress, unsigned int eeaddresspage, byte* data, byte length ) {
    Wire.beginTransmission(deviceaddress);
    Wire.send((int)(eeaddresspage >> 8)); // MSB
    Wire.send((int)(eeaddresspage & 0xFF)); // LSB
    byte c;
    for ( c = 0; c < length; c++)
    Wire.send(data[c]);
    Wire.endTransmission();
  }
  
    byte i2c_eeprom_read_byte( int deviceaddress, unsigned int eeaddress ) {
    byte rdata = 0xFF;
    Wire.beginTransmission(deviceaddress);
    Wire.send((int)(eeaddress >> 8)); // MSB
    Wire.send((int)(eeaddress & 0xFF)); // LSB
    Wire.endTransmission();
    Wire.requestFrom(deviceaddress,1);
    if (Wire.available()) rdata = Wire.receive();
    return rdata;
  }

  void setup() 
  {
    Wire.begin(); // initialise the connection
    Serial.begin(9600);
  }
  
  void loop()
{
  if(Serial.available() > 0)
  
  {
      inByte = Serial.read(); // Read an incoming Byte from Processing
      char val = inByte;
      i2c_eeprom_write_page(0x50, addr, (byte *)val, sizeof(val)); // write to EEPROM
      addr = addr + 1;
      delay(10); //add a small delay
      Serial.print("Value written in Address ");
      Serial.println(addr);
      delay(500);
      byte b = i2c_eeprom_read_byte(0x50, addr); // access the first address from the memory
      Serial.print("Value read from EEPROM ");
      Serial.println(b,DEC);
  }
}

PROCESSING CODE:

//This code reads the pixel values of a 15x15 Matrix
import processing.serial.*;
Serial port;
int initval=0; //initial value that the matrix starts
int pixval=0; //pixel value each time
int rows = 15; //number of the matrix rows & columns
PImage myImage;
int pass = 0;
float clr;
int intclr;
String printclr;

void setup()
{
  port = new Serial(this,Serial.list()[1], 9600);
  size(50,50);
  myImage = loadImage("image_name.jpg");
  image (myImage, 0, 0, width, height);
  myImage.loadPixels();
}

void readPort()
{
 	while(port.available()>0)
	{
	  char inChar = port.readChar();
	  print(inChar);
	}
	println();
}

void draw()
{
  if(pass == 0)
  {
    pass = 1;
    delay(2000);
    
    for (int k=1;k<=rows;k++){
    for (pixval = pixval; pixval < initval + k*rows; pixval = pixval+1)
    {
	color a = myImage.pixels[pixval];
	
        for(int j=0;j<3;j++){
          
             if (j==0)  { clr = red(a); printclr = "RED"; }
        else if (j==1)  { clr = green(a); printclr = "GREEN";}
        else if (j==2)  { clr = blue(a); printclr = "BLUE";}
 
	intclr = int(clr);
	print("Sending ");
        print(printclr); 
        print(" value #");
	print(pixval);
	print(" ");
        println();
	println(intclr);
        port.write(intclr);
	delay(1500);
        readPort();      
    }  
   }
  }
 }
}