2 * Imagesqueeze - Image codec. Copyright ©2012-2019, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 3 of the GNU Lesser General Public License
6 * or later as published by the Free Software Foundation.
9 package eu.svjatoslav.imagesqueeze.sampleApplication;
12 import java.io.IOException;
13 import java.io.InputStream;
17 public static void main(final String[] args) throws IOException {
19 final String image = "colorful photo";
20 final String sourceDirectory = "/eu/svjatoslav/imagesqueeze/sampleApplication/data/";
22 // create visible frame
23 // load image into frame
24 final InputStream inputStream = Main.class
25 .getResourceAsStream(sourceDirectory + image + ".png");
27 final ImageFrame frame = new ImageFrame("Original image");
28 frame.getImagePanel().loadImage(inputStream, false);
29 frame.setVisible(true);
31 // encode image into file
32 frame.getImagePanel().saveImage(new File(image + ".ImgSqz"));
34 // create second frame for decoded image
35 final ImageFrame frame2 = new ImageFrame("Encoded -> Decoded");
38 frame2.getImagePanel().loadImage(new File(image + ".ImgSqz"), true);
39 frame2.setVisible(true);