The understanding of orientation in EXIF information of pictures and the processing of it

Source: Internet
Author: User

This problem is in the use of seven of cattle upload pictures after the wide height of the found, a picture, with the picture browser Open is always a vertical chart, but to view the properties or the seven bull to obtain a wide height, but found a large, that is, in the attribute this is a horizontal map. This causes a problem for the client to display the picture with that wide height.

Here is an example that you can refer to:

1, image address is: http://7xt44n.com2.z0.glb.qiniucdn.com/exif.png

Open to see a vertical graph.

2, with seven of the API to remove all the additional information, it seems this picture: Http://7xt44n.com2.z0.glb.qiniucdn.com/exif.png?imageMogr2/strip

You will find that the figure itself is a horizontal map.

I have no research on graphics, after consulting a graphic doctor to get the answer, the original is because the camera to the image of the EXIF information added a orientation, and then the image browser will be compatible with this property, so that the picture is displayed in the form of a vertical graph. Let me explain this attribute to orientation.

The EXIF Orientation parameter allows you to look at the picture in the right direction without having to manually rotate it, and this parameter has the following values:

EXIF Orientation Value Row #0 is: Column #0 is:
1 Top Left side
2 Top Right side
3 Bottom Right side
4 Bottom Left side
5 Left side Top
6 Right side Top
7 Right side Bottom
8 Left side Bottom

To be honest, the watch is too ugly to understand, even if it becomes Chinese:

Parameters 0 rows (not rotated) 0 columns (not rotated left) Rotation (many methods)
1 On Left
2 On Right Flip horizontally
3 Under Right 180°
4 Under Left Flip vertically
5 Left On Clockwise 90°+ Horizontal Flip
6 Right On Clockwise 90°
7 Right Under Clockwise 90°+ Vertical Flip
8 Left Under 90° counterclockwise

Look at the top and bottom of the eye is really blurred. There is also a picture of the internet circulating:

The figures in this picture correspond to the numbers in the table. I look at this diagram and explain it to you in my own understanding, which may not be standard, but can help you understand this parameter:

In the table of 0 lines, you can understand that as you see the rotation (plus parameters, automatically rotated by the browser) the upper direction of the picture, 0 columns you can understand as you see the rotation of the image to the left. And the table is not a row of data, is the direction corresponding to the original picture direction.

For example, the parameter value 1, 0 rows is the upper, 0 column is left, meaning that the top of the rotation is above the original, the left of the rotation is the left of the original image;

The parameter value 2, 0 row is the upper, 0 column is right, that is above the rotation is above the original image above, rotates after the left is the original image the bottom;

The parameter value 8, 0 row is left, 0 column is the bottom, that is after the rotation is above the original image left, rotates the left is below the original image;

These three examples, in conjunction with pictures and tables, look more even, always understand the meaning of this parameter.

Let's talk about my approach. In fact, on the mobile side, the image Library will be compatible with this parameter, you only need to ensure that your width is not inverted, the mobile side can be displayed normally. So my approach is to upload the image after the call seven of the Exif interface, to obtain EXIF information, and then to judge orientation, if the picture is a 90° rotation of the figure, then the wide-height manual change, you can.

The understanding of orientation in EXIF information of pictures and the processing of it

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.