JBuilder Design Get Picture Property program

Source: Internet
Author: User
Tags character set final

First, the basic overview

The application of the picture is more and more deep into our daily life, such as the current popular SMS business and budding MMS business. Therefore, it is necessary to get the image of the number of bytes, format, color, width and height of information, in order to better on the phone to achieve the perfect effect, to meet the urgent needs of consumers, improve business competitiveness of the final.

Second, picture related information description

1, GIF pictures

The GIF image format identifier is gif87a/gif89a two, but we generally see the GIF image suffix named "gif". Using UltraEdit software to open a GIF image file (for example, 178x42x32 gif), you'll see something like the following figure (1) (Note that the "H" button is clicked!) )。 Its format, width, height, and number of colors information position unchanged, but also continuous together. Where the character set in the Blue box displays picture formatting information, converting hexadecimal "47" to Decimal is "71", the ASCII value of "G", and so on, the rest will get "gif89a", in which the format of the picture is much more reliable than the name of the suffix that gets the picture directly. Since the prefix name user can change at will, each two digits in the red box display their width and height information respectively, and read from right to left, respectively "00b2" and "002A", that is, the decimal is "178" and "42", that is, the width and height of the picture; the green section displays the color information of the picture, and after the decimal is converted to " 196 "and then proceed with the remainder of" 8 "as" 4 ", and finally Add" 1 "as The Power of" 2 ", and finally" 32 ", that is," 2^ (196%8+1) =32 ". "Other format picture parameters"

Figure (1)

2, JPG picture

The JPG picture format identifier is "JFIF" and its information position is unchanged. But the height, width, and number of colors are not quite certain, but they are contiguous together. The following two diagrams (2) [such as 761x150x16m jpg] and figure (3) [such as 1984x1384x16m jpg] are shown, and there are more than two cases. A number of additional explanations are given in respect of figure (2): Each two digits in the red box display their height and width information, and read from left to right, respectively, "0096" and "02f9", that is, the decimal is "150" and "761", which is the height and width of the picture; the green section displays the color information of the picture, After converting the decimal to "03" and then multiplying "8" to "24", and finally as "2" power, the final is "16M", that is, "2^ (3*8+1) =16m." However, as if the color of JPG pictures are generally "16M"?!

Figure (2)

Figure (3)

Note: In order to avoid the above multiple situations, which leads us to deal with very troublesome, I found a small skill. Use the win operating system with the drawing tool to open the "JPG" file, and then do not need to make any changes, as long as save the replacement. When a dramatic change comes out, the height, width, and color information position are similar to the figure (2), that is, the figure (4) is changed by the diagram (3).

Figure (4)

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.