All Projects → hageldave → ImagingKit

hageldave / ImagingKit

Licence: MIT license
Java library for imaging tasks that integrates well with the java.awt.image environment

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to ImagingKit

repo.kotlin.link
Maven repository that proxy artifact request to one of know project-based maven repositories
Stars: ✭ 14 (-12.5%)
Mutual labels:  maven
tongyimall
高仿小米商城用户端,是Vue + SpringBoot的前后端分离项目,包括首页门户、商品分类、首页轮播、商品展示、购物车、地址管理等部分。管理端在另一个仓库。
Stars: ✭ 55 (+243.75%)
Mutual labels:  maven
docker-java-sample
A simple Java sample that shows how to package Java application using Docker
Stars: ✭ 93 (+481.25%)
Mutual labels:  maven
Hidden-Eye
Hide data into Picture
Stars: ✭ 39 (+143.75%)
Mutual labels:  image-manipulation
HRMS
░▒▓█ 𝑯𝒖𝒎𝒂𝒏 𝑹𝒆𝒔𝒐𝒖𝒓𝒄𝒆𝒔 𝑴𝒂𝒏𝒂𝒈𝒆𝒎𝒆𝒏𝒕 𝑺𝒚𝒔𝒕𝒆𝒎 𝑷𝒓𝒐𝒋𝒆𝒄𝒕 █▓▒░
Stars: ✭ 33 (+106.25%)
Mutual labels:  maven
image-titler
An image title generator using The Renegade Coder style
Stars: ✭ 15 (-6.25%)
Mutual labels:  image-manipulation
ng-in-the-enterprise
Examples of how Angular is being run in the enterprise world.
Stars: ✭ 14 (-12.5%)
Mutual labels:  maven
jsf-primefaces
JSF Primefaces Tutorials
Stars: ✭ 93 (+481.25%)
Mutual labels:  maven
incremental-module-builder
Incremental Module Builder
Stars: ✭ 43 (+168.75%)
Mutual labels:  maven
MasterAppiumFramework
Automation Testing | Mobile | Java | OOPS | Appium | TestNG | Maven | ExtentReport | Java mail API | Logging (Log4J2) | Design Patterns (Page Object Model, Singleton) | Page Factories | Jenkins | Data-Driven Testing using JSON file | Expected Data using XML file
Stars: ✭ 27 (+68.75%)
Mutual labels:  maven
NativeCompile
android 动态库远程依赖
Stars: ✭ 13 (-18.75%)
Mutual labels:  maven
vacomall
☀️☀️ 基于 dubbo 实现的分布式电商平台。
Stars: ✭ 42 (+162.5%)
Mutual labels:  maven
Memer-API
An awesome module that allows you to manipulate images very easily, based on https://memer-api.live
Stars: ✭ 19 (+18.75%)
Mutual labels:  image-manipulation
keep-changelog-maven-plugin
Maven plugin to help creating CHANGELOG by keeping one format and solving merge request conflicts problem by extraction of new CHANGELOG entries to seperate files.
Stars: ✭ 22 (+37.5%)
Mutual labels:  maven
uploadcare-ios
UploadcareKit: iOS SDK for Uploadcare API
Stars: ✭ 24 (+50%)
Mutual labels:  image-manipulation
build-helper-maven-plugin
Build Helper Maven Plugin
Stars: ✭ 77 (+381.25%)
Mutual labels:  maven
java-multithread
Códigos feitos para o curso de Multithreading com Java, no canal RinaldoDev do YouTube.
Stars: ✭ 24 (+50%)
Mutual labels:  parallel-processing
gitall.rs
Run Git commands in all subdirectories really fast
Stars: ✭ 25 (+56.25%)
Mutual labels:  parallel-processing
CorePublish
maven发布插件和bintray发布插件
Stars: ✭ 18 (+12.5%)
Mutual labels:  maven
faketime
Fake currentTimeMillis() without class loader hacks
Stars: ✭ 100 (+525%)
Mutual labels:  maven

ImagingKit

Master Branch

Build Status Coverage Status Maven Central

Development Branch

Build Status Coverage Status

A Java library for imaging tasks that integrates well with the commonly used java.awt.image environment (especially well with TYPE_INT BufferedImages). Its goal is to make image processing more convenient and to ease performance optimization. The library is intended for images using integer typed values like 24bit RGB or 32bit ARGB.

So far the ImagingKit-Core and ImagingKit-Fourier artifacts of the library are available through the maven central repository:

<dependency>
  <groupId>com.github.hageldave.imagingkit</groupId>
  <artifactId>imagingkit-core</artifactId>
  <version>2.1</version>
</dependency>

<dependency>
  <groupId>com.github.hageldave.imagingkit</groupId>
  <artifactId>imagingkit-fourier</artifactId>
  <version>2.1</version>
</dependency>

As this library aims at convenience and ease of use, look at this code snippet for grayscale conversion as a teaser:

Img img = ImageLoader.loadImgFromURL("file:///home/pictures/rainbow.jpg");
for(Pixel px: img){
    int grey = (px.r() + px.g() + px.b()) / 3;
    px.setRGB(grey, grey, grey);
}

And now for the parallel processing part:

img.stream().parallel().forEach( px -> {
    int grey = px.getLuminance();
    px.setRGB(grey, grey, grey);
});

Code Examples

Convert an image to grayscale:

BufferedImage buffimg = ImageLoader.loadImage("myimage_colored.png", BufferedImage.TYPE_INT_ARGB);
Img img = Img.createRemoteImg(buffimg);
img.forEach(true, (pixel) -> {
    int gray = (pixel.r() + pixel.g() + pixel.b())/3;
    pixel.setARGB(pixel.a(), gray, gray, gray);
});
ImageSaver.saveImage(buffimg,"myimage_grayscale.png");

original lena image greyscale lena image

Draw into image (using java.awt.Graphics2D):

Img img = new Img(128, 128);
img.fill(0xff000000);
img.paint(g2d -> {
	g2d.setColor(Color.white);
	String helloWorld = "Hello World";
	int textWidth = g2d.getFontMetrics().stringWidth(helloWorld);
	g2d.drawString(helloWorld, img.getWidth()/2-textWidth/2, img.getHeight()/2);
	g2d.drawLine(0, img.getHeight()/2+4, img.getWidth(), img.getHeight()/2+4);
});
ImageFrame.display(img);
ImageSaver.saveImage(img.getRemoteBufferedImage(), "hello_world.png");

hello world image

Fancy polar color thing:

Img img = new Img(128, 128);
img.forEach(px -> {
	double x = px.getXnormalized()*2-1;
	double y = px.getYnormalized()*2-1;
	double len = Math.max(Math.abs(x),Math.abs(y));
	double angle = (Math.atan2(x,y)+Math.PI)*(180/Math.PI);
	
	double r = Math.max(0,1-Math.abs((angle-120)/120.0));
	double g = Math.max(0, 1-Math.abs((angle-240)/120.0));
	double b = Math.max(0, angle <= 120 ? 
			1-Math.abs((angle)/120.0):1-Math.abs((angle-360)/120.0));
	
	px.setRGB_fromDouble(r*(1-len), g*(1-len), b*(1-len));
});
ImageFrame.display(img);

fancy polor color image

Shifting hue (using color space transformation):

Img img = ImageLoader.loadImgFromURL("http://sipi.usc.edu/database/preview/misc/4.2.03.png");

img.forEach(ColorSpaceTransformation.RGB_2_HSV);
double hueShift = (360-90)/360.0;
img.forEach(pixel -> {
	// R channel corresponds to hue (modulo 1.0 for cyclic behaviour)
	pixel.setR_fromDouble((pixel.r_asDouble()+hueShift) % 1.0);
});
img.forEach(ColorSpaceTransformation.HSV_2_RGB);

ImageFrame.display(img);

baboon image hue shifted baboom image

Fourier Filtering

ColorImg img = new ColorImg(128,128,false);
img.paint(g2d->g2d.fillRect(64-16, 64-8, 32, 16));
ImageFrame.display(img.getRemoteBufferedImage()).setTitle("original");
ComplexImg fourier = Fourier.transform(img, ColorImg.channel_r);
fourier.shiftCornerToCenter();
ImageFrame.display(fourier.getPowerSpectrumImg().toImg()).setTitle("fft");
fourier.forEach(px->{
	int xfreq = px.getXFrequency();
	int yfreq = px.getYFrequency();
	double freqRadius = Math.sqrt(xfreq*xfreq+yfreq*yfreq);
	double gaussian = Math.exp(-freqRadius/(0.05*128));
	px.mult(gaussian, 0);
});
ImageFrame.display(fourier.getPowerSpectrumImg().toImg()).setTitle("filtered fft");
ColorImg restored = Fourier.inverseTransform(null, fourier, ColorImg.channel_r);
ColorImg redChannel = restored.getChannelImage(ColorImg.channel_r);
ImageFrame.display(redChannel.toImg()).setTitle("filterd original");

original fft filtered fft filtered original

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].