如何在在Windows 10上安装OpenJPEG
admin
2023-08-03 03:23:10
0

Windows 11 Pro ISO文件在哪下载最新版?如何下载原装纯净版Win11 ?点击进入   持续更新!

在Windows 10上安装OpenJPEG

OpenJPEG是用C编写的开源JPEG 2000编解码器。没有GUI。使用命令行友好的操作系统(如Linux)可以轻松运行和维护此命令行工具,因此,我建议利用W10的Windows Subsystem for Linux功能在Windows 10计算机上安装Linux 。

以下是从源代码编译OpenJPEG,ImageMagic k和GrokImageCompression的说明。

尽管使用apt通过预编译的版本安装OpenJPEG和ImageMagick更加容易,但是我在编译源代码时可以解决以前的安装问题,所以建议这样做。请注意,您根本不需要安装ImageMagick,但这是一个非常有用的实用程序。

如果您想先尝试通过预编译版本安装OpenJPEG,则可以使用以下命令解决问题:

sudo apt install libopenjp2-7 libopenjp2-tools

为什么要安装GrokImageCompression?

原始JPEG 2000标准仅包含三个颜色编码声明:sGray,sYCC和sRGB。随着色彩管理的普及,图像中嵌入了多种颜色编码显示配置文件,对该标准进行了修订(15444-1annexi.pdf),以适应受限的ICC配置文件的使用。

从openjp2库v2.3.1开始。,OpenJPEG不会继承源图像中嵌入的显示配置文件,而是在输出时将图像颜色空间转换为sRGB。

GrokImageCompression是基于OpenJPEG代码的开源JP2编码器,可成功生成使用与源图像中相同的色彩空间(和ICC显示配置文件)编码的JP2图像。

1.安装Ubuntu 20.04 LTS

从Windows App Store下载 Ubuntu。

请遵循Microsoft的安装说明。

  • 通过运行以下命令来更新安装: sudo apt-get update ; sudo apt-get upgrade -y
  • 安装一些其他软件模块:sudo apt-get install pkg-config emacs-nox python3-jpylyzer libltdl-dev libopenjp2-7-dev libtiff-tools exiftool git git-lfs cmake liblcms2-dev libtiff-dev libpng-dev libz-dev unzip libzstd-dev libwebp-dev build-essential g++

2.通过编译源代码安装OpenJPEG:

  • mkdir ~/install
  • cd ~/install
  • 下载源代码: wget https://github.com/uclouvain/openjpeg/archive/master.zip

按照OpenJPEG安装的安装说明进行操作。

  • unzip master.zip
  • cd openjpeg-master/
  • mkdir build
  • cd build
  • cmake .. -DCMAKE_BUILD_TYPE=Release
  • make
  • sudo make install
  • sudo make clean

3.从源代码安装imagemagick:

请遵循ImageMagick的安装说明

  • cd ~/install
  • rm master.zip
  • wget https://github.com/ImageMagick/ImageMagick/archive/master.zip
  • unzip master.zip
  • cd ImageMagick-master

确保系统看到由刚创建的libopenjp2.pc文件config。要查找libopenjp2.pc文件:find ~ -type f | grep libopenjp2.pc

  • sudo pkg-config PKG_CONFIG_PATH=~/install/openjpeg-master/build
  • ./configure --enable-shared
  • sudo make
  • sudo make install
  • sudo make clean

4.安装GrokImageCompression

遵循GrokImageCompression安装说明

  • cd ~/install
  • rm master.zip
  • wget https://github.com/GrokImageCompression/grok/archive/master.zip
  • unzip master.zip
  • cd grok-master
  • mkdir build
  • cd build
  • cmake -DCMAKE_BUILD_TYPE=Release ..
  • make
  • sudo make install
  • sudo make clean

5.测试您的安装

  • mkdir ~/images
  • cd ~/images
  • wget https://github.com/harvard-library-imaging-services/images/raw/master/in.tif

运行以下命令:

测试ImageMagick安装

  • convert in.tif out_via_imagemagick.jp2 | exiftool out_via_imagemagick.jp2 | less

测试OpenJPEG安装(有损压缩示例)

  • opj_compress -i in.tif -o out_lossy_42db.jp2 -p RLCP -t 1024,1024 -EPH -SOP -OutFor jp2 -I -q 42

测试GrokImageCompression安装(有损压缩示例)

  • grk_compress -i in.tif -o grk_out_lossy_42db.jp2 -p RLCP -t 1024,1024 -EPH -SOP -OutFor jp2 -I -q 42

您创建的JP2文件是否符合标准?

  • jpylyzer *.jp2 | grep \'True\'

编码JP2文件

  • 命令:opj_compressgrk_compress
  • 开关:
    • -i
    • -p RLCP (进度顺序)
    • -t 1024,1024 (大小)
    • -EPH (数据包标题标记的结尾)
    • -SOP (数据包开始)
    • -ImgDir (不能与-i开关一起使用)
    • -OutFor  (输出文件的扩展名)
    • -o
    • -I (指定有损编码)
    • -q ,,...
    • -r ,,...

无损示例

opj_compress -i in.tif -o out_lossless.jp2 -p RLCP -t 1024,1024 -EPH -SOP -OutFor jp2

grk_compress -i in.tif -o grk_out_lossless.jp2 -p RLCP -t 1024,1024 -EPH -SOP -OutFor jp2

有损的例子

  • opj_compress -i in.tif -o out_lossy_42db.jp2 -p RLCP -t 1024,1024 -EPH -SOP -OutFor jp2 -I -q 42
  • opj_compress -i in.tif -o out_lossy_r10.jp2 -p RLCP -t 1024,1024 -EPH -SOP -OutFor jp2 -r 10

  • grk_compress -i in.tif -o grk_out_lossy_42db.jp2 -p RLCP -t 1024,1024 -EPH -SOP -OutFor jp2 -I -q 42
  • grk_compress -i in.tif -o grk_out_lossy_r10.jp2 -p RLCP -t 1024,1024 -EPH -SOP -OutFor jp2 -r 10

解压缩:将JP2文件转换为其他格式

  • opj_decompress -i infile.j2k -o outfile.png
  • opj_decompress -ImgDir images/ -OutFor tif

  • grk_decompress -i infile.j2k -o outfile.png
  • grk_decompress -ImgDir images/ -OutFor tif

结束


Installing OpenJPEG on Windows 10

OpenJPEG is an open-source JPEG 2000 codec written in C. There is no GUI. This command-line tool is easy to run and maintain using a command-line friendly OS like Linux, so I recommend installing Linux on your Windows 10 machine, taking advantage of W10\’s Windows Subsystem for Linux feature.

Below are instructions for compiling OpenJPEGImageMagick, and GrokImageCompression from source code.

While it is easier to install OpenJPEG and ImageMagick via pre-compiled versions using apt, I\’ve had issues with prior installations that I resolved by compiling the source code, so that is what I recommend. Note that you do not need to install ImageMagick at all, but it is a very useful utility.

If you\’d like to try installing OpenJPEG via the precompiled version first, the following command should do the trick:

sudo apt install libopenjp2-7 libopenjp2-tools

Why install GrokImageCompression?

The original JPEG 2000 standard only accommodated three color encoding declarations: sGray, sYCC, and sRGB. As color management gained popularity, and a wider variety of color encoding display profiles were being embedded in images, the standard was amended (15444-1annexi.pdf) so accommodate the use of restricted ICC profiles .

As of the openjp2 library v2.3.1., OpenJPEG does not carry over the display profiles embedded within the source image, but instead converts the image colorspace to sRGB on output.

GrokImageCompression is an open-source JP2 encoder based on the OpenJPEG code that successfully generates JP2 images encoded with the same colorspace (and ICC display profile) found in the source image.

1. Install Ubuntu 20.04 LTS

From the Windows App Store, download Ubuntu.

Follow Microsoft\’s installation instructions.

  • Update the installation by running the following command: sudo apt-get update ; sudo apt-get upgrade -y
  • Install some additional software modules: sudo apt-get install pkg-config emacs-nox python3-jpylyzer libltdl-dev libopenjp2-7-dev libtiff-tools exiftool git git-lfs cmake liblcms2-dev libtiff-dev libpng-dev libz-dev unzip libzstd-dev libwebp-dev build-essential g++.

2. Install OpenJPEG by compiling the source code:

  • mkdir ~/install
  • cd ~/install
  • Download the source code: wget https://github.com/uclouvain/openjpeg/archive/master.zip

Follow the installation instructions, per OpenJPEG installation.

  • unzip master.zip
  • cd openjpeg-master/
  • mkdir build
  • cd build
  • cmake .. -DCMAKE_BUILD_TYPE=Release
  • make
  • sudo make install
  • sudo make clean

3. Install imagemagick from source code:

Follow the ImageMagick installation instructions

  • cd ~/install
  • rm master.zip
  • wget https://github.com/ImageMagick/ImageMagick/archive/master.zip
  • unzip master.zip
  • cd ImageMagick-master

Make sure system sees the libopenjp2.pc file just created by config. To look for the libopenjp2.pc files: find ~ -type f | grep libopenjp2.pc

  • sudo pkg-config PKG_CONFIG_PATH=~/install/openjpeg-master/build
  • ./configure --enable-shared
  • sudo make
  • sudo make install
  • sudo make clean

4. Install GrokImageCompression

Follow the GrokImageCompression installation instructions

  • cd ~/install
  • rm master.zip
  • wget https://github.com/GrokImageCompression/grok/archive/master.zip
  • unzip master.zip
  • cd grok-master
  • mkdir build
  • cd build
  • cmake -DCMAKE_BUILD_TYPE=Release ..
  • make
  • sudo make install
  • sudo make clean

5. Test your installation

  • mkdir ~/images
  • cd ~/images
  • wget https://github.com/harvard-library-imaging-services/images/raw/master/in.tif

Run the following commands:

Testing ImageMagick installation

  • convert in.tif out_via_imagemagick.jp2 | exiftool out_via_imagemagick.jp2 | less

Testing OpenJPEG installation (lossy compression example)

  • opj_compress -i in.tif -o out_lossy_42db.jp2 -p RLCP -t 1024,1024 -EPH -SOP -OutFor jp2 -I -q 42

Testing GrokImageCompression installation (lossy compression example)

  • grk_compress -i in.tif -o grk_out_lossy_42db.jp2 -p RLCP -t 1024,1024 -EPH -SOP -OutFor jp2 -I -q 42

Are the JP2 files you created standard-compliant?

  • jpylyzer *.jp2 | grep \'True\'

Encoding JP2 files

  • Command: opj_compress and grk_compress
  • Switches:
    • -i
    • -p RLCP (progression order)
    • -t 1024,1024 (tile size)
    • -EPH (End of Packet Header marker)
    • -SOP (Start of Packet)
    • -ImgDir  (cannot be used with -i switch)
    • -OutFor  (extension for output files)
    • -o
    • -I (specifies lossy encoding)
    • -q ,,...
    • -r ,,...

Lossless example

opj_compress -i in.tif -o out_lossless.jp2 -p RLCP -t 1024,1024 -EPH -SOP -OutFor jp2

grk_compress -i in.tif -o grk_out_lossless.jp2 -p RLCP -t 1024,1024 -EPH -SOP -OutFor jp2

Lossy example

  • opj_compress -i in.tif -o out_lossy_42db.jp2 -p RLCP -t 1024,1024 -EPH -SOP -OutFor jp2 -I -q 42
  • opj_compress -i in.tif -o out_lossy_r10.jp2 -p RLCP -t 1024,1024 -EPH -SOP -OutFor jp2 -r 10

  • grk_compress -i in.tif -o grk_out_lossy_42db.jp2 -p RLCP -t 1024,1024 -EPH -SOP -OutFor jp2 -I -q 42
  • grk_compress -i in.tif -o grk_out_lossy_r10.jp2 -p RLCP -t 1024,1024 -EPH -SOP -OutFor jp2 -r 10

Decompress: converting JP2 files to other formats

  • opj_decompress -i infile.j2k -o outfile.png
  • opj_decompress -ImgDir images/ -OutFor tif

  • grk_decompress -i infile.j2k -o outfile.png
  • grk_decompress -ImgDir images/ -OutFor tif

end

下载最新版Windows 11 Pro ISO文件:点击进入   持续更新原装纯净版Win11 

相关内容

热门资讯

Windows 11 和 10... Windows 11/10 文件夹属性中缺少共享选项卡 – 已修复 1.检查共享选项卡是否可用 右键...
事件 ID 7034:如何通过... 点击进入:ChatGPT工具插件导航大全 服务控制管理器 (SCM) 负责管理系统上运行的服务的活动...
Radmin VPN Wind... Radmin VPN 是一款免费且用户友好的软件,旨在牢固地连接计算机以创建一个有凝聚力的虚拟专用网...
Hive OS LOLMine... 目前不清退的交易所推荐: 1、全球第二大交易所OKX欧意 国区邀请链接: https://www.m...
如何修复 Steam 内容文件... Steam 内容文件锁定是当您的 Steam 文件无法自行更新时出现的错误。解决此问题的最有效方法之...
Hive OS 部署 PXE ... 目前不清退的交易所推荐: 1、全球第二大交易所OKX欧意 国区邀请链接: https://www.m...
如何在电报Telegram中隐... 点击进入:ChatGPT工具插件导航大全 在Android上的电报中隐藏您的电话号码 您可以通过切换...
farols1.1.501.0... faro ls 1.1.501.0(64bit)可以卸载,是一款无需连接外部PC机或笔记本计算机即可...
在 iCloud 上关闭“查找... 如果您是 Apple 的长期用户,您肯定会遇到过 Find My 应用程序,它本机安装在 iPhon...
在 Windows 11 中打... 什么是链路状态电源管理? 您可以在系统控制面板的电源选项中看到链接状态电源管理。它是 PCI Exp...