diff --git a/README.md b/README.md index b4cf290..dbd44a6 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,35 @@ # webp-imageio-core forked from qwong/j-webp -Java Image I/O reader and writer for the Google WebP image format. +Java Image I/O reader and writer for the Google WebP image format without system lib file. -基于[webp project of Luciad](https://bitbucket.org/luciad/webp-imageio) 0.4.2版本修改. +In source program, coders need to put native lib files like .so/.dll/.dylib into the folder of `java.library.path`. -实际上只修改了`com.luciad.imageio.webp.WebP.loadNativeLibrary`这一个方法. -因为按他默认的加载方式, 需要把native的so/dll/dylib等文件放到OS对应的`java.library.path`对应的目录才能加载到, 这会给部署带来一些不便. +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`) -所以我们这里换成了[native-lib-loader](https://github.com/scijava/native-lib-loader)自动加载, 编译构建好的包里已经包含了各种OS上的native文件, 使用时会自动加载. +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). -具体使用方法可参看`src/main/java/example`下的源码. +## 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. + +if you use gradle, you can put it into `src/main/resource/libs`, and edit config file`build.gradle` to add local dependencies + +```groovy +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 + +```xml + + com.github.nintha + webp-imageio-core + {versoin} + system + ${project.basedir}/libs/webp-imageio-core-{version}.jar + +``` + +The usage of api, you can see example cases in `src/main/java/example`. \ No newline at end of file diff --git a/pom.xml b/pom.xml index dcbafff..f9aa8ab 100644 --- a/pom.xml +++ b/pom.xml @@ -4,9 +4,9 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - net.wangq - webp - 1.0-SNAPSHOT + com.github.nintha + webp-imageio-core + 0.1.0 UTF-8 @@ -22,4 +22,33 @@ + + + + org.apache.maven.plugins + maven-shade-plugin + 2.3 + + false + + + + package + + shade + + + + + util.Microseer + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/example/DecodingTest.java b/src/main/java/example/DecodeTest.java similarity index 97% rename from src/main/java/example/DecodingTest.java rename to src/main/java/example/DecodeTest.java index 82b2466..54050a2 100644 --- a/src/main/java/example/DecodingTest.java +++ b/src/main/java/example/DecodeTest.java @@ -9,8 +9,7 @@ import java.io.File; import java.io.IOException; -public class DecodingTest { - +public class DecodeTest { public static void main(String args[]) throws IOException { String inputWebpPath = "test_pic/test.webp"; String outputJpgPath = "test_pic/test_.jpg"; diff --git a/src/main/java/example/EncodingTest.java b/src/main/java/example/EncodeTest.java similarity index 97% rename from src/main/java/example/EncodingTest.java rename to src/main/java/example/EncodeTest.java index facad6d..699bf19 100644 --- a/src/main/java/example/EncodingTest.java +++ b/src/main/java/example/EncodeTest.java @@ -10,8 +10,7 @@ import java.io.File; import java.io.IOException; -public class EncodingTest { - +public class EncodeTest { public static void main(String args[]) throws IOException { String inputPngPath = "test_pic/test.png"; String inputJpgPath = "test_pic/test.jpg";