{"id":18412139,"url":"https://github.com/milchreis/processing-imageprocessing","last_synced_at":"2025-04-12T23:45:57.452Z","repository":{"id":41165482,"uuid":"116294522","full_name":"Milchreis/processing-imageprocessing","owner":"Milchreis","description":"Collection of basic image processing algorithms for processing","archived":false,"fork":false,"pushed_at":"2023-06-01T05:01:59.000Z","size":22271,"stargazers_count":187,"open_issues_count":5,"forks_count":23,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-12T23:45:46.468Z","etag":null,"topics":["brightness","contrast","dithering","edge-detection","halftone","image","image-processing","processing","sharpen","split-toning","tilt-shift","toning","vignette"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/Milchreis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"milchreis","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2018-01-04T18:38:33.000Z","updated_at":"2025-03-04T23:01:26.000Z","dependencies_parsed_at":"2024-11-06T03:40:54.456Z","dependency_job_id":"c1f8c5df-ebe3-43d2-81c1-aa8a82cbfc7e","html_url":"https://github.com/Milchreis/processing-imageprocessing","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Milchreis%2Fprocessing-imageprocessing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Milchreis%2Fprocessing-imageprocessing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Milchreis%2Fprocessing-imageprocessing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Milchreis%2Fprocessing-imageprocessing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Milchreis","download_url":"https://codeload.github.com/Milchreis/processing-imageprocessing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647258,"owners_count":21139081,"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":["brightness","contrast","dithering","edge-detection","halftone","image","image-processing","processing","sharpen","split-toning","tilt-shift","toning","vignette"],"created_at":"2024-11-06T03:39:56.186Z","updated_at":"2025-04-12T23:45:57.431Z","avatar_url":"https://github.com/Milchreis.png","language":"HTML","readme":"# Image processing for Processing\nThis library collects various image processing algorithms and provides simple access to them. All algorithms are implemented \nin Java and runs without any other dependencies. Some algorithms are pretty standard and others maybe do you know from Photoshop.\nIt starts with less basic features and grow over the last years.\nIf you need high power performance better use [opencv for processing](https://github.com/atduskgreg/opencv-processing).\n\nIf you like this project and you want to keep me awake 🤪\n\n\u003ca href='https://ko-fi.com/L4L21072C' target='_blank'\u003e\u003cimg height='36' style='border:0px;height:36px;' src='https://az743702.vo.msecnd.net/cdn/kofi1.png?v=2' border='0' alt='Buy Me a Coffee at ko-fi.com' /\u003e\u003c/a\u003e\n\n# Installation\nIf you want to use this library in your processing sketch you can download it via the integrated `Contribution Manager`.\n\n![alt install](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/install.png?raw=true)\n\n# Examples\n\n## Overview\nThe following algorithms are supported in this library. Click on the link to see an example image and a code snippet.\n\n - [Basics](#basics)\n   - [Grayscale](#grayscale-image)\n   - [Flip](#flip-image)\n   - [Invert](#invert-colors)\n   - [Threshold](#threshold-image)\n   - [Dilation](#dilation-image)\n   - [Erosion](#erosion-image)\n   - [Vignette](#vignette-image)\n   - [Quantization](#quantization)\n   - [PaletteMapping](#palettemapping)\n   - [Difference](#difference)\n - [Blur](#blur)\n   - [Gaussian](#gaussian-blur-image)\n   - [Pixelize](#pixelize-image)\n   - [Tilt-Shift-Effect](#tilt-shift-effect)\n - [Edge detection](#edge-detection)\n   - [Canny](#cannys-algorithm)\n   - [Sobel](#sobels-algorithm)\n - [Optimisation](#optimisation)\n   - [Brightness](#brightness)\n   - [Contrast](#contrast)\n   - [Saturation](#saturation)\n   - [Changing highlights](#changing-highlights)\n   - [Changing shadows](#changing-shadows)\n   - [Auto balance](#autobalance-image)\n   - [Bloom-Effect](#bloom-image)\n   - [Sharpen](#sharpen-image)\n   - [Color-Shift](#color-shift-image)\n - [Looks](#looks)\n   - [Lookup table (LUT)](#lookup-table-image)\n   - [RetroConsole effect (Gameboy)](#retroconsole-effect-gameboy)\n   - [Glitch-Effect](#glitch-image)\n   - [Matte-Effect](#matte-effect)\n   - [Sabattier-Effect](#sabattier-effect)\n   - [Strokes](#strokes-image)\n   - [Dithering](#dithering)\n   - [Halftone](#halftone-image)\n   - [Toning](#toning-image)\n   - [Split-Toning](#split-toning-image)\n   - [Sine-Wave](#sine-wave-image)\n   - [Knitting](#knitting-image)\n   - [ASCII](#ascii-image)\n - [Miscellaneous](#miscellaneous)\n   - [Stacked images](#stacked-images)\n   - [Blending images](#blending-two-images)\n\n#### Original image\n![alt original](https://github.com/Milchreis/processing-imageprocessing/blob/master/examples/Basics/data/example.jpg?raw=true)\n\n_Photo taken by me [more here](https://www.instagram.com/milchreisjunkie/)_\n\n## Basics\n\n#### Grayscale image\n![alt grayscale](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/gray.png?raw=true)\n```java\nPImage processedImage = Grayscale.apply(image);\n```\n\n#### Flip image\n![alt flip](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/flip.png?raw=true)\n```java\nPImage processedImage = Flip.apply(image, horizontal, vertical);  // horizontal and vertical are boolean\n```\n\n#### Invert colors\n![alt invert colors](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/invertcolors.png?raw=true)\n```java\n// invertRed, invertGreen and invertBlue are boolean\nPImage processedImage = InvertColors.apply(image, invertRed, invertGreen, invertBlue);  \n```\n\n#### Threshold image\n![alt threshold](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/threshold.png?raw=true)\n```java\nPImage processedImage = Threshold.apply(image);  // Auto threshold\nPImage processedImage = Threshold.apply(image, value);  // Threshold value between 0 and 255\n```\n\n#### Dilation image\n![alt dilation](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/dilation.png?raw=true)\n```java\nPImage processedImage = Dilation.apply(image, radius);  // radius is a positive number\n```\n\n#### Erosion image\n![alt erosion](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/erosion.png?raw=true)\n```java\nPImage processedImage = Erosion.apply(image, radius);  // radius is a positive number\n```\n\n#### Vignette image\n![alt vignette](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/vignette.png?raw=true)\n```java\n// intensity and vignetteWidth are floats between 0.0 and 1.0\nPImage processedImage = Vignette.apply(image, intensity, vignetteWidth); \n```\n\n#### Quantization\n![alt quantization](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/quantization.png?raw=true)\n```java\nPImage processedImage = Quantization.apply(image, shades);  // shades is a positive number between 1 and 255\n```\n\n#### PaletteMapping\n![alt quantization](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/palettemapping.png?raw=true)\n```java\nPImage processedImage = PaletteMapping.apply(image, color1, color2, color3);  // Add any number of colors from dark to light\n```\n\n#### Difference\n![alt difference](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/difference.png?raw=true)\n```java\n// difference is a float between 0.0 and 1.0 from less to very different\nfloat difference = Comparison.howDifferent(image1, image2);\n// differenceImage is the difference between the pixel values (black is no difference, white is high difference)\nPImage differenceImage = Comparison.calculateDifferenceImage(image1, image2);\n```\n\n## Blur\n\n#### Gaussian blur image\n![alt gaussian](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/gaussian.png?raw=true)\n```java\nPImage processedImage = Gaussian.apply(image, 7, 0.84089642);   // kernel size and sigma \n```\n\n#### Pixelize image\n![alt pixelation](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/pixelation.png?raw=true)\n```java\n// pixelsize is a positive number\nPImage processedImage = Pixelation.apply(image, pixelsize); \n// Pixelize a sub area of the input image\nPImage processedImage = Pixelation.apply(image, pixelsize, subX, subY, subWidth, subHeight);  \n```\n\n#### Tilt-Shift-Effect\n![alt tilt-shift](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/tiltshift.png?raw=true)\n```java\nPImage processedImage = TiltShift.apply(image, blurIntensity, horizontal, position, sharpWideness);   \n```\n\n## Edge detection\n\n#### Canny's algorithm\n![alt canny-edge](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/canny.png?raw=true)\n```java\nPImage processedImage = CannyEdgeDetector.apply(image);\n```\n \n#### Sobels algorithm\n![alt sobel-edge](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/sobel.png?raw=true)\n```java\nPImage processedImage = SobelEdgeDetector.apply(image);\n// for colored sobel (for each color channel)\nPImage processedImage = SobelEdgeDetector.apply(image, false);\n```\n \n## Optimisation\n \n#### Brightness\n![alt autobalance](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/brightness.png?raw=true)\n```java\nPImage processedImage = Brightness.apply(image, value); \n// value isa positive number for brighting up or a negative for darken down\n```\n\n#### Contrast\n![alt contrast](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/contrast.png?raw=true)\n```java\n// intensity is between -1.0 and 1.0\nPImage processedImage = Contrast.apply(image, intensity); \n```\n\n#### Saturation\n![alt saturation](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/saturation.png?raw=true)\n```java\n// intensity is between 0.0 and 10.0\n// 0.0 to 1.0 decreases and all above increases the saturation\nPImage processedImage = Saturation.apply(image, intensity); \n```\n\n#### Changing highlights\n![alt changing highlights](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/lights.png?raw=true)\n```java\n// intensity between -1.0 and 1.0\nPImage processedImage = Lights.apply(image, intensity); \n```\n\n#### Changing shadows\n![alt changing shadows](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/shadows.png?raw=true)\n```java\n// intensity between -1.0 and 1.0\nPImage processedImage = Shadows.apply(image, intensity); \n```\n\n#### AutoBalance image\n![alt autobalance](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/autobalance.png?raw=true)\n```java\nPImage processedImage = AutoBalance.apply(image);\n```\n \n#### Bloom image\n![alt bloom](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/bloom.png?raw=true)\n```java\nPImage processedImage = Bloom.apply(image, intensity);  // intensity between 0 and 255\n```\n\n#### Sharpen image\n![alt sharpen](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/sharpen.png?raw=true)\n```java\nPImage processedImage = Sharpen.apply(image, sharpIntensity);  // sharpIntensity between 0.0 and 10.0\n```\n\n#### Color shift image\n![alt color shift](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/colorshift.png?raw=true)\n```java\n// hue is a value between 0 and 360\n// offset is the color range which is accepted (in hue range)\n// shift is the number of the subtracted or added hue value\nPImage processedImage = ColorShift.applyHue(image, hue, offset, shift);  // or short: ColorShift.apply(image, hue, offset, shift)\nPImage processedImage = ColorShift.applySaturation(image, hue, offset, shift);\nPImage processedImage = ColorShift.applyBrightness(image, hue, offset, shift);\n```\n\n## Looks\n\n#### Lookup table image\n![alt lookup-table](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/lut.png?raw=true)\n```java\nLUT style = LUT.loadLut(LUT.STYLE.CONTRAST);\nPImage processedImage = LUT.apply(image, style); \n```\n\n#### RetroConsole effect (Gameboy)\n![alt lookup-table](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/retroconsole.png?raw=true)\n```java\nPImage processedImage = RetroConsole.applyGameboy(image, pixelSize); \n```\n\n#### Glitch image\n![alt glitch-effect](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/glitch.png?raw=true)\n```java\nPImage processedImage = Glitch.apply(image, intensity, scanlineheight);\n```\n\n#### Matte effect\n![alt matte-effect](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/matte.png?raw=true)\n```java\nPImage processedImage = Matte.apply(image, \n    matteIntensity,         // intensity for the lifting blacks between 0 and 255\n    contrastIntensity,      // intensity for the constrast between 0 and 255\n    saturationIntensity);   // change for the saturation between -0.5 and 0.5\n```\n\n#### Sabattier effect\n![alt sabattier-effect](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/sabattier.png?raw=true)\n```java\n// intensity between 0.0 and 1.0\nPImage processedImage = Sabattier.apply(image, intensity);\nPImage processedImage = Sabattier.applyRed(image, intensity);\nPImage processedImage = Sabattier.applyGreen(image, intensity);\nPImage processedImage = Sabattier.applyBlue(image, intensity);\n```\n\n#### Strokes image\nrandom angles           |  fixed angle\n:-------------------------:|:-------------------------:\n![alt strokes](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/strokes.png?raw=true)  | ![alt strokes](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/strokes2.png?raw=true)\n\n```java\nPImage processedImage = Strokes.apply(image, gridSize, lineLength);\nPImage processedImage = Strokes.apply(image, \n    gridSize,           // is positive and the area for compound pixels \n    lineLength,         // is positive and the length in pixels for each line\n    lineWeight,         // is positive and the weight of each line in pixel\n    linesPerGrid,       // the number of lines per grid\n    lineIntensity,      // alpha value for each line between 0 and 255\n    degree,             // if set the rotation is fixed in degree, otherwise random\n    inColor,            // true for colors else black and white\n    backgroundColor);   // color for the background\n```\n\n#### Dithering\n![alt dithering](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/dithering_d1.png?raw=true)\n```java\n// default dithering algorithm is BAYER_4x4\nPImage processedImage = Dithering.apply(image);\n// change algrithm: BAYER_2x2, BAYER_4x4, BAYER_8x8\nPImage processedImage = Dithering.apply(image, Dithering.Algorithm.BAYER_8x8);\n// use a curstom kernel (kernel = float[])\nPImage processedImage = Dithering.aapply(PImage image, kernel);  \n```\n\n#### Halftone image\n![alt halftone](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/halftone.png?raw=true)\n```java\nPImage processedImage = Halftone.apply(image, dotsize);  // dot size in pixel\nPImage processedImage = Halftone.apply(image, dotsize, grid); // grid = true, on false honeycomb style\nPImage processedImage = Halftone.apply(image, dotsize, foreground, background);  // background and foreground colors\nPImage processedImage = Halftone.apply(image, dotsize, foreground, background, grid);\nPImage processedImage = Halftone.apply(image, dotsize, foreground, background, spacing, grid); // size between dots in pixels\n```\n\n#### Toning image\n![alt toning](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/toning.png?raw=true)\n```java\n// tone is a color and intensity is a value between 0.0 and 1.0\ncolor tone = color(255, 11, 120);\nfloat intensity = 0.8f;\nPImage processedImage = Toning.apply(image, tone, intensity);\n```\n\n#### Split toning image\n![alt split-toning](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/splittoning.png?raw=true)\n```java\nPImage processedImage = SplitToning.apply(\n      image,\n      highlightTone,        // Color for highlighs (f.e. color highlightTone = color(211, 180, 21);\n      intensityHighlights,  // intensity for the toning in highlights between 0.0 and 1.0\n      shadowTone,           // Color for the shadows (f.e. color shadowTone = color(124, 32, 201);\n      intensityShadows);    // intensity for the toning in the shadows between 0.0 and 1.0\n```\n\n#### Sine-Wave image\n![alt sine-wave](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/sinewave.png?raw=true)\n```java\nPImage processedImage = SineWave.apply(image, rowHeight, weight, backgroundColor, wavesColor);\n```\n\n#### Knitting image\n![alt knitting](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/knitting.png?raw=true)\n```java\n// keeps the original colors\nPImage processedImage = Knitting.apply(image, size);\n// Sets foreground and background color and uses a threshold\nPImage processedImage = Knitting.apply(image, size, threshold, 240, #EE0000); \n```\n\n#### ASCII image\n![alt ascii](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/ASCII.png?raw=true)\n```java\nPImage processedImage = ASCII.apply(image);\n// characterset = ASCII.SHORT_SET or ASCII.LONG_SET, another String from black to white\nPImage processedImage = ASCII.apply(image, characterset); \nPImage processedImage = ASCII.apply(image, characterset, fontSize); // fontSize is an integer\nPImage processedImage = ASCII.apply(image, characterset, fontSize, foregroundColor, backgroundColor, toneInColor);\n// To get the ASCII image as plain string use the following method\nPImage processedImage = ASCII.getAsciiText(image); \n```\n\n\n## Miscellaneous\n\n#### Stacked images\n![alt stacked](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/stacker.png?raw=true)\n```java\n// Add so many images in the end as you need\nPImage processedImage = Stacker.apply(Stacker.ALGORITHM.AVERAGE, image1, image2);\nPImage processedImage = Stacker.apply(Stacker.ALGORITHM.MEDIAN, image1, image2);\n```\n\n#### Blending two images\n![alt blending](https://github.com/Milchreis/processing-imageprocessing/blob/master/img/blend.png?raw=true)\n```java\n// intensity is a float between 0.0 and 1.0\nPImage processedImage = Blend.apply(image1, image2, intensity);\n```\n\n# Special thanks\nMy special thanks goes to [avatarr](https://github.com/avatarr/java-image-processing-algorithm) for implementing and \npublishing basic algorithms. Also thank you very much Tom Gibara for your great blog post and the implementation of \nthe [canny edge detector](http://www.tomgibara.com/computer-vision/canny-edge-detector).\n\nMoreover I thank you [Joseph HENRY](https://discourse.processing.org/u/josephh/summary) for the Sine-Wave-effect code and \n[uheinema](https://github.com/uheinema) for the Sabattier code in the [Processing Discourse](https://discourse.processing.org/).\n\n","funding_links":["https://ko-fi.com/milchreis","https://ko-fi.com/L4L21072C'"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilchreis%2Fprocessing-imageprocessing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmilchreis%2Fprocessing-imageprocessing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmilchreis%2Fprocessing-imageprocessing/lists"}