Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Crunch
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Microhacks
Crunch
Commits
790e2812
Verified
Commit
790e2812
authored
2 years ago
by
Louis
Browse files
Options
Downloads
Patches
Plain Diff
Re-enable palette command
parent
b2934963
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Cargo.toml
+1
-1
1 addition, 1 deletion
Cargo.toml
src/cli_args.rs
+14
-14
14 additions, 14 deletions
src/cli_args.rs
with
15 additions
and
15 deletions
Cargo.toml
+
1
−
1
View file @
790e2812
[package]
[package]
name
=
"crunch-cli"
name
=
"crunch-cli"
version
=
"0.5.
1"
version
=
"0.5.
2
edition
=
"2021"
edition
=
"2021"
homepage
=
"https://microhacks.lcr.app/crunch/"
homepage
=
"https://microhacks.lcr.app/crunch/"
...
...
This diff is collapsed.
Click to expand it.
src/cli_args.rs
+
14
−
14
View file @
790e2812
...
@@ -80,20 +80,20 @@ impl Args {
...
@@ -80,20 +80,20 @@ impl Args {
.save_with_format
(
&
flip
.output
,
ImageFormat
::
Png
)
.save_with_format
(
&
flip
.output
,
ImageFormat
::
Png
)
.map_err
(
anyhow
::
Error
::
from
)
.map_err
(
anyhow
::
Error
::
from
)
}
}
//
Args::Remap(remap) => {
Args
::
Remap
(
remap
)
=>
{
//
let image_data = load_image(&remap.input, None)?;
let
image_data
=
load_image
(
&
remap
.input
,
None
)
?
;
//
let palette_data = load_image(&remap.palette, None)?;
let
palette_data
=
load_image
(
&
remap
.palette
,
None
)
?
;
//
//
let image_palette = Palette::extract_from(&image_data)?;
let
image_palette
=
Palette
::
extract_from
(
&
image_data
)
?
;
//
let target_palette = Palette::extract_from(&palette_data)?;
let
target_palette
=
Palette
::
extract_from
(
&
palette_data
)
?
;
//
//
let mappings = Palette::calculate_mapping(&image_palette, &target_palette);
let
mappings
=
Palette
::
calculate_mapping
(
&
image_palette
,
&
target_palette
);
//
let output = Remap::remap_image(image_data, mappings)?;
let
output
=
Remap
::
remap_image
(
image_data
,
mappings
)
?
;
//
//
output
output
//
.save_with_format(&remap.output, ImageFormat::Png)
.save_with_format
(
&
remap
.output
,
ImageFormat
::
Png
)
//
.map_err(anyhow::Error::from)
.map_err
(
anyhow
::
Error
::
from
)
//
}
}
Args
::
Reduce
(
reduce
)
=>
{
Args
::
Reduce
(
reduce
)
=>
{
if
let
Some
(
amount
)
=
reduce
.colours
{
if
let
Some
(
amount
)
=
reduce
.colours
{
log
::
info!
(
"Num cols {}"
,
amount
);
log
::
info!
(
"Num cols {}"
,
amount
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment