Skip to content

Commit

Permalink
Merge pull request #1 from idrsolutions/develop
Browse files Browse the repository at this point in the history
JDEL-519 #comment move JDeli ImageIO plugin to github
  • Loading branch information
Amy1612 authored Jul 21, 2021
2 parents bd865e1 + 36833dc commit 0579c12
Show file tree
Hide file tree
Showing 32 changed files with 1,733 additions and 7 deletions.
11 changes: 6 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/
/*.iml
/.idea/
/target/
/nbactions*.xml
/dependency-reduced-pom.xml
/nbproject/

# Package Files #
*.jar
Expand Down
35 changes: 33 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,33 @@
# JDeli_ImageIO_Plugin
A plugin to replace ImageIO with JDeli.
# JDeli ImageIO Plugin

---

This is a plugin to extend ImageIO with JDeli. You will require JDeli to use this plugin, if you don't already have JDeli, you can download the trial [here](https://www.idrsolutions.com/jdeli/).


#Installation

---

This can be done by copying the repository, or the build jar to your class path.


#Who do I talk to?

---

Found a bug, or have a suggestion / improvement? Let us know through the Issues page.

Got questions? You can contact us [here](https://idrsolutions.atlassian.net/servicedesk/customer/portal/8).

---


Copyright 2021 IDRsolutions

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file 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.
62 changes: 62 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>groupId</groupId>
<artifactId>JDeli_ImageIO_Plugin</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>com.idrsolutions</groupId>
<artifactId>jdeli</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>


<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>


</project>
45 changes: 45 additions & 0 deletions src/main/java/com/idrsolutions/BMPImageReaderSpi.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 1997-2021 IDRsolutions (https://www.idrsolutions.com)
*/
package com.idrsolutions;

import com.idrsolutions.image.ImageFormat;
import com.idrsolutions.image.utility.ImageTypeFinder;

import javax.imageio.ImageReader;
import javax.imageio.stream.ImageInputStream;
import java.io.IOException;
import java.util.Locale;

public class BMPImageReaderSpi extends JDeliImageReaderSpi {

private static final String[] names = {"BMP"};
private static final String[] suffixes = {"bmp"};
private static final String[] MIMETypes = {"image/bmp"};

public BMPImageReaderSpi() {

super(names, suffixes, MIMETypes);
}

@Override
public String getDescription(final Locale locale) {
return "BMP JDeli Image Reader";
}

@Override
public boolean canDecodeInput(final Object source) throws IOException {

final ImageInputStream input = (ImageInputStream) source;
final byte[] b = new byte[140];
input.read(b);

return ImageTypeFinder.getImageType(b).equals(ImageFormat.BMP_IMAGE);

}

@Override
public ImageReader createReaderInstance() throws IOException {
return createReaderInstance("bmp");
}
}
43 changes: 43 additions & 0 deletions src/main/java/com/idrsolutions/BMPImageWriterSpi.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (c) 1997-2021 IDRsolutions (https://www.idrsolutions.com)
*/
package com.idrsolutions;

import com.idrsolutions.image.encoder.OutputFormat;
import java.io.IOException;
import java.util.Locale;
import javax.imageio.ImageTypeSpecifier;
import javax.imageio.ImageWriter;

public class BMPImageWriterSpi extends JDeliImageWriterSpi {

private static final String[] names = {"Bitmap Graphics"};
private static final String[] suffixes = {"bmp"};
private static final String[] MIMETypes = {"image/bmp"};

public BMPImageWriterSpi() {
super(names, suffixes, MIMETypes);
}

@Override
public boolean canEncodeImage(final ImageTypeSpecifier imageType) {
final int bands = imageType.getNumBands();
return bands == 1 || bands == 2 || bands == 3 || bands == 4;
}

@Override
public String getDescription(final Locale locale) {
return "BMP Image Writer";
}

@Override
public String[] getFormatNames() {
return suffixes;
}

@Override
public ImageWriter createWriterInstance(final Object extension) throws IOException {
return super.createWriterInstance(OutputFormat.BMP);
}

}
42 changes: 42 additions & 0 deletions src/main/java/com/idrsolutions/DICOMImageReaderSpi.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.idrsolutions;

import com.idrsolutions.image.ImageFormat;
import com.idrsolutions.image.utility.ImageTypeFinder;

import javax.imageio.ImageReader;
import javax.imageio.stream.ImageInputStream;
import java.io.IOException;
import java.util.Locale;

public class DICOMImageReaderSpi extends JDeliImageReaderSpi {

private static final String[] names = {"DICOM"};
private static final String[] suffixes = {"dcm"};
private static final String[] MIMETypes = {"image/dicom"};

public DICOMImageReaderSpi() {

super(names, suffixes, MIMETypes);
}

@Override
public String getDescription(final Locale locale) {
return "DICOM JDeli Image Reader";
}

@Override
public boolean canDecodeInput(final Object source) throws IOException {

final ImageInputStream input = (ImageInputStream) source;
final byte[] b = new byte[140];
input.read(b);

return ImageTypeFinder.getImageType(b).equals(ImageFormat.DICOM_IMAGE);

}

@Override
public ImageReader createReaderInstance() throws IOException {
return createReaderInstance("dcm");
}
}
42 changes: 42 additions & 0 deletions src/main/java/com/idrsolutions/EMFImageReaderSpi.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.idrsolutions;

import com.idrsolutions.image.ImageFormat;
import com.idrsolutions.image.utility.ImageTypeFinder;

import javax.imageio.ImageReader;
import javax.imageio.stream.ImageInputStream;
import java.io.IOException;
import java.util.Locale;

public class EMFImageReaderSpi extends JDeliImageReaderSpi {

private static final String[] names = {"EMF"};
private static final String[] suffixes = {"emf"};
private static final String[] MIMETypes = {"image/emf"};

public EMFImageReaderSpi() {

super(names, suffixes, MIMETypes);
}

@Override
public String getDescription(final Locale locale) {
return "EMF JDeli Image Reader";
}

@Override
public boolean canDecodeInput(final Object source) throws IOException {

final ImageInputStream input = (ImageInputStream) source;
final byte[] b = new byte[140];
input.read(b);

return ImageTypeFinder.getImageType(b).equals(ImageFormat.EMF_IMAGE);

}

@Override
public ImageReader createReaderInstance() throws IOException {
return createReaderInstance("emf");
}
}
42 changes: 42 additions & 0 deletions src/main/java/com/idrsolutions/GIFImageReaderSpi.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.idrsolutions;

import com.idrsolutions.image.ImageFormat;
import com.idrsolutions.image.utility.ImageTypeFinder;

import javax.imageio.ImageReader;
import javax.imageio.stream.ImageInputStream;
import java.io.IOException;
import java.util.Locale;

public class GIFImageReaderSpi extends JDeliImageReaderSpi {

private static final String[] names = {"GIF"};
private static final String[] suffixes = {"gif"};
private static final String[] MIMETypes = {"image/gif"};

public GIFImageReaderSpi() {

super(names, suffixes, MIMETypes);
}

@Override
public String getDescription(final Locale locale) {
return "GIF JDeli Image Reader";
}

@Override
public boolean canDecodeInput(final Object source) throws IOException {

final ImageInputStream input = (ImageInputStream) source;
final byte[] b = new byte[140];
input.read(b);

return ImageTypeFinder.getImageType(b).equals(ImageFormat.GIF_IMAGE);

}

@Override
public ImageReader createReaderInstance() throws IOException {
return createReaderInstance("gif");
}
}
45 changes: 45 additions & 0 deletions src/main/java/com/idrsolutions/HEICImageReaderSpi.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright (c) 1997-2021 IDRsolutions (https://www.idrsolutions.com)
*/
package com.idrsolutions;

import com.idrsolutions.image.ImageFormat;
import com.idrsolutions.image.utility.ImageTypeFinder;

import java.io.IOException;
import java.util.Locale;
import javax.imageio.ImageReader;
import javax.imageio.stream.ImageInputStream;

public class HEICImageReaderSpi extends JDeliImageReaderSpi {

private static final String[] names = {"HEIC"};
private static final String[] suffixes = {"heic", "heif"};
private static final String[] MIMETypes = {"image/heic"};

public HEICImageReaderSpi() {

super(names, suffixes, MIMETypes);
}

@Override
public String getDescription(final Locale locale) {
return "HEIC JDeli Image Reader";
}

@Override
public boolean canDecodeInput(final Object source) throws IOException {

final ImageInputStream input = (ImageInputStream) source;
final byte[] b = new byte[140];
input.read(b);

return ImageTypeFinder.getImageType(b).equals(ImageFormat.HEIC_IMAGE);

}

@Override
public ImageReader createReaderInstance() throws IOException {
return createReaderInstance("heic");
}
}
Loading

0 comments on commit 0579c12

Please sign in to comment.