In samsung S4 when we are takig photos in portrait mode its rotating the...

...m by 90 degrees, so used EXIF data to check the degrees by which image is rotated, and then rotaing the image in reverse direction by same degrees to avoid this.