Skip to content
Java Image I/O reader and writer for the Google WebP image format without system native libs
Java
Branch: master
Clone or download
Pull request Compare This branch is 2 commits behind qwong:master.
Latest commit 734ae83 Oct 29, 2019

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/main del: remove x32 support Oct 29, 2019
test_pic update: how to compile native library and new win dll Sep 6, 2019
.gitignore init Mar 2, 2017
LICENSE Add Sep 12, 2019
README.md del: remove x32 support Oct 29, 2019
pom.xml update: version to 0.1.3 Oct 29, 2019

README.md

webp-imageio-core

forked from qwong/j-webp Java Image I/O reader and writer for the Google WebP image format without system lib file.

In source program, coders need to put native lib files like .so/.dll/.dylib into the folder of java.library.path.

For easier to use, qwong/j-webp (bases on webp project of Luciad 0.4.2) import 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)

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).

Update 20181119: sync from webp project of Luciad 1.0.0

Update 20190912: update win64 dll to libwebp-1.0.3

Update 20191029:

  • prankstrisse provides osx64 dylib file
  • remove x32 .so/.dll/.dylib file

Usage

Because it is not in maven repo, so you have to put the jar file webp-imageio-core-{version}.jar into libs folder of your project manually.

Download jar

if you use gradle, you can put it into src/main/resource/libs, and edit config filebuild.gradle to add local dependencies

dependencies {
    compile fileTree(dir:'src/main/resources/libs',include:['*.jar'])
}

if you use maven, you can put it ${project.basedir}/libs, and edit config file pom.xml to add local dependencies

<dependency>  
    <groupId>com.github.nintha</groupId>  
    <artifactId>webp-imageio-core</artifactId>  
    <version>{versoin}</version>  
    <scope>system</scope>  
    <systemPath>${project.basedir}/libs/webp-imageio-core-{version}.jar</systemPath>  
</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 , and unzip it.

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

git clone https://chromium.googlesource.com/webm/libwebp

or use the mirror repo

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 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

// cmake ..
cmake .. -G "Visual Studio 16 2019"

Compiling the Java library

  • Run mvn install in the root of the project
  • The compiled Java library can be found under the targetdirectory
You can’t perform that action at this time.