Hello Sumit,

Hope you are doing well.

You can take any image as an example.

Code for reading image files:

import org.apache.spark.SparkContext
import org.apache.spark.SparkConf


object Image extends App{
 val conf = new SparkConf().setAppName("Image").setMaster("local[2]")
    val sc = new SparkContext(conf)
 val a= sc.textFile("file:///home/edureka/Desktop/image")
   a.foreach(println)

}

build.sbt:
name := "Image"
version := "1.0"
scalaVersion := "2.10.4"

libraryDependencies += "org.apache.spark" %% "spark-core" % "1.5.2"

Please kindly check the attachment for creating a spark project.


But while executing this code you have to have a font enabled eclipse or terminal otherwise you will get the below output.