{"id":28558319,"url":"https://github.com/pedrofellipeantunes/halftone-java","last_synced_at":"2025-06-10T08:08:28.122Z","repository":{"id":267915186,"uuid":"902689336","full_name":"PedroFellipeAntunes/halftone-java","owner":"PedroFellipeAntunes","description":"Java program to apply a halftone filter to an image.","archived":false,"fork":false,"pushed_at":"2025-06-03T06:27:37.000Z","size":12425,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-03T12:16:02.144Z","etag":null,"topics":["graphics","halftone","hatching","image-processing","java","manga","swing"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PedroFellipeAntunes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2024-12-13T04:23:22.000Z","updated_at":"2025-06-03T06:27:38.000Z","dependencies_parsed_at":"2025-06-03T00:12:30.712Z","dependency_job_id":"70da621d-433d-4a09-a2fe-c9b5407a9176","html_url":"https://github.com/PedroFellipeAntunes/halftone-java","commit_stats":null,"previous_names":["pedrofellipeantunes/halftone-java"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PedroFellipeAntunes%2Fhalftone-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PedroFellipeAntunes%2Fhalftone-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PedroFellipeAntunes%2Fhalftone-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PedroFellipeAntunes%2Fhalftone-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PedroFellipeAntunes","download_url":"https://codeload.github.com/PedroFellipeAntunes/halftone-java/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PedroFellipeAntunes%2Fhalftone-java/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259033839,"owners_count":22795771,"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":["graphics","halftone","hatching","image-processing","java","manga","swing"],"created_at":"2025-06-10T08:08:27.661Z","updated_at":"2025-06-10T08:08:28.109Z","avatar_url":"https://github.com/PedroFellipeAntunes.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Halftone\n\nThis project is a Java Maven application built using NetBeans IDE and Swing that applies the effect of **halftone** to an image, with dots, lines or sine waves as the pattern. This code uses a codebase from my other project to [separate the CMYK colors](https://github.com/PedroFellipeAntunes/color-separator-java).\n\n\u003cp align=\"center\"\u003e\n  \u003ctable align=\"center\"\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\n        \u003ctable\u003e\n          \u003ctr\u003e\n            \u003ctd\u003e\n              \u003cimg src=\"images/tests/cameraman_lines.png\" width=\"200\" alt=\"Example 1\"\u003e\n            \u003c/td\u003e\n            \u003ctd\u003e\n              \u003cimg src=\"images/tests/peppers_lines.png\" width=\"200\" alt=\"Example 2\"\u003e\n            \u003c/td\u003e\n          \u003c/tr\u003e\n          \u003ctr\u003e\n            \u003ctd\u003e\n              \u003cimg src=\"images/tests/pirate_lines.png\" width=\"200\" alt=\"Example 3\"\u003e\n            \u003c/td\u003e\n            \u003ctd\u003e\n              \u003cimg src=\"images/tests/baboon_lines.png\" width=\"200\" alt=\"Example 4\"\u003e\n            \u003c/td\u003e\n          \u003c/tr\u003e\n        \u003c/table\u003e\n      \u003c/td\u003e\n      \u003ctd\u003e\n        \u003cimg src=\"images/tests/baboon_color_dots.png\" width=\"400\" alt=\"Example Colored Dots\"\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/table\u003e\n\u003c/p\u003e\n\n---\n\n## Table of Contents\n\n1. [Features](#features)  \n2. [Usage](#usage)  \n3. [How It Works](#how-it-works)  \n4. [Additional Examples](#additional-examples)  \n\n---\n\n## Features\n\n- **Apply Halftone Effect**  \n  - Patterns: `Dots`, `Squares`, `Triangles`, `Lines`, `Sine Waves`.\n- **Full CMYK Processing**  \n  - Separates image into CMYK channels, applies halftone at predetermined angles, and merges using multiply blend.\n- **Drag \u0026 Drop Support**  \n  - Simply drag images into the interface to process them.\n- **Interactive Controls**  \n  - Adjust halftone scale (0–100) and angle (0°–360°) via sliders for live preview.\n- **Batch Processing**  \n  - Drop multiple images at once; each will be processed and automatically saved.\n\n---\n\n## Usage\n\n1. **Open the Application**  \n   - Double-click `Halftone.jar`, or run:  \n     ```\n     java -jar Halftone.jar\n     ```\n\n2. **Configure Settings**  \n   - **Pattern:** Choose between Dots, Squares, Triangles, Lines or Sine Waves.  \n   - **Scale Slider:** Adjust the size of the halftone elements (0 = minimum, 100 = maximum).  \n   - **Angle Slider:** Define the angle of the halftone pattern (0°–360°).  \n   - **Color Mode:** Toggle “CMYK” to enable or disable per-channel processing.\n\n   \u003cp align=\"center\"\u003e\n     \u003cimg src=\"images/steps/interface.png\" width=\"450\" alt=\"Interface\"\u003e\n   \u003c/p\u003e\n\n3. **Drag \u0026 Drop**  \n   - Drag one or more images (JPEG, PNG, JPG) directly into the window.\n\n4. **Preview and Save**  \n   - A live preview will display the result.  \n   - To save, click **Save** or close the window. Processed images are saved in the same folder as the originals with this pattern:  \n     ```\n     originalname_Halftone[type,scale,angle].png\n     ```\n   - Example: `cameraman_Halftone[Lines,50,45.0].png`\n\n---\n\n## How It Works\n\nBelow is a high-level overview of the halftone algorithm (example based on line/sine patterns):\n\n1. **Kernel Generation**  \n   - Divide the image into square blocks (“kernels”), each rotated by the chosen angle.  \n   - For each kernel, sum up the RGB values and compute the average.\n\n   \u003cp align=\"center\"\u003e\n     \u003cimg src=\"images/steps/Step1.png\" width=\"650\" alt=\"Step 1: Kernel Generation\"\u003e\n   \u003c/p\u003e\n\n2. **Luminance Calculation**  \n   - Within each kernel, convert the average color to luminance.  \n   - Determine a center point and compute two offset points based on luminance, constrained to half the kernel size.\n\n   \u003cp align=\"center\"\u003e\n     \u003cimg src=\"images/steps/Step2.png\" width=\"650\" alt=\"Step 2: Luminance and Offsets\"\u003e\n   \u003c/p\u003e\n\n3. **Polygon Filling**  \n   - Negative offsets define the top of a polygon, positive offsets define the bottom.  \n   - Connect these points along each row to create a complex shape that follows the image’s contours at the given angle.\n\n   \u003cp align=\"center\"\u003e\n     \u003cimg src=\"images/steps/Step3.png\" width=\"650\" alt=\"Step 3: Polygon Filling\"\u003e\n   \u003c/p\u003e\n\n4. **CMYK Processing (Optional)**  \n   - When CMYK mode is enabled, repeat steps 1–3 for each channel (Cyan, Magenta, Yellow, Key/Black) using fixed angles (e.g., 15°, 75°, 0°, 45°).  \n   - Finally, blend all channels using a multiply operation to obtain the full-color halftone result.\n\n---\n\n## Additional Examples\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/tests/gradient_sphere_alpha.png\" width=\"150\" alt=\"Sphere 0\"\u003e\n  \u003cimg src=\"images/tests/gradient_sphere_alpha_0.png\" width=\"150\" alt=\"Sphere 1\"\u003e\n  \u003cimg src=\"images/tests/gradient_sphere_alpha_45.png\" width=\"150\" alt=\"Sphere 2\"\u003e\n  \u003cimg src=\"images/tests/gradient_sphere_alpha_90.png\" width=\"150\" alt=\"Sphere 3\"\u003e\n  \u003cimg src=\"images/tests/gradient_sphere_alpha_135.png\" width=\"150\" alt=\"Sphere 4\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/tests/Lion_waiting_in_Namibia_example.png\" width=\"550\" alt=\"Example Lion Sine\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/tests/Blade-Runner-2049-1753_bottom.png\" width=\"650\" alt=\"Example 5\"\u003e\n  \u003cimg src=\"images/tests/Blade-Runner-2049-1753_top.png\" width=\"650\" alt=\"Example 6\"\u003e\n\u003c/p\u003e\n\nOverlaying halftones at opposing angles with the dark layer at 50% opacity to create a cross-hatching effect.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/tests/Blade-Runner-2049-1753_Example1.png\" width=\"650\" alt=\"Example 7\"\u003e\n\u003c/p\u003e\n\nThis effect can be further enhanced by generating an outline (e.g., with Extended Difference of Gaussians).\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"images/tests/Blade-Runner-2049-1753_Example2.png\" width=\"650\" alt=\"Example 8\"\u003e\n\u003c/p\u003e\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedrofellipeantunes%2Fhalftone-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpedrofellipeantunes%2Fhalftone-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpedrofellipeantunes%2Fhalftone-java/lists"}