Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A lightweight image converter which supports PNG, PNM, BMP, QOI, JPEG-LS, and H.265 intra-frame.

License

NotificationsYou must be signed in to change notification settings

WangXuan95/ImCvt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

languagebuildbuild

ImCvt

ImCvt is aimage format converter which supports several image formats.ImCvt is written in C (C99), contains the simplest, standalone implementation of the encoders/decoders of some image formats, the purpose is to help one understand these image compression formats and algorithms swiftly.

ImCvt supports:

formatsuffixsupported colorconvert from (decode)convert to (encode)source code
PNM.pnmgray8rgb24✅ fully support✅ fully support150 lines of C
PNG.pnggray8rgb24❎ unsupported☑️ partially support240 lines of C
BMP.bmpgray8rgb24☑️ partially support☑️ partially support180 lines of C
QOI.qoirgb24✅ fully support✅ fully support240 lines of C
JPEG-LS.jlsgray8rgb24❎ unsupported☑️ partially support480 lines of C
JPEG-LS ext.jlsxgray8☑️ support☑️ support760 lines of C
H.265.h265gray8❎ unsupported☑️ partially support1730 lines of C

Illustration of these image formats:

formatIllustration
PNMPNM (Portable Any Map),PGM (Portable Gray Map), andPPM (Portable Pix Map) are simple uncompressed image formats which store raw pixels.
PNGPNG (Portable Network Graph) is the most popular lossless image compression format.
BMPBMP (Bitmap Image File) is a popular uncompressed image formats which store raw pixels.
QOIQOI (Quite OK Image) is a simple, fast lossless RGB image compression format. This project implements a simple QOI encoder/decoder in only 240 lines of C.
JPEG-LSJPEG-LS is a lossless/lossy image compression standard which can get better grayscale compression ratio compared to PNG and Lossless-WEBP. JPEG-LS uses the maximum difference between the pixels before and after compression (NEAR value) to control distortion,NEAR=0 is the lossless mode;NEAR>0 is the lossy mode. The specification of JPEG-LS isITU-T T.87 .ImCvt implements a simple JPEG-LS encoder in only 480 lines of C. However,ImCvt do not support JPEG-LS decoder yet. Here are two ways to decompress a .jls file: (1) Usethis website to view .jls image online (but the website may not work sometimes). (2) UseUBC's JPEG-LS encoder/decoder .
JPEG-LS extensionThis code is my implementation ofJPEG-LS extension according toITU-T T.870 specification for educational purpose. Note that the file header does NOT follow the specification!
H.265H.265/HEVC is a video coding standard. This project implements a lightweight grayscale 8-bit H.265/HEVC intra-frame image compressor in only 1730 lines of C for educational purpose. Note that this code only offers H.265/HEVC compressor instead of decompressor. To decompress and view the compressed .h265 image file, you can useFile Viewer Plus orElecard HEVC Analyzer . For more knowledge about H.265, seeH.265/HEVC 帧内编码详解:CU层次结构、预测、变换、量化、编码 .

More illustration about thisH.265 image encoder:

  • Quality parameter can be 0~4, corresponds to Quantize Parameter (QP) = 4, 10, 16, 22, 28.
  • CTU : 32x32
  • CU : 32x32, 16x16, 8x8
  • TU : 32x32, 16x16, 8x8, 4x4
  • The maximum depth of CU splitting into TUs is 1 (each CU is treated as a TU, or divided into 4 small TUs, while the small TUs are not divided into smaller TUs).
  • part_mode: The 8x8 CU is treated as a PU (PART_2Nx2N), or divided into 4 PUs (PART_NxN)
  • Supports all 35 prediction modes
  • Simplified RDOQ (Rate Distortion Optimized Quantize)

 

 

Compile

compile in Windows (MinGW)

If you installed MinGW, run following compiling command in CMD:

gcc src\*.c-O3-oImCvt.exe

which will get executable fileImCvt.exe

compile in Windows (MSVC)

Also, you can use MSVC to compile. If you added MSVC (cl.exe) to your environment, run following compiling command in CMD:

cl src\*.c/Ox/FeImCvt.exe

which will get executable fileImCvt.exe

compile in Linux (gcc)

gcc src/*.c -O3 -o ImCvt

which will get Linux binary fileImCvt

 

 

Usage

Run the program without any parameters to display usage:

> .\ImCvt.exe|-----------------------------------------------------------------------|| ImageConverter (v0.6)  by https://github.com/WangXuan95/              ||-----------------------------------------------------------------------|| Usage:                                                                ||   ImCvt [-switches]  <in1> -o <out1>  [<in2> -o <out2>]  ...          ||                                                                       ||-----------------------------------------------------------------------|| Where <in> and <out> can be:                                          ||--------|---------------------------------|-------|--------|-----|-----||        |                                 | gray  | RGB    |     |     || suffix |          format name            | 8-bit | 24-bit | in  | out ||--------|---------------------------------|-------|--------|-----|-----|| .bmp   | Bitmap Image File (BMP)         | yes   | yes    | yes | yes || .pnm   | Portable Any Map (PNM)          | yes   | yes    | yes | yes || .pgm   | Portable Gray Map (PGM)         | yes   | no     | yes | yes || .ppm   | Portable Pix Map (PPM)          | no    | yes    | yes | yes || .qoi   | Quite OK Image (QOI)            | no    | yes    | yes | yes || .png   | Portable Network Graphics (PNG) | yes   | yes    | no  | yes || .jls   | JPEG-LS Image (JLS)             | yes   | yes    | no  | yes || .jlsx  | JPEG-LS extension (ITU-T T.870) | yes   | no     | yes | yes || .h265  | H.265/HEVC Image                | yes   | no     | no  | yes ||--------|---------------------------------|-------|--------|-----|-----||                                                                       || switches:    -f         : force overwrite of output file              ||              -<number>  : 1. PNG RGB palette quantize color count     ||                           2. JPEG-LS near value                       ||                           3. H.265 (qp-4)/6 value                     ||-----------------------------------------------------------------------|

Example Usage

convert a PNM to a QOI:

ImCvt.exe image\P6.pnm-o image\P6.qoi

convert a QOI to a BMP:

ImCvt.exe image\P6.qoi-o image\P6.bmp

convert a BMP to a JPEG-LS, with near=1 (lossy):

ImCvt.exe image\P6.bmp-o image\P6.jls-1

convert a BMP to a H.265 image file, with (qp-4)/6=2 (lossy):

ImCvt.exe image\P6.bmp-o image\P6.h265

convert a BMP to a PNG:

ImCvt.exe image\P6.bmp-o image\P6.png

convert a BMP to a PNG by quantize to 16-color palette:

ImCvt.exe image\P6.bmp-o image\P6_16.png-16

convert a grayscale PNM to JPEG-LS extension with near=1 (lossy), and then convert it back to BMP:

ImCvt.exe image\P5.pnm  -o image\P5.jlsx -1ImCvt.exe image\P5.jlsx -o image\P5.bmp

 

 

Related links

[1] Official website of QOI :https://qoiformat.org/

[2] ITU-T T.87 : JPEG-LS baseline specification :https://www.itu.int/rec/T-REC-T.87/en

[3] UBC's JPEG-LS baseline Public Domain Code :http://www.stat.columbia.edu/~jakulin/jpeg-ls/mirror.htm

[4] pillow-jpls library for Python :https://pypi.org/project/pillow-jpls

[5] PNM Image File Specification :https://netpbm.sourceforge.net/doc/pnm.html

[6] uPNG: a simple PNG decoder:https://github.com/elanthis/upng

[7] FPGA-based Verilog QOI compressor/decompressor:https://github.com/WangXuan95/FPGA-QOI

[8] FPGA-based Verilog JPEG-LS encoder (basic version which support 8-bit gray lossless and lossy compression) :https://github.com/WangXuan95/FPGA-JPEG-LS-encoder

[9] FPGA-based Verilog JPEG-LS encoder (ultra high performance version which support 8-bit gray lossless compression) :https://github.com/WangXuan95/UH-JLS

[10] H.265/HEVC 帧内编码详解:CU层次结构、预测、变换、量化、编码:https://zhuanlan.zhihu.com/p/607679114

[11] The H.265/HEVC reference software HM:https://github.com/listenlink/HM

[12] NBLI: a fast, better lossless image format:https://github.com/WangXuan95/NBLI

[13] ITU-T T.870 : JPEG-LS extention specification :https://www.itu.int/rec/T-REC-T.870/en

[14] A comparison of many lossless image compression formats:https://github.com/WangXuan95/Image-Compression-Benchmark

About

A lightweight image converter which supports PNG, PNM, BMP, QOI, JPEG-LS, and H.265 intra-frame.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp