Skip to content

Commit

Permalink
Switch from using the convert command to magick.
Browse files Browse the repository at this point in the history
The `convert` command is deprecated by ImageMagick, and `magick` has been available since 8 years.

Resolves: #87
  • Loading branch information
lgarron committed May 29, 2024
1 parent 229f0ec commit 0eee55a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ python3 -m folderify --macOS 10.5 path/to/icon.png

## Other installation options

If you don't have Homebrew but you already have ImageMagick (the `convert`
If you don't have Homebrew but you already have ImageMagick (the `magick`
binary) on your system, you can use the following:

### Install using Rust
Expand Down Expand Up @@ -109,7 +109,7 @@ You should see a bunch of new `.iconset` folders and `.icns` files that were aut

### Dependencies

- [ImageMagick](https://www.imagemagick.org/) - for image processing (you should be able to run <code>convert</code> and <code>identify</code> on the commandline).
- [ImageMagick](https://www.imagemagick.org/) - for image processing (you should be able to run `magick` and `identify` on the commandline).
- Included with macOS:
- `iconutil`
- Optional:
Expand Down
8 changes: 4 additions & 4 deletions src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ use std::process::Command;
use std::process::Stdio;
use std::str::from_utf8;

use crate::convert::CommandArgs;
use crate::error::CommandFailedError;
use crate::error::CommandInvalidError;
use crate::error::FolderifyError;
use crate::error::GeneralError;
use crate::magick::CommandArgs;

const DEBUG_PRINT_ARGS: bool = false;

const CONVERT_COMMAND: &str = "convert";
const MAGICK_COMMAND: &str = "magick";
const IDENTIFY_COMMAND: &str = "identify";
pub(crate) const ICONUTIL_COMMAND: &str = "iconutil";
pub(crate) const OPEN_COMMAND: &str = "open";
Expand Down Expand Up @@ -77,8 +77,8 @@ pub(crate) fn run_command(
Ok(output.stdout)
}

pub(crate) fn run_convert(args: &CommandArgs, stdin: Option<&[u8]>) -> Result<(), FolderifyError> {
run_command(CONVERT_COMMAND, args, stdin)?;
pub(crate) fn run_magick(args: &CommandArgs, stdin: Option<&[u8]>) -> Result<(), FolderifyError> {
run_command(MAGICK_COMMAND, args, stdin)?;
Ok(())
}

Expand Down
14 changes: 7 additions & 7 deletions src/icon_conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ impl ProgressBarType {

use crate::{
command::{
run_command, run_convert, DEREZ_COMMAND, FILEICON_COMMAND, ICONUTIL_COMMAND,
run_command, run_magick, DEREZ_COMMAND, FILEICON_COMMAND, ICONUTIL_COMMAND,
OSASCRIPT_COMMAND, REZ_COMMAND, SETFILE_COMMAND, SIPS_COMMAND,
},
convert::{density, BlurDown, CommandArgs, CompositingOperation},
error::{FolderifyError, GeneralError},
magick::{density, BlurDown, CommandArgs, CompositingOperation},
options::{Badge, ColorScheme, Options, SetIconUsing},
primitives::{Dimensions, Extent, Offset, RGBColor},
resources::{get_badge_icon, get_folder_icon},
Expand Down Expand Up @@ -308,7 +308,7 @@ impl IconConversion {
args.extent(&Extent::no_offset(centering_dimensions));
let output_path = self.output_path("0.0_FULL_MASK.png");
args.push_path(&output_path);
run_convert(&args, None)?;
run_magick(&args, None)?;
self.step("");
Ok(output_path)
}
Expand All @@ -329,7 +329,7 @@ impl IconConversion {
});
let output_path = self.output_path("1.0_SIZED_MASK.png");
args.push_path(&output_path);
run_convert(&args, None)?;
run_magick(&args, None)?;
Ok(output_path)
}

Expand All @@ -345,7 +345,7 @@ impl IconConversion {
let file_name = format!("{}.png", output_filename);
let output_path = self.output_path(&file_name);
args.push_path(&output_path);
run_convert(&args, None)?;
run_magick(&args, None)?;
Ok(output_path)
}

Expand Down Expand Up @@ -462,7 +462,7 @@ impl IconConversion {
args.push_path(&top_bezel);
args.composite(&CompositingOperation::dissolve);
args.push_path(output_path);
run_convert(&args, Some(template_icon))?;
run_magick(&args, Some(template_icon))?;
Ok(())
}

Expand All @@ -481,7 +481,7 @@ impl IconConversion {
args.push("-");
args.composite(&CompositingOperation::dissolve);
args.push_path(icon_path);
run_convert(&args, Some(badge_icon))
run_magick(&args, Some(badge_icon))
}

// TODO
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
use std::thread::{self, JoinHandle};

use command::{run_command, OPEN_COMMAND};
use convert::CommandArgs;
use icon_conversion::{IconInputs, IconResolution, WorkingDir};
use indicatif::MultiProgress;
use magick::CommandArgs;

use crate::{output_paths::PotentialOutputPaths, primitives::Dimensions};

mod command;
mod convert;
mod error;
mod icon_conversion;
mod magick;
mod options;
mod output_paths;
mod primitives;
Expand Down

0 comments on commit 0eee55a

Please sign in to comment.