mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-09 09:49:58 +01:00
Compare commits
122 Commits
daemon1024
...
v3.7.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd82180f63 | ||
|
|
79c948d460 | ||
|
|
08d680c49a | ||
|
|
e84906a5d2 | ||
|
|
6320b24056 | ||
|
|
f3dba3c0c8 | ||
|
|
35ced581cf | ||
|
|
3dc251fa49 | ||
|
|
882bd2f49f | ||
|
|
557fbc1b3d | ||
|
|
3abe4425f4 | ||
|
|
29e3a1b4a2 | ||
|
|
87a99d88be | ||
|
|
ade38c5dd8 | ||
|
|
266e999682 | ||
|
|
5a760cf24b | ||
|
|
c77792b4db | ||
|
|
219e10fce3 | ||
|
|
01e7e64ee0 | ||
|
|
66fbabaaf7 | ||
|
|
3d4fe68aac | ||
|
|
fa1d5e3660 | ||
|
|
eebefaf790 | ||
|
|
a692823361 | ||
|
|
a3d6498d0d | ||
|
|
aa91bfa737 | ||
|
|
f0e44efaea | ||
|
|
fd09a9ea83 | ||
|
|
68cabc8dde | ||
|
|
3a63637261 | ||
|
|
32afd67e3a | ||
|
|
8b322ef462 | ||
|
|
0d9e73f8c5 | ||
|
|
946278f50a | ||
|
|
ca9be39878 | ||
|
|
7976c8defc | ||
|
|
4c61adf6a8 | ||
|
|
dbc1e2f112 | ||
|
|
8b929bdbdc | ||
|
|
8627ed8141 | ||
|
|
660b7053a7 | ||
|
|
53e34d4603 | ||
|
|
b29dcf8b25 | ||
|
|
dabc845c64 | ||
|
|
20f5ef8453 | ||
|
|
04498067ba | ||
|
|
fa4be20652 | ||
|
|
8c19179fdc | ||
|
|
f2a696a3c4 | ||
|
|
aa1feb0b37 | ||
|
|
1d2e2be9ad | ||
|
|
51d883e45f | ||
|
|
dd7316e5ff | ||
|
|
2be49aa362 | ||
|
|
0c3a08023c | ||
|
|
7acbc4731f | ||
|
|
6fdd40a887 | ||
|
|
aebb6a0fd7 | ||
|
|
786035d78c | ||
|
|
71d91c1fa7 | ||
|
|
214221ec0d | ||
|
|
f377376bda | ||
|
|
056090cba9 | ||
|
|
99beee13dd | ||
|
|
37968acfc1 | ||
|
|
9429c1db45 | ||
|
|
51885b40e7 | ||
|
|
b3861e6fe5 | ||
|
|
03b4983130 | ||
|
|
4967b25902 | ||
|
|
4e0f7f5b8c | ||
|
|
0f02571607 | ||
|
|
c7e1fd9696 | ||
|
|
dd0dc55601 | ||
|
|
b35852a073 | ||
|
|
1a5bacf635 | ||
|
|
67ec0c68b0 | ||
|
|
e3411346fa | ||
|
|
a135b8add4 | ||
|
|
8007b40b45 | ||
|
|
36e1a5ddfc | ||
|
|
2ea4c80557 | ||
|
|
863037db2a | ||
|
|
160354bea5 | ||
|
|
30a89563dc | ||
|
|
ec2d1796bd | ||
|
|
1b7ab86cbc | ||
|
|
45933cefd7 | ||
|
|
ea8bb69c8a | ||
|
|
cefea9a37d | ||
|
|
3ae87fec95 | ||
|
|
bf0956272d | ||
|
|
a7ce9456b4 | ||
|
|
b50bcc7713 | ||
|
|
fe196f76c9 | ||
|
|
e8bfb98a1d | ||
|
|
86115fcc88 | ||
|
|
33d39ea8af | ||
|
|
f23f1d6bd0 | ||
|
|
faf0251ec9 | ||
|
|
c4101d8321 | ||
|
|
18b0fde83b | ||
|
|
9252160f60 | ||
|
|
38911e325d | ||
|
|
f7738c3861 | ||
|
|
dc58aa6836 | ||
|
|
f3e8cfd6e6 | ||
|
|
b27ad7fced | ||
|
|
db3d5b2027 | ||
|
|
8604966874 | ||
|
|
a32470db70 | ||
|
|
f232aedcf7 | ||
|
|
4d3abd05d4 | ||
|
|
fa323ba306 | ||
|
|
aa120591cb | ||
|
|
290dbe4c05 | ||
|
|
40ee8b6927 | ||
|
|
31003cf702 | ||
|
|
80bd0ffedc | ||
|
|
3e7d9d2e2b | ||
|
|
6ffc4a9853 | ||
|
|
1321033c64 |
25
.github/ISSUE_TEMPLATE/enhancement template.md
vendored
Normal file
25
.github/ISSUE_TEMPLATE/enhancement template.md
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
# New Enhancement Request
|
||||
|
||||
Describe your enhancement
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
What does your enhancement do?
|
||||
|
||||
Upload Screenshot of your enhancement
|
||||
|
||||
### Please show us where to look
|
||||
Paste in a full URL, starting with:
|
||||
### Problem it can solve
|
||||
|
||||
what problem could this enhancement solve?
|
||||
|
||||
Your help makes Public Lab better! We *deeply* appreciate your helping refine and improve this site.
|
||||
|
||||
To learn how to write really great issues, which increases the chances they'll be resolved, see:
|
||||
|
||||
https://publiclab.org/wiki/developers#Contributing+for+non-coders
|
||||
### Thank you :)
|
||||
22
.github/ISSUE_TEMPLATE/feature request.md
vendored
Normal file
22
.github/ISSUE_TEMPLATE/feature request.md
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# New Feature Request
|
||||
|
||||
Describe your feature
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
What does your feature do?
|
||||
|
||||
Upload Screenshot of your implementation/feature
|
||||
|
||||
### Please show us where to look
|
||||
Paste in a full URL, starting with:
|
||||
### Problem it can solve
|
||||
Your help makes Public Lab better! We *deeply* appreciate your helping refine and improve this site.
|
||||
|
||||
To learn how to write really great issues, which increases the chances they'll be resolved, see:
|
||||
|
||||
https://publiclab.org/wiki/developers#Contributing+for+non-coders
|
||||
### Thank you :)
|
||||
24
.github/ISSUE_TEMPLATE/release_workflow.md
vendored
24
.github/ISSUE_TEMPLATE/release_workflow.md
vendored
@@ -15,17 +15,29 @@ Discuss with @publiclab/is-maintainers if anything is ambiguous!
|
||||
* [x] open an issue using the "release" template with this checklist with title `Checklist and coordination for v0.0.0 major/minor/patch release` (see [semantic versioning](https://docs.npmjs.com/about-semantic-versioning/))
|
||||
* [ ] create a release [project](https://github.com/publiclab/image-sequencer/projects) from [this template](https://github.com/publiclab/image-sequencer/projects/5). You can copy a project from its menu.
|
||||
* [ ] compile release notes below from corresponding [release project](https://github.com/publiclab/image-sequencer/projects).
|
||||
* [ ] update version number in `examples/sw.js` (ex #1734) and `package.json` (ex #1695)
|
||||
* [ ] open a pull request with updated version numbers
|
||||
* [ ] update version number in `examples/sw.js` (ex #1734) and `package.json` (ex #1695)
|
||||
* [ ] update version number in `package.json`
|
||||
* [ ] run `npm install` to update `package-lock.json` (from recent node version - 16 at time of writing, in GitPod should work)
|
||||
* [ ] finalize and merge to `main` branch (freeze merges to `main` branch until next step)
|
||||
* [ ] merge, build and publish `/dist/` files to `stable` (merges to `main` branch can resume for next release)
|
||||
* [ ] create a release on GitHub and use features description + release notes from below
|
||||
* [ ] tag version number branch (i.e. `v0.0.0`)
|
||||
* [ ] publish tagged branch to `npm`
|
||||
|
||||
Now, move to `stable` branch:
|
||||
|
||||
* [ ] force push from `main` to `stable`
|
||||
* [ ] then in `stable` branch, compile `/dist/` files with `grunt build`
|
||||
* [ ] add `/dist/` files with `git add -f /dist/*` and commit them to `stable` branch
|
||||
* [ ] run `npm publish`
|
||||
|
||||
Draft a release:
|
||||
|
||||
* [ ] [create a release on GitHub](https://github.com/publiclab/image-sequencer/releases) and use features description + release notes from below
|
||||
* [ ] tag version number branch (i.e. `v0.0.0`) based on `stable` or choose `stable`
|
||||
* [ ] publish tagged branch to `npm` with `npm publish` (logging in first as necessary)
|
||||
* [ ] publish to live Github pages [demo](https://sequencer.publiclab.org) (with [bash script](https://github.com/publiclab/image-sequencer/pull/1703) from `/scripts/update-demo`) (from within GitPod works well)
|
||||
* [ ] move anything necessary to next release project, i.e. <!-- Update this link -->https://github.com/publiclab/image-sequencer/projects/[insert project number]
|
||||
* [ ] close this issue!
|
||||
|
||||
Noting we're now in this process in https://github.com/publiclab/image-sequencer/pull/1695 for `v3.6.0`.
|
||||
Noting we're now in this process in https://github.com/publiclab/image-sequencer/issues/1751 for `v3.7.0`.
|
||||
|
||||
****
|
||||
|
||||
|
||||
3
.github/PULL_REQUEST_TEMPLATE.md
vendored
3
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -5,7 +5,8 @@ Make sure these boxes are checked before your pull request (PR) is ready to be r
|
||||
* [ ] tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with `npm run test-all`
|
||||
* [ ] code is in uniquely-named feature branch and has no merge conflicts
|
||||
* [ ] PR is descriptively titled
|
||||
* [ ] ask `@publiclab/is-reviewers` for help, in a comment below
|
||||
* [ ] ask `@publiclab/is-reviewers` for help, in a comment below
|
||||
* [ ] at least 2 reviews required for getting pull request merged
|
||||
* [ ] Insert-step functionality is working correct as expected.
|
||||
> We're happy to help you get this ready -- don't be afraid to ask for help, and **don't be discouraged** if your tests fail at first!
|
||||
|
||||
|
||||
25
.github/dependabot.yml
vendored
Normal file
25
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: npm
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: daily
|
||||
open-pull-requests-limit: 10
|
||||
ignore:
|
||||
- dependency-name: jest-puppeteer
|
||||
versions:
|
||||
- 5.0.1
|
||||
- 5.0.2
|
||||
- dependency-name: geotiff
|
||||
versions:
|
||||
- 1.0.2
|
||||
- dependency-name: "@babel/core"
|
||||
versions:
|
||||
- 7.13.13
|
||||
- dependency-name: puppeteer
|
||||
versions:
|
||||
- 5.2.1
|
||||
- 7.1.0
|
||||
- dependency-name: tape
|
||||
versions:
|
||||
- 5.1.1
|
||||
21
.github/workflows/rebase.yml
vendored
Normal file
21
.github/workflows/rebase.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
name: Automatic Rebase
|
||||
# https://github.com/marketplace/actions/automatic-rebase
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
jobs:
|
||||
rebase:
|
||||
name: Rebase
|
||||
if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout the latest code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
|
||||
- name: Automatic Rebase
|
||||
uses: cirrus-actions/rebase@1.4
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -30,19 +30,24 @@ RUN sudo apt-get update && apt-get install -y apt-transport-https \
|
||||
libatk1.0-0 \
|
||||
libc6 \
|
||||
libcairo2 \
|
||||
libcairo2-dev \
|
||||
libcups2 \
|
||||
libdbus-1-3 \
|
||||
libexpat1 \
|
||||
libfontconfig1 \
|
||||
libgbm1 \
|
||||
libgcc1 \
|
||||
libgif-dev \
|
||||
libglib2.0-0 \
|
||||
libgtk-3-0 \
|
||||
libjpeg-dev \
|
||||
libnspr4 \
|
||||
libnss3 \
|
||||
libpango-1.0-0 \
|
||||
libpango1.0-dev \
|
||||
libpangocairo-1.0-0 \
|
||||
libstdc++6 \
|
||||
librsvg2-dev \
|
||||
libx11-6 \
|
||||
libx11-xcb1 \
|
||||
libxcb1 \
|
||||
|
||||
50049
dist/image-sequencer-ui.js
vendored
Normal file
50049
dist/image-sequencer-ui.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
dist/image-sequencer-ui.min.js
vendored
Normal file
1
dist/image-sequencer-ui.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
133981
dist/image-sequencer.js
vendored
Normal file
133981
dist/image-sequencer.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/image-sequencer.min.js
vendored
Normal file
1
dist/image-sequencer.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -41,11 +41,12 @@ List of Module Documentations
|
||||
36. [Rotate](#rotate-module)
|
||||
37. [Saturation](#saturation-module)
|
||||
38. [Segmented-Colormap](#segmented-colormap-module)
|
||||
39. [Text-Overlay](#text-overlay)
|
||||
40. [Threshold](#threshold)
|
||||
41. [Tint](#tint)
|
||||
42. [WebGL-Distort](#webgl-distort-module)
|
||||
43. [White-Balance](#white-balance-module)
|
||||
39. [Sharpen](#sharpening-module)
|
||||
40. [Text-Overlay](#text-overlay)
|
||||
41. [Threshold](#threshold)
|
||||
42. [Tint](#tint)
|
||||
43. [WebGL-Distort](#webgl-distort-module)
|
||||
44. [White-Balance](#white-balance-module)
|
||||
|
||||
|
||||
## add-qr-module
|
||||
@@ -667,6 +668,20 @@ where `options` is an object with the property `colormap`. `options.colormap` ca
|
||||
* A custom array.
|
||||
|
||||
|
||||
## sharpen-module
|
||||
|
||||
This module is used to sharpen the pixels of the image using a 3x3 convolution filter.
|
||||
#### Usage
|
||||
|
||||
```js
|
||||
sequencer.loadImage('PATH')
|
||||
.addSteps('sharpen',options)
|
||||
.run()
|
||||
```
|
||||
|
||||
where `options` is an object with the property `sharpenStrength`, which can be set to achieve the desired level of sharpening on the image.
|
||||
|
||||
|
||||
## Text Overlay
|
||||
|
||||
The modules allows to add text to image in both browser and node environment. We have the options to modify the font-size and also support few font-styles. The text color can also be modified.
|
||||
|
||||
@@ -172,8 +172,8 @@ body > .container-fluid {
|
||||
|
||||
#move-up {
|
||||
position: fixed;
|
||||
bottom: 50px;
|
||||
right: 40px;
|
||||
bottom: 30px;
|
||||
right: 20px;
|
||||
z-index: 550;
|
||||
display: none;
|
||||
background:transparent;
|
||||
@@ -181,11 +181,17 @@ body > .container-fluid {
|
||||
}
|
||||
|
||||
#move-up i {
|
||||
font-size:60px;
|
||||
font-size:50px;
|
||||
opacity:0.7;
|
||||
color:#BABABA;
|
||||
}
|
||||
|
||||
@media (max-width: 768px), (max-height 700px) {
|
||||
#move-up {
|
||||
display: none !important; /* !important is used to override the jQuery style */
|
||||
}
|
||||
}
|
||||
|
||||
.btn-circle{
|
||||
min-width: 80px;
|
||||
min-height: 80px;
|
||||
|
||||
@@ -17,7 +17,6 @@ function DefaultHtmlSequencerUi(_sequencer, options) {
|
||||
// look up needed steps from Url Hash:
|
||||
function importStepsFromUrlHash() {
|
||||
var hash = urlHash.getUrlHashParameter('steps');
|
||||
|
||||
if (hash) {
|
||||
_sequencer.importString(hash);
|
||||
_sequencer.run({ index: 0 });
|
||||
@@ -27,8 +26,7 @@ function DefaultHtmlSequencerUi(_sequencer, options) {
|
||||
|
||||
function selectNewStepUi() {
|
||||
var m = $(addStepSel + ' select').val();
|
||||
if(!m) m = arguments[0];
|
||||
else $(addStepSel + ' .info').html(_sequencer.modulesInfo(m).description);
|
||||
if(m) $(addStepSel + ' .info').html(_sequencer.modulesInfo(m).description);
|
||||
$(addStepSel + ' #add-step-btn').prop('disabled', false);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const staticCacheName = 'image-sequencer-static-v3.6.0';
|
||||
const staticCacheName = 'image-sequencer-static-v3.7.1';
|
||||
self.addEventListener('install', function(e) {
|
||||
e.waitUntil(
|
||||
caches.open(staticCacheName).then(function(cache) {
|
||||
@@ -38,19 +38,19 @@ self.addEventListener('fetch', function(event) {
|
||||
cache.put(event.request.url, response.clone());
|
||||
}
|
||||
return response;
|
||||
})
|
||||
});
|
||||
})
|
||||
.catch(function(err) {
|
||||
// Now the request has been failed so show cached data.
|
||||
return caches.match(event.request).then(function(res){
|
||||
if (res === undefined) {
|
||||
if (res === undefined) {
|
||||
// Display offline page
|
||||
return caches.match('offline.html');
|
||||
}
|
||||
return res;
|
||||
});
|
||||
})
|
||||
)
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
// When the update modal sends a 'skipWaiting' message, call the skipWaiting method.
|
||||
|
||||
34630
package-lock.json
generated
34630
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
29
package.json
29
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "image-sequencer",
|
||||
"version": "3.6.0",
|
||||
"version": "3.7.1",
|
||||
"description": "A modular JavaScript image manipulation library modeled on a storyboard.",
|
||||
"main": "src/ImageSequencer.js",
|
||||
"scripts": {
|
||||
@@ -41,11 +41,11 @@
|
||||
"bootstrap": "^3.4.1",
|
||||
"bootstrap-colorpicker": "^2.5.3",
|
||||
"buffer": "~6.0.2",
|
||||
"commander": "^7.0.0",
|
||||
"commander": "^8.0.0",
|
||||
"compressorjs": "^1.0.5",
|
||||
"data-uri-to-buffer": "^3.0.0",
|
||||
"downloadjs": "^1.4.7",
|
||||
"eslint": "^6.1.0",
|
||||
"eslint": "^8.0.0",
|
||||
"expr-eval": "^2.0.2",
|
||||
"fisheyegl": "^0.1.2",
|
||||
"font-awesome": "~4.7.0",
|
||||
@@ -54,17 +54,17 @@
|
||||
"gifshot": "^0.4.5",
|
||||
"glfx": "0.0.4",
|
||||
"gpu.js": "^2.3.1",
|
||||
"imgareaselect": "git+https://git@github.com/jywarren/imgareaselect.git#v1.0.0-rc.2",
|
||||
"image-sequencer-invert": "^1.0.0",
|
||||
"imagejs": "0.0.9",
|
||||
"imagemin": "^7.0.1",
|
||||
"imagemin-jpegtran": "^7.0.0",
|
||||
"imagemin-pngquant": "^9.0.1",
|
||||
"imgareaselect": "git://github.com/jywarren/imgareaselect.git#v1.0.0-rc.2",
|
||||
"istanbul": "^0.4.5",
|
||||
"jasmine": "^3.4.0",
|
||||
"jpegtran-bin": "^5.0.2",
|
||||
"jpegtran-bin": "^6.0.1",
|
||||
"jquery": "^3.3.1",
|
||||
"jsdom": "^16.3.0",
|
||||
"jsdom": "^19.0.0",
|
||||
"jspdf": "^2.1.1",
|
||||
"jsqr": "^1.1.1",
|
||||
"lodash": "^4.17.11",
|
||||
@@ -88,29 +88,30 @@
|
||||
"@babel/plugin-syntax-object-rest-spread": "^7.2.0",
|
||||
"babelify": "^10.0.0",
|
||||
"browserify": "17.0.0",
|
||||
"eslint": "^6.1.0",
|
||||
"canvas": "^2.8.0",
|
||||
"eslint": "^8.0.0",
|
||||
"grunt": "^1.0.3",
|
||||
"grunt-browser-sync": "^2.2.0",
|
||||
"grunt-browserify": "^5.0.0",
|
||||
"grunt-contrib-concat": "^1.0.1",
|
||||
"grunt-contrib-concat": "^2.0.0",
|
||||
"grunt-contrib-uglify-es": "^3.3.0",
|
||||
"grunt-contrib-watch": "^1.1.0",
|
||||
"grunt-text-replace": "^0.4.0",
|
||||
"husky": "^3.0.5",
|
||||
"husky": "^7.0.0",
|
||||
"image-filter-core": "~2.0.2",
|
||||
"image-filter-threshold": "~2.0.1",
|
||||
"jasmine-core": "^3.3.0",
|
||||
"jasmine-jquery": "^2.1.1",
|
||||
"jasmine-spec-reporter": "^6.0.0",
|
||||
"jest": "^26.1.0",
|
||||
"jest-puppeteer": "^4.3.0",
|
||||
"lint-staged": "^10.0.3",
|
||||
"jasmine-spec-reporter": "^7.0.0",
|
||||
"jest": "^27.0.1",
|
||||
"jest-puppeteer": "^6.0.0",
|
||||
"lint-staged": "^12.1.3",
|
||||
"looks-same": "^7.0.0",
|
||||
"matchdep": "^2.0.0",
|
||||
"resemblejs": "^3.2.5",
|
||||
"tap-spec": "^5.0.0",
|
||||
"tape": "^5.2.0",
|
||||
"tape-run": "^8.0.0",
|
||||
"tape-run": "^9.0.0",
|
||||
"uglify-es": "^3.3.7"
|
||||
},
|
||||
"husky": {
|
||||
|
||||
@@ -46,6 +46,7 @@ module.exports = {
|
||||
'rotate': require('./modules/Rotate'),
|
||||
'saturation': require('./modules/Saturation'),
|
||||
'shadow': require('./modules/Shadow'),
|
||||
'sharpen': require('./modules/Sharpen'),
|
||||
'text-overlay': require('./modules/TextOverlay'),
|
||||
'threshold': require('./modules/Threshold'),
|
||||
'tint': require('./modules/Tint'),
|
||||
|
||||
46
src/modules/Sharpen/Module.js
Normal file
46
src/modules/Sharpen/Module.js
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
Sharpen an image
|
||||
*/
|
||||
module.exports = function Sharpen(options, UI) {
|
||||
|
||||
let defaults = require('./../../util/getDefaults.js')(require('./info.json'));
|
||||
options.sharpenStrength = options.sharpenStrength || defaults.sharpenStrength;
|
||||
options.sharpenStrength = parseFloat(options.sharpenStrength); //returns a float
|
||||
let output;
|
||||
|
||||
function draw(input, callback, progressObj) {
|
||||
|
||||
progressObj.stop(true);
|
||||
progressObj.overrideFlag = true;
|
||||
|
||||
let step = this;
|
||||
|
||||
function extraManipulation(pixels) {
|
||||
pixels = require('./Sharpen')(pixels, options.sharpenStrength);
|
||||
return (pixels);
|
||||
}
|
||||
|
||||
function output(image, datauri, mimetype, wasmSuccess) {
|
||||
step.output = { src: datauri, format: mimetype, wasmSuccess, useWasm: options.useWasm };
|
||||
}
|
||||
|
||||
return require('../_nomodule/PixelManipulation.js')(input, {
|
||||
output: output,
|
||||
ui: options.step.ui,
|
||||
inBrowser: options.inBrowser,
|
||||
extraManipulation: extraManipulation,
|
||||
format: input.format,
|
||||
image: options.image,
|
||||
callback: callback,
|
||||
useWasm:options.useWasm
|
||||
});
|
||||
|
||||
}
|
||||
return {
|
||||
options: options,
|
||||
draw: draw,
|
||||
output: output,
|
||||
UI: UI
|
||||
};
|
||||
};
|
||||
|
||||
48
src/modules/Sharpen/Sharpen.js
Normal file
48
src/modules/Sharpen/Sharpen.js
Normal file
@@ -0,0 +1,48 @@
|
||||
// Generates a 3x3 convolution sharpening kernel
|
||||
function kernelGenerator(strength = 1) { //default value of sharpeningStrength set to 1
|
||||
|
||||
let kernel = [
|
||||
[0, -1 * strength, 0],
|
||||
[-1 * strength, 5 * strength, -1 * strength],
|
||||
[0, -1 * strength, 0]
|
||||
];
|
||||
return kernel;
|
||||
}
|
||||
|
||||
module.exports = exports = function(pixels, sharpen) {
|
||||
const pixelSetter = require('../../util/pixelSetter.js');
|
||||
|
||||
let kernel = kernelGenerator(sharpen), // Generate the kernel based on the strength input.
|
||||
pixs = { // Separates the rgb channel pixels to convolve on the GPU.
|
||||
r: [],
|
||||
g: [],
|
||||
b: [],
|
||||
};
|
||||
for (let y = 0; y < pixels.shape[1]; y++){
|
||||
pixs.r.push([]);
|
||||
pixs.g.push([]);
|
||||
pixs.b.push([]);
|
||||
|
||||
for (let x = 0; x < pixels.shape[0]; x++){
|
||||
pixs.r[y].push(pixels.get(x, y, 0));
|
||||
pixs.g[y].push(pixels.get(x, y, 1));
|
||||
pixs.b[y].push(pixels.get(x, y, 2));
|
||||
}
|
||||
}
|
||||
|
||||
const convolve = require('../_nomodule/gpuUtils').convolve; // GPU convolution function.
|
||||
|
||||
const conPix = convolve([pixs.r, pixs.g, pixs.b], kernel); // Convolves the pixels (all channels separately) on the GPU.
|
||||
|
||||
for (let y = 0; y < pixels.shape[1]; y++){
|
||||
for (let x = 0; x < pixels.shape[0]; x++){
|
||||
var pixelvalue = [Math.max(0, Math.min(conPix[0][y][x], 255)),
|
||||
Math.max(0, Math.min(conPix[1][y][x], 255)),
|
||||
Math.max(0, Math.min(conPix[2][y][x], 255))];
|
||||
|
||||
pixelSetter(x, y, pixelvalue, pixels); // Sets the image pixels according to the sharpened values.
|
||||
|
||||
}
|
||||
}
|
||||
return (pixels);
|
||||
};
|
||||
4
src/modules/Sharpen/index.js
Normal file
4
src/modules/Sharpen/index.js
Normal file
@@ -0,0 +1,4 @@
|
||||
module.exports = [
|
||||
require('./Module'),
|
||||
require('./info.json')
|
||||
];
|
||||
15
src/modules/Sharpen/info.json
Normal file
15
src/modules/Sharpen/info.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "sharpen",
|
||||
"description": "Applies a sharpening filter given by the intensity value",
|
||||
"inputs": {
|
||||
"sharpenStrength": {
|
||||
"type": "float",
|
||||
"desc": "Amount of sharpening (More sharpening gives more detail, but may lead to overexposure)",
|
||||
"default": 1,
|
||||
"min": 1,
|
||||
"max": 1.5,
|
||||
"step": 0.05
|
||||
}
|
||||
},
|
||||
"docs-link":"https://github.com/publiclab/image-sequencer/blob/main/docs/MODULES.md#sharpen-module"
|
||||
}
|
||||
2
test/core/images/moon.js
Normal file
2
test/core/images/moon.js
Normal file
@@ -0,0 +1,2 @@
|
||||
module.exports = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABTmlDQ1BpY2MAACiRY2BgUkksKMhhYWBgyM0rKQpyd1KIiIxSYH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jM4OjIxKzAwOjAw3y/n5QAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMS0wMy0yMFQwMTozODoyMSswMDowMK5yX1kAAAARdEVYdGV4aWY6Q29sb3JTcGFjZQAxD5sCSQAAACd0RVh0ZXhpZjpDb21wb25lbnRzQ29uZmlndXJhdGlvbgAxLCAyLCAzLCAwVaQjvwAAABN0RVh0ZXhpZjpFeGlmT2Zmc2V0ADEwMnNCKacAAAAfdEVYdGV4aWY6RXhpZlZlcnNpb24ANDgsIDUwLCA1MCwgNDlj1An4AAAAI3RFWHRleGlmOkZsYXNoUGl4VmVyc2lvbgA0OCwgNDksIDQ4LCA0OO/ZB2sAAAAYdEVYdGV4aWY6UGl4ZWxYRGltZW5zaW9uADY2MBUn8W4AAAAYdEVYdGV4aWY6UGl4ZWxZRGltZW5zaW9uADY4MBarPZYAAAAXdEVYdGV4aWY6U2NlbmVDYXB0dXJlVHlwZQAwIrQxYwAAAFx0RVh0ZXhpZjpVc2VyQ29tbWVudAA2NSwgODMsIDY3LCA3MywgNzMsIDAsIDAsIDAsIDgzLCA5OSwgMTE0LCAxMDEsIDEwMSwgMTEwLCAxMTUsIDEwNCwgMTExLCAxMTZAuB9yAAAAF3RFWHRleGlmOllDYkNyUG9zaXRpb25pbmcAMawPgGMAAAAodEVYdGljYzpjb3B5cmlnaHQAQ29weXJpZ2h0IEFwcGxlIEluYy4sIDIwMTe/8xjQAAAAGnRFWHRpY2M6ZGVzY3JpcHRpb24ARGlzcGxheSBQM495u7wAAAAASUVORK5CYII=';
|
||||
//base64 of original unmodified image
|
||||
14
test/core/modules/sharpen.js
Normal file
14
test/core/modules/sharpen.js
Normal file
@@ -0,0 +1,14 @@
|
||||
const testModule = require('../templates/module-test'),
|
||||
image = require('../images/moon'),
|
||||
benchmark = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAklEQVR4AewaftIAAAJZSURBVH3BPUvrUACA4bfnJETsoIIV6qBFC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pNEAQopUin0/yPJYTwWq0WmlKKpz9PGIbB0tISl5eXNJtNWq0WNjYREZ+ZtD0+PlKr1ZienkYIgRCCnZ0dDMtCCwj4ihmGIVo2m6VQKHB8fMzt7S1TU1PMz8/ze3GRRFoIPhPEir+KaD09PeTzeTo6OqjX61xfX5PNZnFdl3K5zN8wRAhBGIYkTGLLP5fRZmdnyWQy3NzccH9/j+/7DA8Pc3BwwOTkJFoYhnxkEhv9MYq2traGNjExwcjICHNzcxQKBSqVCjMzM3R2dqJZlkXCJPZcf0bL5XK8vb0xMDCA7/to1WqVw8NDzs/P2dzcRIuiCCEEmgV4xDzPo9FocHp6ytnZGWNjY1SrVU5OTlhfX0dKycXFBUNDQ9zd3fH+/o5mdnd3k9jY2GB3d5ft7W20/v5+FhYWuLq6oq+vj3w+j+/7fGRJKT1ipVIJz/PQBgcHSaVSaKlUit7eXnK5HK7rsr+/z8PDAwkDUI7jIKVEU0qRyGQyvL6+opSiUqlQLBZZXV2l2WyysrKCZgCKWFdXF41GA00pxVfK5TKu62IYBppt2xiAok0IQRiGfLS3t0etVuPl5YWjoyM++wcQzOdOsGwgXgAAAABJRU5ErkJggg==',
|
||||
option = {
|
||||
sharpenStrength: 1.0
|
||||
},
|
||||
option1 = {
|
||||
sharpenStrength: 1.5
|
||||
},
|
||||
optionsTest = require('../templates/options-test');
|
||||
|
||||
optionsTest('sharpen', [option, option1], [benchmark, benchmark1], image);
|
||||
testModule('sharpen', option, benchmark, image);
|
||||
Reference in New Issue
Block a user