The source code of this project is private as this is an academic project. If you need access to the code, kindly contact the author.
Image Lab lets you manipulate images by applying various color transformation effects, filters and color density reduction effects to images. You can now create cross-stitch pattern, pixelate your images and create mosaic art of the images.
- A Graphical User Interface to work with images.
- Load images from disk.
- Blur the images.
- Sharpen the images.
- Apply greyscale effect to images.
- Apply sepia effect to images.
- Reduce color density of images by dithering.
- Apply Mosaic effect images
- Adjust density for mosaic by providing number of seeds the image should have.
- Apply Pixelation effect to images.
- Adjust density of pixelation by providing number of seeds/squares the image should have.
- Write the converted/manipulated images to disk.
- Create batch file to execute all the commands at once.
- Load batch file from disk to execute all the commands in the file at once.
- Generate a cross stitch version of image.
- Cross Stitch Image will have only floss colors. (Total 489 floss colors).
- Create Cross Stitch Image from custom palette of floss colors.
- Replace a color in the cross stitch pattern by your own color.
- Remove a particular color from the cross stitch image.
- See pattern of cross stitch overlayed on the top of cross stitch image.
- Save cross stitch image to disk
- Save cross stitch pattern to the disk.
p5-CrossStitchApplication jar file is used for running this project.
There are two ways to use this application
1) Use Interactive Graphical User Interface.
2) Use a batch file to execute all the commands at once.
java -jar p5-CrossStitchApplication -interactive
This will launch a graphical user interface (GUI)
GUI will have a menu to perform various operations.
Menu :
File Menu Items :
Effects Menu Items :
- Load Image
Click File -> Load Image - Apply blur effect
Click Effects -> Blur Effect - Apply Sepia effect
Click Effects -> Sepia Effect - Apply GreyScale effect
Click Effects -> GreyScale Effect - Apply Dither effect
Click Effects -> Dither Effect
Enter the intensity of dither as desired.
Click OK. - Apply Pixelate effect
Click Effects -> Pixelate Effect
Enter the number of square.
Click OK. - Apply Mosaic effect
Click Effects -> Mosaic Effect
Enter the number of seeds.
Click OK. - Aply Cross Stitch effect
Click Effects -> Cross Stitch Pattern
Enter the number of square in pattern.
Select number of colors from which pattern is to be generated. Leave blank and Continue if all colors are needed.
Click OK.
java -jar p5-CrossStitchApplication batch-commands.txt
where p5-CrossStitchApplication is the runnable jar file containing the driver for the project and batch-commands contains all the commands that can be use to apply effects on the images.
1) load <filepath>
- filepath is the path of image to be loaded.
2) blur
- Applies blur effect on the image. It takes no parameter.
3) sharpen
- Applies sharpen effect on the image. It takes no parameter.
4) greyscale
- Applies greyscale effect on the image. It takes no parameter.
5) sepia
- Applies sepia effect on the image. It takes no parameter.
6) dither <number of colors>
- Applies dither effect on the image.
- Take numeric parameter indicating the number of colors the image has to be reduced in.
7) mosaic <number of seeds>
- Applies mosaic effect on the image.
- Take numeric parameter indicating the total number of seeds that can exist in the resultant image.
8) pixelate <number of squares>
- Applies pixelate effect on the image.
- Take a numeric parameter indicating the total number of squares across a image.
9) pattern <number of squares>
- Applies pixelate effect on the image based on number of squares provided in parameter.
- Generates cross stitch pattern of pixelated image.
- Take a numeric parameter indicating the total number of squares across a image.
10) Save <filepath>
- Saves the image. Takes string as parameter to indicate the path and name to save the image.
11) quit
- quits the program execution.
12) q
- Alternative to quit command. It also terminates the execution.
Run 1 :
java -jar p5-crossStitchApplication input.txt
Applies all the commands specifies in the input.txt file and generates the images and pattern.
The above example shows usage where :
- Image is loaded
- Effect is applied
- Image is saved.
- to apply next effect we repeat the cycle.
Run 2 :
java -jar p5-crossStitchApplication input.txt
The above example shows usage where multiple effects are applied before saving the image. It follow something like :
- load beach.jpg
- blur
- greyscale
- save beach-new.jpg
Here the image will first be blurred and then greyscaled. The output will be greyscaled image that is blur.
Run 3 :
java -jar p5-crossStitchApplication -interactive
Here a interactive graphical user interface will be displayed.
load beach.jpg
dither 8
save beach-dither.jpg
load beach.jpg
blur
save beach-blur.jpg
load beach.jpg
greyscale
save beach-greyscale.jpg
load beach.jpg
sepia
save beach-sepia.jpg
load beach.jpg
sharpen
save beach-sharpen.jpg
load beach.jpg
mosaic 570
save beach-mosaic.jpg
load beach.jpg
pixelate 30
save beach-pixelate.jpg
load beach.jpg
pattern 30
save beach-pattern.txt
quit
- Added View to interact with controller and model.
- Added Graphical User Interface using swing.
- GUI will display the results.
- Cross stitch image will be displayed having floss colors only.
- A single color can be removed from the cross stitch pattern.
- A single color can be replaced with another color.
- User can select custom palette of cross stitch floss colors to generated colors from.
- Pattern can be overlayed on top of cross stitch image.
- Added JList to allow user to create custom palette to be used for cross stitch image.
- Added JComboBox to allow user to select a single color which can be replaced from cross stitch pattern.
- Added various method in IView interface to help all the operation supported by application.
- Added RemoveColor and ReplaceColor commands in controller for reusability.
- Added DmcImage class which represents cross stitch image and pattern. This makes it easy to perform operations like removeColor and replaceColor as DmcImage acts as AbstractDataType.
- Controller will have constructor to support batch and view execution modes.
- Each channel can have maximum of 8 bits i.e maximum of 256 colors in each channel.
- The number of colors that the image has to be reduced to for dithering is for each channel. For example - if the image has to be reduced to 2 colors ... it will be 2 colors each for R,G,B.
- Pixelation can generate perfect squares ( ex. 10x10 ) or squares whose width x height differs by only 1 (10x11, 11x10,etc) provided that the number of offset pixels are less than number super-pixels.
- Parameter for pixelation indicates the total number of super pixels across the width.
- Applying effect changes the image. If any new effect is applied, it will be applied on the changed effect. If new effect is to be applied on original effect, then original image has to be loaded again. For example. If blur is applied on image and then greyscale is applied, the resultant image will be a image that is greyscale in color and blurred.
- Each command will be on a new line in batch file.
- Setting console encoding to UTF-8 in run configurations.
- The intensity of blur,sharpen, greyscale, sepia cannot be adjusted.
- Application supports UTF-8 character encoding. If the operating system does not have default encoding as UTF-8 , then use JAVA_TOOL_OPTION=-Dfile.encoding=UTF8 as envrionment variable.
- The images used for example run and in this project are clicked from my phone camera and are original. I authorize its use in this project.
- The unicode used are from website : https://en.wikipedia.org/wiki/List_of_Unicode_characters
- Meet Patel