1.0.6 • Published 9 months ago

jb2 v1.0.6

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
9 months ago

easyJBIG2show

an easy JBIG2 file web show
csdn地址 git地址

一、背景

最近无意中接触到了一个二维码图片,该图片格式是jb2格式。翻阅资料发现JBIG标准最初在1993年发布,在当时被广泛应用于传真机和文档扫描仪等设备中。JBIG采用了一种自适应二进制编码算法,能够有效地压缩包含大量文本和线条等的二值图像。
随着技术的进步和需求的增加,JBIG2标准于2000年发布,对于从传真到高分辨率彩色扫描文档等各种类型的图像进行无损压缩提供了更好的性能和灵活性。JBIG2引入了更先进的编码技术,如上下文自适应算法和模板匹配,能够进一步减小文件大小,提高压缩率。 JBIG2标准的发布促使了许多设备和应用程序的支持。它被广泛用于电子归档、数字图书馆、OCR(光学字符识别)和文档管理等领域,以实现高效的文档扫描和存储。 总的来说,JBIG2作为一种专门针对二值图像的无损压缩技术,为高质量的文档图像处理提供了重要的工具和方法,并在数字化文档管理和传输中发挥了重要的作用。
由于web端的图片不能对jb2文件格式正确展示,由此想到需要转换。

二、前人经验

网络资源很少,这也是为什么在这里分享的原因。虽然很少,但还是找了些蛛丝马迹,指向了mozilla/pdf.js。
在这里我把需要使用的所有js都整合到这里

三、VUE 使用方法

  npm i jb2


<template>
<div class="hello">
<h1>{{ msg }}</h1>
<input type="file" @change="handleFileSelect">
<img v-bind:src="imageSrc" />
</div>
</template>

<script>
import JB2 from "jb2"

export default {
name: 'HelloWorld',
data() {
return {
  msg: 'Welcome to Your Vue.js App',
  imageSrc: ''
}
},
methods: {
handleFileSelect(event) {
  var files = event.target.files; // 获取选择的文件数组
  var file = files[0]; // 获取第一个文件

  var jb2 = new JB2();
  var  ret=jb2.jb2Image(file,'png');
  ret.then((image) => {
    this.imageSrc = image.src;
  });

}
}
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1,
h2 {
font-weight: normal;
}

ul {
list-style-type: none;
padding: 0;
}

li {
display: inline-block;
margin: 0 10px;
}

a {
color: #42b983;
}</style>
1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago