Commit 58ec6768 authored by Rui Vieira's avatar Rui Vieira

Add BufferedImage support

parent e86dbf58
FROM openjdk:10.0.1-10-jdk
RUN apt-get update
RUN apt-get install -y python3-pip
RUN pip3 install --no-cache-dir notebook==5.5.* jupyterlab==0.32.* tornado==5.1.1
USER root
# Download the kernel release
RUN curl -L https://github.com/SpencerPark/IJava/releases/download/v1.2.0/ijava-1.2.0.zip > ijava-kernel.zip
# Unpack and install the kernel
RUN unzip ijava-kernel.zip -d ijava-kernel \
&& cd ijava-kernel \
&& python3 install.py --sys-prefix
# Set up the user environment
ENV NB_USER jovyan
ENV NB_UID 1000
ENV HOME /home/$NB_USER
RUN adduser --disabled-password \
--gecos "Default user" \
--uid $NB_UID \
$NB_USER
COPY . $HOME
RUN chown -R $NB_UID $HOME
USER $NB_USER
# Launch the notebook server
WORKDIR $HOME
CMD ["jupyter", "notebook", "--ip", "0.0.0.0"]
\ No newline at end of file
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%%loadFromPOM\n",
"<repository>\n",
" <id>bintray-ruivieira-maven</id>\n",
" <url>https://dl.bintray.com/ruivieira/maven</url>\n",
"</repository>\n",
"<dependency>\n",
" <groupId>org.ruivieira</groupId>\n",
" <artifactId>java-plotlib</artifactId>\n",
" <version>0.0.1</version>\n",
"</dependency>"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Java",
"language": "java",
"name": "java"
},
"language_info": {
"codemirror_mode": "java",
"file_extension": ".java",
"mimetype": "text/x-java-source",
"name": "Java",
"pygments_lexer": "java",
"version": "10.0.1+10-Debian-4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
......@@ -6,7 +6,8 @@
<groupId>org.ruivieira</groupId>
<artifactId>java-plotlib</artifactId>
<version>0.0.1</version>
<version>0.0.2</version>
<build>
<plugins>
<plugin>
......@@ -43,7 +44,6 @@
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
......@@ -81,7 +81,7 @@
<repository>
<id>bintray-ruivieira-maven</id>
<name>ruivieira-maven</name>
<url>https://api.bintray.com/maven/ruivieira/maven/java-plotlib;publish=1</url>
<url>https://api.bintray.com/maven/ruivieira/maven/java-plotlib/;publish=1</url>
</repository>
</distributionManagement>
......
package org.ruivieira.plotlib;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
......@@ -43,4 +46,17 @@ public class Figure {
e.printStackTrace();
}
}
public BufferedImage getBufferedImage() {
BufferedImage img = null;
try {
File tempFile = File.createTempFile("java-plotlib-", ".png");
save(tempFile.getAbsolutePath());
img = ImageIO.read(new File(tempFile.getAbsolutePath()));
} catch (IOException e) {
e.printStackTrace();
}
return img;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment