2 * Image codec. Author: Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
3 * This project is released under Creative Commons Zero (CC0) license.
5 package eu.svjatoslav.imagesqueeze.sampleApplication;
8 import java.io.IOException;
9 import java.io.InputStream;
13 public static void main(final String[] args) throws IOException {
15 final String image = "colorful photo";
16 final String sourceDirectory = "/eu/svjatoslav/imagesqueeze/sampleApplication/data/";
18 // create visible frame
19 // load image into frame
20 final InputStream inputStream = Main.class
21 .getResourceAsStream(sourceDirectory + image + ".png");
23 final ImageFrame frame = new ImageFrame("Original image");
24 frame.getImagePanel().loadImage(inputStream, false);
25 frame.setVisible(true);
27 // encode image into file
28 frame.getImagePanel().saveImage(new File(image + ".ImgSqz"));
30 // create second frame for decoded image
31 final ImageFrame frame2 = new ImageFrame("Encoded -> Decoded");
34 frame2.getImagePanel().loadImage(new File(image + ".ImgSqz"), true);
35 frame2.setVisible(true);