webp-imageio-core/README.md

100 lines
3.1 KiB
Markdown
Raw Permalink Normal View History

2018-09-08 17:41:46 +02:00
# webp-imageio-core
Java Image I/O reader and writer for the Google WebP image format without system lib file.
2017-03-02 06:03:37 +01:00
In source program, coders need to put native lib files like .so/.dll/.dylib into the folder of `java.library.path`.
2017-03-02 06:03:37 +01:00
For easier to use, qwong/j-webp (bases on [webp project of Luciad](https://bitbucket.org/luciad/webp-imageio) 0.4.2) import [native-lib-loader](https://github.com/scijava/native-lib-loader) to load native lib files from project resource folder, instead of `java.library.path`. (more details to see `com.luciad.imageio.webp.WebP.loadNativeLibrary`)
2017-03-02 06:03:37 +01:00
However, coders pefer using jar package instead of source java code in personal project. So I fork and edit qwong/j-webp to privide a usable jar. It is a fat jar includes dependencies and native lib file (includes windows/linux/mac both 32&64bit).
2017-03-02 06:03:37 +01:00
Update 20181119: sync from [webp project of Luciad](https://bitbucket.org/luciad/webp-imageio) 1.0.0
2019-10-29 09:11:20 +01:00
Update 20190912: update win64 dll to libwebp-1.0.3
2019-10-29 14:10:24 +01:00
Update 20191029:
- [prankstrisse](https://github.com/prankstrisse) provides osx64 dylib file
- remove `x32` .so/.dll/.dylib file
2019-10-29 09:07:34 +01:00
## Usage
```xml
2021-01-21 11:39:41 +01:00
<repositories>
<repository>
<id>mchv-release</id>
<name>MCHV Release Apache Maven Packages</name>
<url>https://mvn.mchv.eu/repository/mchv</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.nintha</groupId>
<artifactId>webp-imageio-core</artifactId>
2020-02-28 13:42:44 +01:00
<version>{version}</version>
</dependency>
```
The usage of api, you can see example cases in `src/main/java/example`.
## Compiling the native library
download source code of [webp project of Luciad](https://bitbucket.org/luciad/webp-imageio) , and unzip it.
```shell
wget https://bitbucket.org/luciad/webp-imageio/get/873c5677244b.zip -O luciad-webp-imageio-873c5677244b.zip
unzip luciad-webp-imageio-873c5677244b.zip
```
download source code of [google webp project](https://chromium.googlesource.com/webm/libwebp)
```shell
git clone https://chromium.googlesource.com/webm/libwebp
```
or use the [mirror repo](https://github.com/webmproject/libwebp)
copy folder libwebp into folder luciad-webp-imageio-873c5677244b, and create a directory called `build` in the folder luciad-webp-imageio-873c5677244b
folder tree like this:
```
luciad-webp-imageio-873c5677244b/
|_ build/ <-- just created
|_ gradle/
|_ src/
|_ libwebp/ <-- copy from project libwebp
|_ .hgignore
|....
|.... (other files)
```
Install CMake 2.8 or newer. CMake can be downloaded from [www.cmake.org](http://www.cmake.org/) or installed using your systems package manager. if you use Win10 and VS 2019, it need CMake 3.14 or newer.
Open a terminal and navigate to the newly created 'build' directory.
```
cd ./build
cmake ..
cmake --build .
```
The compiled library can be found under the directory `build/src/main/c`
if you need specific the generator-name, please add `-G <generator-name>` parameter for cmake, like this
```shell
// cmake ..
cmake .. -G "Visual Studio 16 2019"
```
## Compiling the Java library
2019-09-06 17:56:28 +02:00
- Run `mvn install` in the root of the project
- The compiled Java library can be found under the `target`directory