An image processing device that generates an image file, comprising: a display on a front surface of the device; a camera lens on said front surface or an opposite back surface of the device, the device having a substantially quadrangular shape, the lens having an optical axis direction; an accepting section that accepts an acquisition order of image data; an image data acquirer that acquires image data if the accepting section receives the acquisition order; an orientation identifier that identifies a landscape or portrait orientation of the image processing device by using a detection value of an acceleration sensor; a direction identifier that identifies a geomagnetic direction of the camera lens of the image processing device with respect to the north direction by using a detection value along the lens optical axis direction provided by a geomagnetic sensor and orientation information identified by said orientation identifier; and a file generator that generates an image file in which geomagnetic direction information identified by the direction identifier is associated with the image data, characterised in that the orientation identifier determines whether the image processing device is in a horizontal front surface-up or front surface-down orientation, or alternatively is in an inclined or upright non-horizontal landscape or portrait orientation, and if the image processing device is in an inclined or upright non-horizontal landscape or portrait orientation, the direction identifier identifies the geomagnetic direction of the image processing device with respect to the north direction based on the detection value of the geomagnetic sensor and the current lens optical axis direction; and if the orientation of the image processing device changes from a non-horizontal orientation to a horizontal front surface-up or front surface-down orientation, the orientation identifier holds, in a memory, a landscape or portait orientation information corresponding to a moment immediately previous to the moment in which the image processing device becomes in the front surface-up or front surface-down orientation, and if the image processing device is in the horizontal front surface-up or front surface-down orientation, the direction identifier identifies the direction of the image processing device with respect to the north direction based on a direction contained in the plane of the display and perpendicular to the top side of the display as identified by said landscape or portrait orientation information held in the memory. a display on a front surface of the device; a camera lens on said front surface or an opposite back surface of the device, the device having a substantially quadrangular shape, the lens having an optical axis direction; an accepting section that accepts an acquisition order of image data; an image data acquirer that acquires image data if the accepting section receives the acquisition order; an orientation identifier that identifies a landscape or portrait orientation of the image processing device by using a detection value of an acceleration sensor; a direction identifier that identifies a geomagnetic direction of the camera lens of the image processing device with respect to the north direction by using a detection value along the lens optical axis direction provided by a geomagnetic sensor and orientation information identified by said orientation identifier; and a file generator that generates an image file in which geomagnetic direction information identified by the direction identifier is associated with the image data, characterised in that the orientation identifier determines whether the image processing device is in a horizontal front surface-up or front surface-down orientation, or alternatively is in an inclined or upright non-horizontal landscape or portrait orientation, and if the image processing device is in an inclined or upright non-horizontal landscape or portrait orientation, the direction identifier identifies the geomagnetic direction of the image processing device with respect to the north direction based on the detection value of the geomagnetic sensor and the current lens optical axis direction; and if the orientation of the image processing device changes from a non-horizontal orientation to a horizontal front surface-up or front surface-down orientation, the orientation identifier holds, in a memory, a landscape or portait orientation information corresponding to a moment immediately previous to the moment in which the image processing device becomes in the front surface-up or front surface-down orientation, and if the image processing device is in the horizontal front surface-up or front surface-down orientation, the direction identifier identifies the direction of the image processing device with respect to the north direction based on a direction contained in the plane of the display and perpendicular to the top side of the display as identified by said landscape or portrait orientation information held in the memory.