projects
/
imagesqueeze.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Updated copyright. Prefer HTTPS in documentation. Switched to LGPLv3 or later.
[imagesqueeze.git]
/
src
/
main
/
java
/
eu
/
svjatoslav
/
imagesqueeze
/
sampleApplication
/
Main.java
diff --git
a/src/main/java/eu/svjatoslav/imagesqueeze/sampleApplication/Main.java
b/src/main/java/eu/svjatoslav/imagesqueeze/sampleApplication/Main.java
index
0e2ccce
..
c6a022c
100755
(executable)
--- a/
src/main/java/eu/svjatoslav/imagesqueeze/sampleApplication/Main.java
+++ b/
src/main/java/eu/svjatoslav/imagesqueeze/sampleApplication/Main.java
@@
-1,10
+1,9
@@
/*
/*
- * Imagesqueeze - Image codec optimized for photos.
- * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- *
+ * Imagesqueeze - Image codec. Copyright ©2012-2019, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
+ *
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
- * modify it under the terms of version
2 of the GNU
General Public License
- * as published by the Free Software Foundation.
+ * modify it under the terms of version
3 of the GNU Lesser
General Public License
+ *
or later
as published by the Free Software Foundation.
*/
package eu.svjatoslav.imagesqueeze.sampleApplication;
*/
package eu.svjatoslav.imagesqueeze.sampleApplication;
@@
-15,36
+14,30
@@
import java.io.InputStream;
public class Main {
public class Main {
-
public static void main(final String[] args)
{
+
public static void main(final String[] args) throws IOException
{
- try {
+ final String image = "colorful photo";
+ final String sourceDirectory = "/eu/svjatoslav/imagesqueeze/sampleApplication/data/";
- final String image = "colorful photo";
- final String sourceDirectory = "/eu/svjatoslav/imagesqueeze/sampleApplication/data/";
+ // create visible frame
+ // load image into frame
+ final InputStream inputStream = Main.class
+ .getResourceAsStream(sourceDirectory + image + ".png");
- // create visible frame
- // load image into frame
- final InputStream inputStream = Main.class
- .getResourceAsStream(sourceDirectory + image + ".png");
+ final ImageFrame frame = new ImageFrame("Original image");
+ frame.getImagePanel().loadImage(inputStream, false);
+ frame.setVisible(true);
- final ImageFrame frame = new ImageFrame("Original image");
- frame.getImagePanel().loadImage(inputStream, false);
- frame.setVisible(true);
+ // encode image into file
+ frame.getImagePanel().saveImage(new File(image + ".ImgSqz"));
-
// encode image into fil
e
-
frame.getImagePanel().saveImage(new File(image + ".ImgSqz")
);
+
// create second frame for decoded imag
e
+
final ImageFrame frame2 = new ImageFrame("Encoded -> Decoded"
);
- // create second frame for decoded image
- final ImageFrame frame2 = new ImageFrame("Encoded -> Decoded");
+ // decode image
+ frame2.getImagePanel().loadImage(new File(image + ".ImgSqz"), true);
+ frame2.setVisible(true);
- // decode image
- frame2.getImagePanel().loadImage(new File(image + ".ImgSqz"), true);
- frame2.setVisible(true);
-
- } catch (final IOException exception) {
- System.out.println("Error while loading an image: " + exception);
- }
-
- }
+ }
}
}