Read 24-bit BMP images and generate JPG thumbnails (2)

zhaozj2021-02-17  163

I believe there should be no problem with the code section? With the following methods, you can get more information:

// Get compression value int ncompression = ((int) BI [19]) << 24) | ((int) Bi [18]) << 16) | ((int)) Bi [17]) << 8) | (int) BI [16]; system.out.println ("Compression:" Ncompression);

// Pixel situation int NXPM = ((int) BI [27] & 0xFF) << 24) | ((int) Bi [26] & 0xff) << 16) | ((int)) Bi [25] & 0xFF << 8) | (int) bi [24] & 0xff; system.out.println ("x-pixel / m:" NXPM); int NYPM = ((int) Bi [31] & 0xff) << 24) | ((int) BI [30] & 0xff) << 16) | ((int) BI [29] & 0xFF) << 8) | (int) bi [28) & 0xff; system.out.println "Y-pixel / meter:" NYPM);

// Color usage int nclrused = ((int) Bi [35] & 0xff) << 24) | ((int) BI [34] & 0xFF) << 16) | ((int)) Bi [33] & 0xFF << 8) | (int) BI [32] & 0xff; system.out.println ("Color usage: nclrused); int nclrimp = ((int) Bi [39] & 0xff) << 24) | ((int) BI [38] & 0xFF) << 16) | ((int) BI [37] & 0xFF) << 8) | (int) bi [36] & 0xff; system.out.println ("color is characterized : " nclrimp); int NPLANES = ((int) Bi [13] & 0xFF) << 8) | (int) BI [12] & 0xff; system.out.println (": " NPLANES);

Image Size in Information Head Int Nbisize = ((int) BI [3] & 0xFF) << 24) | ((int) BI [2] & 0xFF) << 16) | ((int)) 1] & 0xFF) << 8) | (int) BI [0] & 0xFF; System.out.Println ("BMP Information Head Size:" Nbisize);

// File size and type int nsize = ((int) BF [5] & 0xff) << 24) | ((int) bf [4] & 0xff) << 16) | (((int) bf [3] & 0xff) << 8) | (int) BF [2] & 0xff; System.out.Println ("File Category: (Char) BF [0] (Char) BF [1]); System.out.println ("File size:" nsize); Postscript can determine if it is an 8-bit bitmap and makes appropriate processing by variable nbitcount. Limited to the current 24-bit bitmap application is more extensive, so there is no corresponding code. If you need to consult the work of Jeff West and John D. Mitchell, "How To Read 8- and 24-Bit Microsoft Windows Bitmaps in Java Applications".

Here, I cautiously said that because the bitmap (BMP) has not been compressed, there is almost no limit to the capacity of the source map, and there will be no memory. When I wrote this article, I only conducted a 9M-left BMP reading. In fact, if you are interested, you can use the TIF map of 50m to convert to BMP (almost 50m) to do a test. And welcome to correct.

(Note that the reference should indicate the original author posted this article:! Rosen Jiang and Source: http: //blog.9cbs.net/rosen)

转载请注明原文地址:https://www.9cbs.com/read-31448.html

New Post(0)