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