Skip to content

Commit

Permalink
Merge pull request #11 from umjammer/1.0.10
Browse files Browse the repository at this point in the history
1.0.10
  • Loading branch information
umjammer authored Nov 4, 2022
2 parents 0153c44 + 72a38e1 commit b8e22e2
Show file tree
Hide file tree
Showing 100 changed files with 3,626 additions and 2,012 deletions.
17 changes: 4 additions & 13 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -53,10 +44,10 @@ jobs:

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
- name: build
run: |
brew install ffmpeg
mvn -B install --file pom.xml
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
8 changes: 5 additions & 3 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ jobs:
runs-on: macos-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Set up JDK 1.8
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
java-version: 1.8
java-version: '8'
distribution: 'temurin'
cache: maven
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Java CI

on: [push]

jobs:
build:

runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK 1.8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: |
brew install ffmpeg
mvn -B package --file pom.xml
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/tmp/
/etc/
/lib/
local.properties
87 changes: 29 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
[![Release](https://jitpack.io/v/umjammer/vavi-image.svg)](https://jitpack.io/#umjammer/vavi-image)
[![Java CI](https://github.com/umjammer/vavi-image/actions/workflows/maven.yml/badge.svg)](https://github.com/umjammer/vavi-image/actions/workflows/maven.yml)
[![CodeQL](https://github.com/umjammer/vavi-image/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/umjammer/vavi-image/actions/workflows/codeql-analysis.yml)
[![GitHub Packages (only ffmpeg)](https://github.com/umjammer/vavi-image/actions/workflows/maven-publish.yml/badge.svg)](https://github.com/umjammer/vavi-image/actions/workflows/maven-publish.yml)
![Java](https://img.shields.io/badge/Java-8-b07219)

# vavi-image

Imaging goodies.
🎨 Imaging the world!

## Formats
* artmaster 88 (old japanese pc pc-88,98 image format)
* windows bitmap
* gif (non lzw)

* [artmaster 88](http://fileformats.archiveteam.org/wiki/ArtMaster88) (old school japanese pc-8801,9801 image format)
* [mag](https://ja.wikipedia.org/wiki/MAG%E3%83%95%E3%82%A9%E3%83%BC%E3%83%9E%E3%83%83%E3%83%88) (maki-chan graphic loader: old school japanese pc-8801,9801 image format)
* [zim](https://ja.wikipedia.org/wiki/%E3%83%84%E3%82%A1%E3%82%A4%E3%83%88#Z's_STAFF) (z's staff kid: old school japanese 9801 image format)
* [windows bitmap](https://www.google.co.jp/books/edition/Windows3_1%E3%82%B0%E3%83%A9%E3%83%95%E3%82%A3%E3%83%83%E3%82%AF%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9/YEYsAgAACAAJ?hl=ja)
* gif ([non lzw](https://web.archive.org/web/20161106215528/http://homepage1.nifty.com/uchi/software.htm))
* windows icon
* ppm

## Resizing Evaluation
## Resizing

|type|quality|speed|comment|
|---|---|---|---|
Expand All @@ -23,73 +28,39 @@ Imaging goodies.
|`G2dResample`|2||`Graphics2d#drawImage` with rendering hints (`VALUE_INTERPOLATION_NEAREST_NEIGHBOR`)|
|`AffineTransformOp`|2| |`TYPE_NEAREST_NEIGHBOR`|

## Quantizing Evaluation
## Quantization

|type|quality|comment|
|---|---|---|
|`ImageMagick`|||
|`NeuralNet`|👑|https://github.com/umjammer/vavi-image-sandbox/wiki/OctTree_vs_NeuralNet|
|`OctTree`|||
| type |quality|comment|
|----------------------------------------------------------------------------------|---|---|
| [`ImageMagick`](src/main/java/vavi/awt/image/quantization/ImageMagikQuantizeOp.java) |||
| `NeuralNet` |👑|https://github.com/umjammer/vavi-image-sandbox/wiki/OctTree_vs_NeuralNet|
| `OctTree` |||

## Installation

* maven repo.
```xml
<repository>
<id>github</id>
<name>GitHub umjammer Apache Maven Packages</name>
<url>https://maven.pkg.github.com/umjammer/*</url>
</repository>

<dependency>
<groupId>vavi</groupId>
<artifactId>vavi-image</artifactId>
<version>1.0.9</version>
</dependency>
```
* if you want to use ffmpeg resizing, add below into your `pom.xml`
* exec jvm w/ `-Djava.library.path=/target/test-classes`
```xml
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy</id>
<phase>generate-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>vavi</groupId>
<artifactId>vavi-image-ffmpeg</artifactId>
<version>1.0.9-SNAPSHOT</version>
<type>dylib</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.testOutputDirectory}</outputDirectory>
<destFileName>libFfmpegResampleOpWrapper.dylib</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
```
* maven: https://jitpack.io/#umjammer/vavi-image
* if you want to use ffmpeg resizing
* [pom.xml](https://github.com/umjammer/vavi-image/wiki/Install-ffmpeg-native-library)
* exec jvm w/ `java.library.path` system property e.g `-Djava.library.path=/target/test-classes`

## TODO

* test `OctTreeQuantizer` (only 256 colors?)
* complete `ImageMagikQuantizer`
* Lanczos3 filter using AWT API
* `BufferedImageOp` ???
* https://github.com/iariro/N88BasicImage
* ffmpeg resize 4byte 32bit operation is wrong

## Tech Know

* Mac Open JDK's JNI library extension is `.dylib`
* `libsescale` has MMX bug, this causes segmentation fault when resizing image.

## References

* https://sourceforge.net/projects/recoil/

## License

### Image I/O PPM Reader
Expand Down Expand Up @@ -127,9 +98,9 @@ Public Domain

### Java Image Editor

The downloadable source code on this page is released under the Apache License. Basically, this means that you are free to do whatever you like with this code, but it's not my fault if your satellite/nuclear power station/missile system fails as a result. Have fun!

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this code except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
| The downloadable source code on this page is released under the Apache License. Basically, this means that you are free to do whatever you like with this code, but it's not my fault if your satellite/nuclear power station/missile system fails as a result. Have fun!
|
| Licensed under the Apache License, Version 2.0 (the "License"); you may not use this code except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

### SkyView

Expand Down
3 changes: 0 additions & 3 deletions local.properties.sample

This file was deleted.

30 changes: 15 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

<groupId>vavi</groupId>
<artifactId>vavi-image</artifactId>
<version>1.0.9</version>
<version>1.0.10-SNAPSHOT</version>

<name>Vavi Imaging API</name>
<organization>
<name></name>
<name>vavi</name>
</organization>
<url>https://github.com/umjammer/vavi-image</url>
<description></description>
<description>Vavi Imaging API</description>
<scm>
<url>https://github.com/umjammer/vavi-image</url>
</scm>
Expand All @@ -24,7 +24,6 @@
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub umjammer Apache Maven Packages</name>
<url>https://maven.pkg.github.com/umjammer/vavi-image</url>
</repository>
</distributionManagement>
Expand All @@ -47,6 +46,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>1.0-alpha-11</version>
<extensions>true</extensions>
<configuration>
<javahClassNames>
Expand Down Expand Up @@ -79,7 +79,7 @@
<linkerStartOption>-dynamiclib -arch x86_64 -v
-L/usr/local/lib -lobjc -lavformat -lavcodec -lswscale -lavutil</linkerStartOption>
</linkerStartOptions>
<linkerFinalName></linkerFinalName>
<linkerFinalName/>
</configuration>
<executions>
<execution>
Expand Down Expand Up @@ -115,7 +115,9 @@


<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
<executions>
<execution>
<id>install-library</id>
Expand All @@ -135,7 +137,9 @@
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M2</version>
<configuration>
<skip>true</skip>
</configuration>
Expand Down Expand Up @@ -179,7 +183,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<version>3.0.0-M7</version>
<configuration>
<forkMode>once</forkMode>
<argLine>
Expand All @@ -196,7 +200,9 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>8</source>
<target>8</target>
Expand All @@ -218,7 +224,7 @@
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.8.1</version>
<version>5.9.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -229,7 +235,7 @@
<dependency>
<groupId>com.github.umjammer</groupId>
<artifactId>vavi-commons</artifactId>
<version>1.1.6</version>
<version>1.1.8</version>
</dependency>
<dependency>
<groupId>com.github.umjammer</groupId>
Expand All @@ -240,7 +246,7 @@
<dependency>
<groupId>com.github.umjammer</groupId>
<artifactId>vavi-awt</artifactId>
<version>1.0.5</version>
<version>1.0.6</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -249,12 +255,6 @@
<version>2.1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/vavi/awt/image/AbstractBufferedImageOp.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public abstract class AbstractBufferedImageOp implements BufferedImageOp, Clonea
/**
* @return same size as src
*/
@Override
public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel dstCM) {
if (dstCM == null) {
dstCM = src.getColorModel();
Expand All @@ -44,11 +45,13 @@ public BufferedImage createCompatibleDestImage(BufferedImage src, ColorModel dst
}

/** @return just src bounds */
@Override
public Rectangle2D getBounds2D(BufferedImage src) {
return new Rectangle(0, 0, src.getWidth(), src.getHeight());
}

/** @return no conversion */
@Override
public Point2D getPoint2D(Point2D srcPt, Point2D dstPt) {
if (dstPt == null) {
dstPt = new Point2D.Double();
Expand All @@ -58,6 +61,7 @@ public Point2D getPoint2D(Point2D srcPt, Point2D dstPt) {
}

/** @return null */
@Override
public RenderingHints getRenderingHints() {
return null;
}
Expand Down Expand Up @@ -91,6 +95,7 @@ protected void setRGB(BufferedImage image, int x, int y, int width, int height,
}

/* TODO hide CloneNotSupportedException */
@Override
public Object clone() {
try {
return super.clone();
Expand Down
Loading

0 comments on commit b8e22e2

Please sign in to comment.