{"id":13752084,"url":"https://github.com/skkallayath/photofilters","last_synced_at":"2025-04-12T23:39:26.497Z","repository":{"id":50240066,"uuid":"152425887","full_name":"skkallayath/photofilters","owner":"skkallayath","description":"photofilters library for flutter","archived":false,"fork":false,"pushed_at":"2024-01-21T07:54:44.000Z","size":63529,"stargazers_count":416,"open_issues_count":29,"forks_count":138,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-12T23:39:17.022Z","etag":null,"topics":["dart","filters","flutter","image","imagefilter","instagram","package","photo","photofilters","plugin"],"latest_commit_sha":null,"homepage":null,"language":"Dart","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/skkallayath.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2018-10-10T13:12:32.000Z","updated_at":"2025-03-25T06:23:15.000Z","dependencies_parsed_at":"2024-06-18T17:12:14.494Z","dependency_job_id":null,"html_url":"https://github.com/skkallayath/photofilters","commit_stats":{"total_commits":64,"total_committers":7,"mean_commits":9.142857142857142,"dds":0.21875,"last_synced_commit":"2b1fa06a1952d5c9b8bb4fbb580b4ab95fb240e1"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skkallayath%2Fphotofilters","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skkallayath%2Fphotofilters/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skkallayath%2Fphotofilters/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skkallayath%2Fphotofilters/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skkallayath","download_url":"https://codeload.github.com/skkallayath/photofilters/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647255,"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":["dart","filters","flutter","image","imagefilter","instagram","package","photo","photofilters","plugin"],"created_at":"2024-08-03T09:00:59.199Z","updated_at":"2025-04-12T23:39:26.473Z","avatar_url":"https://github.com/skkallayath.png","language":"Dart","funding_links":[],"categories":["组件","UI [🔝](#readme)","Components"],"sub_categories":["UI"],"readme":"# Photo Filters package for flutter\r\n\r\nA flutter package for iOS and Android for applying filter to an image. A set of preset filters are also available. You can create your own filters too.\r\n\r\n## Installation\r\n\r\nFirst, add `photofilters` and `image` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/).\r\n\r\n### iOS\r\n\r\nNo configuration required - the plugin should work out of the box.\r\n\r\n### Android\r\n\r\nNo configuration required - the plugin should work out of the box.\r\n\r\n### Example\r\n\r\n``` dart\r\nimport 'dart:async';\r\nimport 'dart:io';\r\n\r\nimport 'package:flutter/material.dart';\r\nimport 'package:path/path.dart';\r\nimport 'package:photofilters/photofilters.dart';\r\nimport 'package:image/image.dart' as imageLib;\r\nimport 'package:image_picker/image_picker.dart';\r\n\r\nvoid main() =\u003e runApp(new MaterialApp(home: MyApp()));\r\n\r\nclass MyApp extends StatefulWidget {\r\n  @override\r\n  _MyAppState createState() =\u003e new _MyAppState();\r\n}\r\n\r\nclass _MyAppState extends State\u003cMyApp\u003e {\r\n  String fileName;\r\n  List\u003cFilter\u003e filters = presetFiltersList;\r\n  File imageFile;\r\n\r\n  Future getImage(context) async {\r\n    imageFile = await ImagePicker.pickImage(source: ImageSource.gallery);\r\n    fileName = basename(imageFile.path);\r\n    var image = imageLib.decodeImage(imageFile.readAsBytesSync());\r\n    image = imageLib.copyResize(image, width: 600);\r\n     Map imagefile = await Navigator.push(\r\n      context,\r\n      new MaterialPageRoute(\r\n        builder: (context) =\u003e new PhotoFilterSelector(\r\n              title: Text(\"Photo Filter Example\"),\r\n              image: image,\r\n              filters: presetFiltersList,\r\n              filename: fileName,\r\n              loader: Center(child: CircularProgressIndicator()),\r\n              fit: BoxFit.contain,\r\n            ),\r\n      ),\r\n    );\r\n    if (imagefile != null \u0026\u0026 imagefile.containsKey('image_filtered')) {\r\n      setState(() {\r\n        imageFile = imagefile['image_filtered'];\r\n      });\r\n      print(imageFile.path);\r\n    }\r\n  }\r\n\r\n  @override\r\n  Widget build(BuildContext context) {\r\n    return new Scaffold(\r\n      appBar: new AppBar(\r\n        title: new Text('Photo Filter Example'),\r\n      ),\r\n      body: Center(\r\n        child: new Container(\r\n          child: imageFile == null\r\n              ? Center(\r\n                  child: new Text('No image selected.'),\r\n                )\r\n              : Image.file(imageFile),\r\n        ),\r\n      ),\r\n      floatingActionButton: new FloatingActionButton(\r\n        onPressed: () =\u003e getImage(context),\r\n        tooltip: 'Pick Image',\r\n        child: new Icon(Icons.add_a_photo),\r\n      ),\r\n    );\r\n  }\r\n}\r\n```\r\n\r\n## UI Screen Shots\r\n\r\n\u003cimg src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/screenshot.gif\" width=\"200\"\u003e\r\n\r\n\r\n## Sample Images of Filters\r\n\r\n| | | | |\r\n|:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:|\r\n| \u003cimg width=\"1604\" alt=\"No Filter\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/No Filter.jpg\"\u003e  No Filter | \u003cimg width=\"1604\" alt=\"AddictiveBlue\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/AddictiveBlue.jpg\"\u003e  AddictiveBlue | \u003cimg width=\"1604\" alt=\"AddictiveRed\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/AddictiveRed.jpg\"\u003e  AddictiveRed | \u003cimg width=\"1604\" alt=\"Aden\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Aden.jpg\"\u003e  Aden  | \r\n| \u003cimg width=\"1604\" alt=\"Amaro\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Amaro.jpg\"\u003e  Amaro | \u003cimg width=\"1604\" alt=\"Ashby\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Ashby.jpg\"\u003e  Ashby | \u003cimg width=\"1604\" alt=\"Brannan\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Brannan.jpg\"\u003e  Brannan | \u003cimg width=\"1604\" alt=\"Brooklyn\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Brooklyn.jpg\"\u003e  Brooklyn  | \r\n| \u003cimg width=\"1604\" alt=\"Charmes\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Charmes.jpg\"\u003e  Charmes | \u003cimg width=\"1604\" alt=\"Clarendon\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Clarendon.jpg\"\u003e  Clarendon | \u003cimg width=\"1604\" alt=\"Crema\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Crema.jpg\"\u003e  Crema | \u003cimg width=\"1604\" alt=\"Dogpatch\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Dogpatch.jpg\"\u003e  Dogpatch  | \r\n| \u003cimg width=\"1604\" alt=\"Earlybird\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Earlybird.jpg\"\u003e  Earlybird | \u003cimg width=\"1604\" alt=\"1977\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/1977.jpg\"\u003e  1977 | \u003cimg width=\"1604\" alt=\"Gingham\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Gingham.jpg\"\u003e  Gingham | \u003cimg width=\"1604\" alt=\"Ginza\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Ginza.jpg\"\u003e  Ginza  | \r\n| \u003cimg width=\"1604\" alt=\"Hefe\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Hefe.jpg\"\u003e  Hefe | \u003cimg width=\"1604\" alt=\"Helena\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Helena.jpg\"\u003e  Helena | \u003cimg width=\"1604\" alt=\"Hudson\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Hudson.jpg\"\u003e  Hudson | \u003cimg width=\"1604\" alt=\"Inkwell\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Inkwell.jpg\"\u003e  Inkwell  | \r\n| \u003cimg width=\"1604\" alt=\"Juno\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Juno.jpg\"\u003e  Juno | \u003cimg width=\"1604\" alt=\"Kelvin\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Kelvin.jpg\"\u003e  Kelvin | \u003cimg width=\"1604\" alt=\"Lark\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Lark.jpg\"\u003e  Lark | \u003cimg width=\"1604\" alt=\"Lo-Fi\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Lo-Fi.jpg\"\u003e  Lo-Fi  | \r\n| \u003cimg width=\"1604\" alt=\"Ludwig\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Ludwig.jpg\"\u003e  Ludwig | \u003cimg width=\"1604\" alt=\"Maven\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Maven.jpg\"\u003e  Maven | \u003cimg width=\"1604\" alt=\"Mayfair\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Mayfair.jpg\"\u003e  Mayfair | \u003cimg width=\"1604\" alt=\"Moon\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Moon.jpg\"\u003e  Moon  | \r\n| \u003cimg width=\"1604\" alt=\"Nashville\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Nashville.jpg\"\u003e  Nashville | \u003cimg width=\"1604\" alt=\"Perpetua\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Perpetua.jpg\"\u003e  Perpetua | \u003cimg width=\"1604\" alt=\"Reyes\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Reyes.jpg\"\u003e  Reyes | \u003cimg width=\"1604\" alt=\"Rise\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Rise.jpg\"\u003e  Rise  | \r\n| \u003cimg width=\"1604\" alt=\"Sierra\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Sierra.jpg\"\u003e  Sierra | \u003cimg width=\"1604\" alt=\"Skyline\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Skyline.jpg\"\u003e  Skyline | \u003cimg width=\"1604\" alt=\"Slumber\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Slumber.jpg\"\u003e  Slumber | \u003cimg width=\"1604\" alt=\"Stinson\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Stinson.jpg\"\u003e  Stinson  | \r\n| \u003cimg width=\"1604\" alt=\"Sutro\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Sutro.jpg\"\u003e  Sutro | \u003cimg width=\"1604\" alt=\"Toaster\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Toaster.jpg\"\u003e  Toaster | \u003cimg width=\"1604\" alt=\"Valencia\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Valencia.jpg\"\u003e  Valencia | \u003cimg width=\"1604\" alt=\"Vesper\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Vesper.jpg\"\u003e  Vesper  | \r\n| \u003cimg width=\"1604\" alt=\"Walden\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Walden.jpg\"\u003e  Walden | \u003cimg width=\"1604\" alt=\"Willow\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/Willow.jpg\"\u003e  Willow | \u003cimg width=\"1604\" alt=\"X-Pro II\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/X-Pro II.jpg\"\u003e  X-Pro II  | |\r\n\r\n\r\n## Sample Images of Convolution Filters\r\n\r\n| | | | |\r\n|:-------------------------:|:-------------------------:|:-------------------------:|:-------------------------:|\r\n| \u003cimg width=\"1604\" alt=\"Identity\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/convolution/Identity.jpg\"\u003e  Identity | \u003cimg width=\"1604\" alt=\"Emboss\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/convolution/Emboss.jpg\"\u003e  Emboss | \u003cimg width=\"1604\" alt=\"Sharpen\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/convolution/Sharpen.jpg\"\u003e  Sharpen | \u003cimg width=\"1604\" alt=\"Colored Edge Detection\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/convolution/Colored%20Edge%20Detection.jpg\"\u003e  Colored Edge Detection\r\n| \u003cimg width=\"1604\" alt=\"Blur\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/convolution/Blur.jpg\"\u003e  Blur | \u003cimg width=\"1604\" alt=\"Edge Detection Medium\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/convolution/Edge%20Detection%20Medium.jpg\"\u003e  Edge Detection Medium | \u003cimg width=\"1604\" alt=\"Edge Detection Hard\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/convolution/Edge%20Detection%20Hard.jpg\"\u003e  Edge Detection Hard | \u003cimg width=\"1604\" alt=\"Guassian Blur\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/convolution/Guassian%205x5.jpg\"\u003e  Guassian Blur  | \r\n| \u003cimg width=\"1604\" alt=\"Low Pass\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/convolution/Low%20Pass%205x5.jpg\"\u003e  Low Pass | \u003cimg width=\"1604\" alt=\"High Pass\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/convolution/High%20Pass%203x3.jpg\"\u003e  High Pass | \u003cimg width=\"1604\" alt=\"Mean\" src=\"https://raw.githubusercontent.com/skkallayath/photofilters/master/exampleimages/convolution/Mean%205x5.jpg\"\u003e  Mean | |\r\n\r\n\r\n## Filters\r\n\r\nThere are two types of filters. `ImageFilter` and `ColorFilter`.\r\n\r\n### Image Filter\r\n\r\nImage filter applies its subfilters directly to the whole image one by one. It is computationally expensive since the complexity \u0026 time increases as the number of  subfilters increases.\r\n\r\nYou can create your own custom image filter as like this:\r\n\r\n```dart\r\n    import 'package:photofilters/filters/image_filters.dart';\r\n\r\n    var customImageFilter = new ImageFilter(name: \"Custom Image Filter\");\r\n    customImageFilter.subFilters.add(ConvolutionSubFilter.fromKernel(\r\n      coloredEdgeDetectionKernel,\r\n    ));\r\n    customImageFilter.subFilters.add(ConvolutionSubFilter.fromKernel(\r\n      gaussian7x7Kernel,\r\n    ));\r\n    customImageFilter.subFilters.add(ConvolutionSubFilter.fromKernel(\r\n      sharpenKernel,\r\n    ));\r\n    customImageFilter.subFilters.add(ConvolutionSubFilter.fromKernel(\r\n      highPass3x3Kernel,\r\n    ));\r\n    customImageFilter.subFilters.add(ConvolutionSubFilter.fromKernel(\r\n      lowPass3x3Kernel,\r\n    ));\r\n    customImageFilter.subFilters.add(SaturationSubFilter(0.5));\r\n```\r\n\r\nYou can also inherit the ImageFilter class to create another image filter.\r\n\r\n```dart\r\n\r\nclass MyImageFilter extends ImageFilter {\r\n  MyImageFilter(): super(name: \"My Custom Image Filter\") {\r\n    this.addSubFilter(ConvolutionSubFilter.fromKernel(sharpenKernel));\r\n  }\r\n}\r\n```\r\n\r\n### Color Filter\r\n\r\nColor filter applies its subfilters to each pixel one by one. It is computationally less expensive than the ImageFilter. It will loop through the image pixels only once irrespective of the number of subfilters.\r\n\r\n\r\nYou can create your own custom color filter as like this:\r\n\r\n```dart\r\n    import 'package:photofilters/filters/color_filters.dart';\r\n\r\n    var customColorFilter = new ColorFilter(name: \"Custom Color Filter\");\r\n    customColorFilter.addSubFilter(SaturationSubFilter(0.5));\r\n    customColorFilter\r\n        .addSubFilters([BrightnessSubFilter(0.5), HueRotationSubFilter(30)]);\r\n\r\n```\r\n\r\nYou can inherit the ColorFilter class too\r\n\r\n```dart\r\n\r\nclass MyColorFilter extends ColorFilter {\r\n  MyColorFilter() : super(name: \"My Custom Color Filter\") {\r\n    this.addSubFilter(BrightnessSubFilter(0.8));\r\n    this.addSubFilter(HueRotationSubFilter(30));\r\n  }\r\n}\r\n\r\n```\r\n\r\n## Sub filters\r\n\r\nThere are two types of subfilters. One can be added to the `ColorFilter` and the other can be added to the `ImageFilter`. You can inherit `ColorSubFilter` class to implement the former and you can use the `ImageSubFilter` mixin to implement the latter. You can create a same subfilter that can be used for both Image and Color Filters. The `BrightnessSubFilter` is an example of this.\r\n\r\n```dart\r\nclass BrightnessSubFilter extends ColorSubFilter with ImageSubFilter {\r\n  final num brightness;\r\n  BrightnessSubFilter(this.brightness);\r\n\r\n  ///Apply the [BrightnessSubFilter] to an Image.\r\n  @override\r\n  void apply(Uint8List pixels, int width, int height) =\u003e\r\n      image_filter_utils.brightness(pixels, brightness);\r\n\r\n  ///Apply the [BrightnessSubFilter] to a color.\r\n  @override\r\n  RGBA applyFilter(RGBA color) =\u003e\r\n      color_filter_utils.brightness(color, brightness);\r\n}\r\n```\r\n\r\n\r\n## Getting Started\r\n\r\nFor help getting started with Flutter, view our online [documentation](https://flutter.io/).\r\n\r\nFor help on editing package code, view the [documentation](https://flutter.io/developing-packages/).\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskkallayath%2Fphotofilters","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskkallayath%2Fphotofilters","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskkallayath%2Fphotofilters/lists"}