- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想加载一个 bmp 文件(用 Java 语言)并在 java 程序的语法中操作图像数据。我怎样才能做到这一点?我尝试只加载图像,如下所示:
public static void main(String[] args) {
System.out.println("START");
loadbitmap lbm = new loadbitmap();
lbm.loadBMPFile();
System.out.println("END");
}
private void loadBMPFile()
{
{
try{
FileInputStream fstream = new FileInputStream("sample_fingerprint_grayscale.bmp");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String inputString;
while ((inputString = br.readLine()) != null) {
readBMPFile.add(inputString);
}
in.close();
}
catch (Exception e){
System.out.println("IN ERROR");
System.err.println("Error: " + e.getMessage());
}
System.out.println("IN loadBMPFile");
System.out.println("BMP size is " + readBMPFile.size());
System.out.println(readBMPFile.get(2));
}
}
}
但是当我检查数据时,它并不真正存在。我在这方面是个菜鸟,所以任何正确方向的观点都会受到赞赏。
这是输出:
START
IN loadBMPFile
BM¸U
(At this point there is a large amount of gibberish characters that won't paste into Stack Overflow)
END
我有一个十六进制阅读器(Frhed),可以将这些字符格式化为十六进制格式,我希望我可以将它们放入数组列表中并从那里操作它们。
这是十六进制读取器输出:
BM<bh:b8>U<bh:01><bh:00><bh:00><bh:00><bh:00><bh:00>6<bh:04><bh:00><bh:00>(<bh:00><bh:00><bh:00><bh:f0><bh:00><bh:00><bh:00><bh:98><bh:fe><bh:ff><bh:ff><bh:01><bh:00><bh:08><bh:00><bh:00><bh:00><bh:00><bh:00><bh:82>Q<bh:01><bh:00><bh:12><bh:0b><bh:00><bh:00><bh:12><bh:0b><bh:00><bh:00><bh:00><bh:00><bh:00><bh:00><bh:00><bh:00><bh:00><bh:00><bh:00><bh:00><bh:00><bh:00><bh:01><bh:01><bh:01><bh:00><bh:02><bh:02><bh:02><bh:00><bh:03><bh:03><bh:03><bh:00><bh:04><bh:04><bh:04><bh:00><bh:05><bh:05><bh:05><bh:00><bh:06><bh:06><bh:06><bh:00><bh:07><bh:07><bh:07><bh:00><bh:08><bh:08><bh:08><bh:00><bh:09><bh:09><bh:09><bh:00>
<bh:00><bh:0b><bh:0b><bh:0b><bh:00><bh:0c><bh:0c><bh:0c><bh:00>
<bh:00><bh:0e><bh:0e><bh:0e><bh:00><bh:0f><bh:0f><bh:0f><bh:00><bh:10><bh:10><bh:10><bh:00><bh:11><bh:11><bh:11><bh:00><bh:12><bh:12><bh:12><bh:00><bh:13><bh:13><bh:13><bh:00><bh:14><bh:14><bh:14><bh:00><bh:15><bh:15><bh:15><bh:00><bh:16><bh:16><bh:16><bh:00><bh:17><bh:17><bh:17><bh:00><bh:18><bh:18><bh:18><bh:00><bh:19><bh:19><bh:19><bh:00><bh:1a><bh:1a><bh:1a><bh:00><bh:1b><bh:1b><bh:1b><bh:00><bh:1c><bh:1c><bh:1c><bh:00><bh:1d><bh:1d><bh:1d><bh:00><bh:1e><bh:1e><bh:1e><bh:00><bh:1f><bh:1f><bh:1f><bh:00> <bh:00>!!!<bh:00>"""<bh:00>###<bh:00>$$$<bh:00>%%%<bh:00>&&&<bh:00>'''<bh:00>(((<bh:00>)))<bh:00>***<bh:00>+++<bh:00>,,,<bh:00>---<bh:00>...<bh:00>///<bh:00>000<bh:00>111<bh:00>222<bh:00>333<bh:00>444<bh:00>555<bh:00>666<bh:00>777<bh:00>888<bh:00>999<bh:00>:::<bh:00>;;;<bh:00>\<\<\<<bh:00>===<bh:00>>>><bh:00>???<bh:00>@@@<bh:00>AAA<bh:00>BBB<bh:00>CCC<bh:00>DDD<bh:00>EEE<bh:00>FFF<bh:00>GGG<bh:00>HHH<bh:00>III<bh:00>JJJ<bh:00>KKK<bh:00>LLL<bh:00>MMM<bh:00>NNN<bh:00>OOO<bh:00>PPP<bh:00>QQQ<bh:00>RRR<bh:00>SSS<bh:00>TTT<bh:00>UUU<bh:00>VVV<bh:00>WWW<bh:00>XXX<bh:00>YYY<bh:00>ZZZ<bh:00>[[[<bh:00>\\\\\\<bh:00>]]]<bh:00>^^^<bh:00>___<bh:00>```<bh:00>aaa<bh:00>bbb<bh:00>ccc<bh:00>ddd<bh:00>eee<bh:00>fff<bh:00>ggg<bh:00>hhh<bh:00>iii<bh:00>jjj<bh:00>kkk<bh:00>lll<bh:00>mmm<bh:00>nnn<bh:00>ooo<bh:00>ppp<bh:00>qqq<bh:00>rrr<bh:00>sss<bh:00>ttt<bh:00>uuu<bh:00>vvv<bh:00>www<bh:00>xxx<bh:00>yyy<bh:00>zzz<bh:00>{{{<bh:00>|||<bh:00>}}}<bh:00>~~~<bh:00><bh:7f><bh:7f><bh:7f><bh:00><bh:80><bh:80><bh:80><bh:00><bh:81><bh:81><bh:81><bh:00><bh:82><bh:82><bh:82><bh:00><bh:83><bh:83><bh:83><bh:00><bh:84><bh:84><bh:84><bh:00><bh:85><bh:85><bh:85><bh:00><bh:86><bh:86><bh:86><bh:00><bh:87><bh:87><bh:87><bh:00><bh:88><bh:88><bh:88><bh:00><bh:89><bh:89><bh:89><bh:00><bh:8a><bh:8a><bh:8a><bh:00><bh:8b><bh:8b><bh:8b><bh:00><bh:8c><bh:8c><bh:8c><bh:00><bh:8d><bh:8d><bh:8d><bh:00><bh:8e><bh:8e><bh:8e><bh:00><bh:8f><bh:8f><bh:8f><bh:00><bh:90><bh:90><bh:90><bh:00><bh:91><bh:91><bh:91><bh:00><bh:92><bh:92><bh:92><bh:00><bh:93><bh:93><bh:93><bh:00><bh:94><bh:94><bh:94><bh:00><bh:95><bh:95><bh:95><bh:00><bh:96><bh:96><bh:96><bh:00><bh:97><bh:97><bh:97><bh:00><bh:98><bh:98><bh:98><bh:00><bh:99><bh:99><bh:99><bh:00><bh:9a><bh:9a><bh:9a><bh:00><bh:9b><bh:9b><bh:9b><bh:00><bh:9c><bh:9c><bh:9c><bh:00><bh:9d><bh:9d><bh:9d><bh:00><bh:9e><bh:9e><bh:9e><bh:00><bh:9f><bh:9f><bh:9f><bh:00><bh:a0><bh:a0><bh:a0><bh:00><bh:a1><bh:a1><bh:a1><bh:00><bh:a2><bh:a2><bh:a2><bh:00><bh:a3><bh:a3><bh:a3><bh:00><bh:a4><bh:a4><bh:a4><bh:00><bh:a5><bh:a5><bh:a5><bh:00><bh:a6><bh:a6><bh:a6><bh:00><bh:a7><bh:a7><bh:a7><bh:00><bh:a8><bh:a8><bh:a8><bh:00><bh:a9><bh:a9><bh:a9><bh:00><bh:aa><bh:aa><bh:aa><bh:00><bh:ab><bh:ab><bh:ab><bh:00><bh:ac><bh:ac><bh:ac><bh:00><bh:ad><bh:ad><bh:ad><bh:00><bh:ae><bh:ae><bh:ae><bh:00><bh:af><bh:af><bh:af><bh:00><bh:b0><bh:b0><bh:b0><bh:00><bh:b1><bh:b1><bh:b1><bh:00><bh:b2><bh:b2><bh:b2><bh:00><bh:b3><bh:b3><bh:b3><bh:00><bh:b4><bh:b4><bh:b4><bh:00><bh:b5><bh:b5><bh:b5><bh:00><bh:b6><bh:b6><bh:b6><bh:00><bh:b7><bh:b7><bh:b7><bh:00><bh:b8><bh:b8><bh:b8><bh:00><bh:b9><bh:b9><bh:b9><bh:00><bh:ba><bh:ba><bh:ba><bh:00><bh:bb><bh:bb><bh:bb><bh:00><bh:bc><bh:bc><bh:bc><bh:00><bh:bd><bh:bd><bh:bd><bh:00><bh:be><bh:be><bh:be><bh:00><bh:bf><bh:bf><bh:bf><bh:00><bh:c0><bh:c0><bh:c0><bh:00><bh:c1><bh:c1><bh:c1><bh:00><bh:c2><bh:c2><bh:c2><bh:00><bh:c3><bh:c3><bh:c3><bh:00><bh:c4><bh:c4><bh:c4><bh:00><bh:c5><bh:c5><bh:c5><bh:00><bh:c6><bh:c6><bh:c6><bh:00><bh:c7><bh:c7><bh:c7><bh:00><bh:c8><bh:c8><bh:c8><bh:00><bh:c9><bh:c9><bh:c9><bh:00><bh:ca><bh:ca><bh:ca><bh:00><bh:cb><bh:cb><bh:cb><bh:00><bh:cc><bh:cc><bh:cc><bh:00><bh:cd><bh:cd><bh:cd><bh:00><bh:ce><bh:ce><bh:ce><bh:00><bh:cf><bh:cf><bh:cf><bh:00><bh:d0><bh:d0><bh:d0><bh:00><bh:d1><bh:d1><bh:d1><bh:00><bh:d2><bh:d2><bh:d2><bh:00><bh:d3><bh:d3><bh:d3><bh:00><bh:d4><bh:d4><bh:d4><bh:00><bh:d5><bh:d5><bh:d5><bh:00><bh:d6><bh:d6><bh:d6><bh:00><bh:d7><bh:d7><bh:d7><bh:00><bh:d8><bh:d8><bh:d8><bh:00><bh:d9><bh:d9><bh:d9><bh:00><bh:da><bh:da><bh:da><bh:00><bh:db><bh:db><bh:db><bh:00><bh:dc><bh:dc><bh:dc><bh:00><bh:dd><bh:dd><bh:dd><bh:00><bh:de><bh:de><bh:de><bh:00><bh:df><bh:df><bh:df><bh:00><bh:e0><bh:e0><bh:e0><bh:00><bh:e1><bh:e1><bh:e1><bh:00><bh:e2><bh:e2><bh:e2><bh:00><bh:e3><bh:e3><bh:e3><bh:00><bh:e4><bh:e4><bh:e4><bh:00><bh:e5><bh:e5><bh:e5><bh:00><bh:e6><bh:e6><bh:e6><bh:00><bh:e7><bh:e7><bh:e7><bh:00><bh:e8><bh:e8><bh:e8><bh:00><bh:e9><bh:e9><bh:e9><bh:00><bh:ea><bh:ea><bh:ea><bh:00><bh:eb><bh:eb><bh:eb><bh:00><bh:ec><bh:ec><bh:ec><bh:00><bh:ed><bh:ed><bh:ed><bh:00><bh:ee><bh:ee><bh:ee><bh:00><bh:ef><bh:ef><bh:ef><bh:00><bh:f0><bh:f0><bh:f0><bh:00><bh:f1><bh:f1><bh:f1><bh:00><bh:f2><bh:f2><bh:f2><bh:00><bh:f3><bh:f3><bh:f3><bh:00><bh:f4><bh:f4><bh:f4><bh:00><bh:f5><bh:f5><bh:f5><bh:00><bh:f6><bh:f6><bh:f6><bh:00><bh:f7><bh:f7><bh:f7><bh:00><bh:f8><bh:f8><bh:f8><bh:00><bh:f9><bh:f9><bh:f9><bh:00><bh:fa><bh:fa><bh:fa><bh:00><bh:fb><bh:fb><bh:fb><bh:00><bh:fc><bh:fc><bh:fc><bh:00><bh:fd><bh:fd><bh:fd><bh:00><bh:fe><bh:fe><bh:fe><bh:00><bh:ff><bh:ff><bh:ff><bh:00><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff><bh:ff>
最佳答案
BufferedImage img = ImageIO.read(new File("... .bmp"));
BufferedImage 也可以更改,因此非常适合修改。
关于java - 以编程方式更改 BMP 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10109420/
正如标题中所描述的那样。代码如下所示 #include #include using namespace std; #define WIDTH 90 #define HEIGHT 180 cla
我正在开发一个程序来调整 BMP 文件的大小并将其存储在一个新文件中。我注意到有些 BMP 完全颠倒存储,而其他 BMP 则只是直立存储。所以我做了两个解决方案来处理这两种情况。我的问题是如何事先知道
如何使用 ZPL II 打印位图 (BMP) 图像? 我使用 ~DY 将 BMP 下载到打印机: ~DYR:PRINT,B,B, , , 我正在使用 PHP 将原始数据发送到打印机,因此 <>
我正在尝试将彩色 BMP 文件转换为灰度 BMP。输入 bmp 是 24 位,我在输出端生成相同的 24 位 bmp,只是这次是灰度。 我使用的代码是 for(int x = 0; x < max;
正如在 this example 中所见, BMP 文件中的每个 channel (R, G, B) 接受一个输入。一个 24 位的 BMP 图像有 8 位的-R、8 位的 G 和 8 位的 B。我在
总结: 直接计算表明:一张3289 X 4570 X 32bpp的.BMP图片大约需要53MB。同样大小但24bpp的图片大约需要43MB,16bpp的图片大约需要28MB。在我的情况下,ChemDr
我有 24 位图像,我读取位图并将其转换为灰度并像 8 位一样保存。 RGBTRIPLE temp; unsigned char t; ... t = (temp.rgbtBlue * 0.114 +
我想从另一个更大的 bmp 文件中找到一个小的 bmp 文件(更大的一个是从屏幕上捕获的并称为 Sample.bmp ,小的 bmp 文件称为 Button.bmp 。事情是在比较图像时文件可以随处可
我需要使用 .bmp 类型的图像。其格式为: struct bmp_fileheader { unsigned char fileMarker1; /* 'B' */ unsigne
我正在尝试获取一个 BMP 文件并将其读入,然后对其中的像素执行操作以更改其颜色。我的问题是我无法将文件中的数据读入两个 BMP header 结构。我能够很好地将所有数据读入第一个结构,但在读入第二
这个问题已经有答案了: Why does comparing strings using either '==' or 'is' sometimes produce a different resul
我正在尝试使用以下代码将 bmp 图像转换为 jpeg。 from PIL import Image img = Image.open('/Desktop/xyz.bmp') new_img = im
在 24 位 bmp 中,像素存储为 BGR,每种颜色仅占用 1 个字节。那个可以读 for(i=0;i
我在学校有一个任务,要将水印 bmp 图像添加到其他 bmp 图像中。该任务称为 alpha 混合。我必须在用户将在启动时通过程序参数设置的特定坐标插入水印,以及水印混合的 alpha 值。我几乎成功
这是我的位图对象 Bitmap b = new Bitmap(columns, rows, PixelFormat.Format8bppIndexed); BitmapData bmd = b.Loc
我的编程平台是: Ubuntu 3.19 ImageMagick 6.7.7 编程语言:php 我的代码: $img = new Imagick($image_input_24bit_bmp); $i
这是我的函数,我根据维基百科 BITMAPINFOHEADER 使用标题 BMP。但是,我得到的文件没有任何图像...当放置填充时,该过程停止。 // Structures for header i
我正在发布一个 .NET 程序,并且正处于完善阶段。我需要在项目属性中设置图标。根据我的研究,我想创建以下像素大小的图像以适应所有图标大小:16、32、48、96、256。 我还找到了一个程序,可以将
我正在尝试从 BMP 图像创建 GD 图像资源,但是我没有运气。 有问题的 BMP 图像是用 Photoshop 创建和保存的。我也尝试了几个在网上找到的 BMP,它们给出了相同的结果。 getima
类型 FXPT2DOT30 出现在为 BMP 文件定义 struct CIEXYZ 时,根据微软提供的定义: http://msdn.microsoft.com/en-us/library/windo
我是一名优秀的程序员,十分优秀!