{"id":15044530,"url":"https://github.com/hageldave/imagingkit","last_synced_at":"2025-04-10T00:43:05.277Z","repository":{"id":56627117,"uuid":"48461129","full_name":"hageldave/ImagingKit","owner":"hageldave","description":"Java library for imaging tasks that integrates well with the java.awt.image environment","archived":false,"fork":false,"pushed_at":"2023-09-06T14:00:41.000Z","size":3060,"stargazers_count":17,"open_issues_count":3,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T00:42:59.010Z","etag":null,"topics":["image-manipulation","image-processing","java-lambda","java-library","java8","maven","parallel-processing"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hageldave.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-12-23T00:51:06.000Z","updated_at":"2024-07-24T07:25:51.000Z","dependencies_parsed_at":"2024-09-28T23:20:46.169Z","dependency_job_id":"dc36bd2f-8268-4a84-8127-ffe4d878c80c","html_url":"https://github.com/hageldave/ImagingKit","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hageldave%2FImagingKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hageldave%2FImagingKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hageldave%2FImagingKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hageldave%2FImagingKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hageldave","download_url":"https://codeload.github.com/hageldave/ImagingKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137998,"owners_count":21053775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["image-manipulation","image-processing","java-lambda","java-library","java8","maven","parallel-processing"],"created_at":"2024-09-24T20:50:41.517Z","updated_at":"2025-04-10T00:43:05.257Z","avatar_url":"https://github.com/hageldave.png","language":"Java","readme":"# ImagingKit\n#### [Master Branch](https://github.com/hageldave/ImagingKit/tree/master)\n[![Build Status](https://travis-ci.com/hageldave/ImagingKit.svg?branch=master)](https://travis-ci.com/github/hageldave/ImagingKit/branches)\n[![Coverage Status](https://coveralls.io/repos/github/hageldave/ImagingKit/badge.svg?branch=master)](https://coveralls.io/github/hageldave/ImagingKit?branch=master)\n[![Maven Central](https://img.shields.io/maven-central/v/com.github.hageldave.imagingkit/imagingkit-core.svg)](http://search.maven.org/#artifactdetails|com.github.hageldave.imagingkit|imagingkit-core|2.1|jar)\n---\nA 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. \n\nSo far the *ImagingKit-Core* and *ImagingKit-Fourier* artifacts of the library are available through the maven central repository:\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.github.hageldave.imagingkit\u003c/groupId\u003e\n  \u003cartifactId\u003eimagingkit-core\u003c/artifactId\u003e\n  \u003cversion\u003e2.1\u003c/version\u003e\n\u003c/dependency\u003e\n\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.github.hageldave.imagingkit\u003c/groupId\u003e\n  \u003cartifactId\u003eimagingkit-fourier\u003c/artifactId\u003e\n  \u003cversion\u003e2.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nAs this library aims at convenience and ease of use, look at this code snippet for grayscale conversion as a teaser:\n```java\nImg img = ImageLoader.loadImgFromURL(\"file:///home/pictures/rainbow.jpg\");\nfor(Pixel px: img){\n    int grey = (px.r() + px.g() + px.b()) / 3;\n    px.setRGB(grey, grey, grey);\n}\n```\nAnd now for the parallel processing part:\n```java\nimg.stream().parallel().forEach( px -\u003e {\n    int grey = px.getLuminance();\n    px.setRGB(grey, grey, grey);\n});\n```\n\n\n### Code Examples\n---\nConvert an image to grayscale:\n```java\nBufferedImage buffimg = ImageLoader.loadImage(\"myimage_colored.png\", BufferedImage.TYPE_INT_ARGB);\nImg img = Img.createRemoteImg(buffimg);\nimg.forEach(true, (pixel) -\u003e {\n    int gray = (pixel.r() + pixel.g() + pixel.b())/3;\n    pixel.setARGB(pixel.a(), gray, gray, gray);\n});\nImageSaver.saveImage(buffimg,\"myimage_grayscale.png\");\n```\n![original lena image](ImagingKit_Core/src/test/resources/lena.128.png)\n![greyscale lena image]( ImagingKit_Core/src/test/resources/exampleimages/lenagrey.png)\n\n---\nDraw into image (using java.awt.Graphics2D):\n```java\nImg img = new Img(128, 128);\nimg.fill(0xff000000);\nimg.paint(g2d -\u003e {\n\tg2d.setColor(Color.white);\n\tString helloWorld = \"Hello World\";\n\tint textWidth = g2d.getFontMetrics().stringWidth(helloWorld);\n\tg2d.drawString(helloWorld, img.getWidth()/2-textWidth/2, img.getHeight()/2);\n\tg2d.drawLine(0, img.getHeight()/2+4, img.getWidth(), img.getHeight()/2+4);\n});\nImageFrame.display(img);\nImageSaver.saveImage(img.getRemoteBufferedImage(), \"hello_world.png\");\n```\n![hello world image](ImagingKit_Core/src/test/resources/exampleimages/helloworld.png)\n\n---\nFancy polar color thing:\n```java\nImg img = new Img(128, 128);\nimg.forEach(px -\u003e {\n\tdouble x = px.getXnormalized()*2-1;\n\tdouble y = px.getYnormalized()*2-1;\n\tdouble len = Math.max(Math.abs(x),Math.abs(y));\n\tdouble angle = (Math.atan2(x,y)+Math.PI)*(180/Math.PI);\n\t\n\tdouble r = Math.max(0,1-Math.abs((angle-120)/120.0));\n\tdouble g = Math.max(0, 1-Math.abs((angle-240)/120.0));\n\tdouble b = Math.max(0, angle \u003c= 120 ? \n\t\t\t1-Math.abs((angle)/120.0):1-Math.abs((angle-360)/120.0));\n\t\n\tpx.setRGB_fromDouble(r*(1-len), g*(1-len), b*(1-len));\n});\nImageFrame.display(img);\n```\n![fancy polor color image](ImagingKit_Core/src/test/resources/exampleimages/fancypolarcolor.png)\n\n---\nShifting hue (using color space transformation):\n```java\nImg img = ImageLoader.loadImgFromURL(\"http://sipi.usc.edu/database/preview/misc/4.2.03.png\");\n\nimg.forEach(ColorSpaceTransformation.RGB_2_HSV);\ndouble hueShift = (360-90)/360.0;\nimg.forEach(pixel -\u003e {\n\t// R channel corresponds to hue (modulo 1.0 for cyclic behaviour)\n\tpixel.setR_fromDouble((pixel.r_asDouble()+hueShift) % 1.0);\n});\nimg.forEach(ColorSpaceTransformation.HSV_2_RGB);\n\nImageFrame.display(img);\n```\n![baboon image](ImagingKit_Core/src/test/resources/baboon.128.png)\n![hue shifted baboom image](ImagingKit_Core/src/test/resources/exampleimages/hueshift.png)\n\n---\nFourier Filtering\n```java\nColorImg img = new ColorImg(128,128,false);\nimg.paint(g2d-\u003eg2d.fillRect(64-16, 64-8, 32, 16));\nImageFrame.display(img.getRemoteBufferedImage()).setTitle(\"original\");\nComplexImg fourier = Fourier.transform(img, ColorImg.channel_r);\nfourier.shiftCornerToCenter();\nImageFrame.display(fourier.getPowerSpectrumImg().toImg()).setTitle(\"fft\");\nfourier.forEach(px-\u003e{\n\tint xfreq = px.getXFrequency();\n\tint yfreq = px.getYFrequency();\n\tdouble freqRadius = Math.sqrt(xfreq*xfreq+yfreq*yfreq);\n\tdouble gaussian = Math.exp(-freqRadius/(0.05*128));\n\tpx.mult(gaussian, 0);\n});\nImageFrame.display(fourier.getPowerSpectrumImg().toImg()).setTitle(\"filtered fft\");\nColorImg restored = Fourier.inverseTransform(null, fourier, ColorImg.channel_r);\nColorImg redChannel = restored.getChannelImage(ColorImg.channel_r);\nImageFrame.display(redChannel.toImg()).setTitle(\"filterd original\");\n```\n![original](ImagingKit_Fourier/src/test/resources/exampleimages/whitebox.png)\n![fft](ImagingKit_Fourier/src/test/resources/exampleimages/fft.png)\n![filtered fft](ImagingKit_Fourier/src/test/resources/exampleimages/filtered_fft.png)\n![filtered original](ImagingKit_Fourier/src/test/resources/exampleimages/blurred_whitebox.png)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhageldave%2Fimagingkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhageldave%2Fimagingkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhageldave%2Fimagingkit/lists"}