-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from JuliaWTF/tgf/glitch_file
Glitch file directly
- Loading branch information
Showing
7 changed files
with
134 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Run tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
# needed to allow julia-actions/cache to delete old caches that it has created | ||
permissions: | ||
actions: write | ||
contents: read | ||
|
||
jobs: | ||
test: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
julia-version: ['1.9', '1', 'nightly'] | ||
julia-arch: | ||
- x64 | ||
os: [ubuntu-latest, windows-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: ${{ matrix.julia-version }} | ||
arch: ${{ matrix.julia-arch }} | ||
- uses: julia-actions/cache@v1 | ||
- uses: julia-actions/julia-buildpkg@v1 | ||
- uses: julia-actions/julia-runtest@v1 | ||
# with: | ||
# annotate: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,23 @@ | ||
name = "JpegGlitcher" | ||
uuid = "7e1ea31b-b9a5-4cc0-940e-7c5f7cd080d6" | ||
authors = ["Théo Galy-Fajou <[email protected]> and contributors"] | ||
version = "1.0.0" | ||
authors = [ | ||
"JuliaWTF, Théo Galy-Fajou <[email protected]> and contributors", | ||
] | ||
version = "1.1.0" | ||
|
||
[deps] | ||
JpegTurbo = "b835a17e-a41a-41e7-81f0-2f016b05efe0" | ||
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" | ||
|
||
[weakdeps] | ||
ImageIO = "82e4d734-157c-48bb-816b-45c225c6df19" | ||
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" | ||
|
||
[extensions] | ||
JpegGlitcherImageIOExt = ["ImageIO", "FileIO"] | ||
|
||
[compat] | ||
julia = "1.6" | ||
JpegTurbo = "0.1" | ||
FileIO = "1" | ||
ImageIO = "0.6" | ||
JpegTurbo = "0.1" | ||
julia = "1.9" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module JpegGlitcherImageIOExt | ||
|
||
using ImageIO | ||
using FileIO | ||
using JpegGlitcher | ||
using Random: AbstractRNG, default_rng | ||
|
||
""" | ||
glitch(file_in::AbstractString, file_out::AbstractString = auto_glitch_name(file_in); rng::AbstractRNG=default_rng(), nflips::Integer=10, quality::Integer=100) | ||
Glitch image from `file_in` and write the output in `file_out`. | ||
See other method signature for keyword usage. | ||
""" | ||
function JpegGlitcher.glitch( | ||
file_in::AbstractString, | ||
file_out::AbstractString=auto_glitch_name(file_in); | ||
rng::AbstractRNG=default_rng(), | ||
n::Integer=10, | ||
quality::Integer=100, | ||
) | ||
img = FileIO.load(file_in) | ||
glitched_img = glitch(img; rng, n, quality) | ||
FileIO.save(file_out, glitched_img) | ||
end | ||
|
||
"Automatically append `_glitched` to the original file name." | ||
function auto_glitch_name(path::String) | ||
path, ext = splitext(path) | ||
string(path, "_glitched", ext) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,10 @@ | ||
[deps] | ||
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" | ||
ImageIO = "82e4d734-157c-48bb-816b-45c225c6df19" | ||
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
TestImages = "5e47fb64-e119-507b-a336-dd2b206d9990" | ||
|
||
[compat] | ||
FileIO = "1" | ||
ImageIO = "0.6" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a39ebc2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
a39ebc2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error while trying to register: Changing package repo URL not allowed, please submit a pull request with the URL change to the target registry and retry.
a39ebc2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
a39ebc2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/111009
Tip: Release Notes
Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.
To add them here just re-invoke and the PR will be updated.
Tagging
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: