Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
a91b404
Slight changes to CI
ivanbgd Sep 28, 2025
10d9e0d
Slight changes to CI
ivanbgd Sep 28, 2025
d82c144
Add audit.yml GitHub action
ivanbgd Sep 28, 2025
fe7424a
Modify audit.yml - give it read permission
ivanbgd Sep 28, 2025
b5d1966
Modify audit.yml - give it only write permission
ivanbgd Sep 28, 2025
df41ad4
Modify audit.yml - give it only read permission
ivanbgd Sep 28, 2025
01631fe
Modify audit.yml - give it only write permission
ivanbgd Sep 28, 2025
ffe22cc
Modify audit.yml
ivanbgd Sep 28, 2025
548568c
Modify audit.yml
ivanbgd Sep 28, 2025
a174b86
Modify audit.yml
ivanbgd Sep 28, 2025
a4d9bac
Modify audit.yml
ivanbgd Sep 28, 2025
686a26b
Modify audit.yml
ivanbgd Sep 28, 2025
77e7574
Modify audit.yml
ivanbgd Sep 28, 2025
c0e4228
Modify audit.yml
ivanbgd Sep 28, 2025
be26d13
Modify audit.yml
ivanbgd Sep 28, 2025
d334240
Include deny.toml
ivanbgd Sep 28, 2025
3a10c59
Modify audit.yml
ivanbgd Sep 28, 2025
3fbfc32
Modify audit.yml
ivanbgd Sep 28, 2025
cac2d11
Modify audit.yml
ivanbgd Sep 28, 2025
d0ac04b
Modify audit.yml
ivanbgd Sep 28, 2025
d8adf6a
Modify ci.yml
ivanbgd Sep 28, 2025
f44f446
Modify ci.yml
ivanbgd Sep 28, 2025
cb370c2
Add audit.toml
ivanbgd Sep 28, 2025
baa3218
Edit ci
ivanbgd Sep 28, 2025
1995a31
Edit ci
ivanbgd Sep 28, 2025
4d0d217
Edit ci
ivanbgd Sep 28, 2025
b720122
Edit ci
ivanbgd Sep 28, 2025
b3a7190
Edit ci
ivanbgd Sep 28, 2025
bcd2602
Edit ci
ivanbgd Sep 28, 2025
7872b39
Edit ci
ivanbgd Sep 28, 2025
ea395f2
Edit ci
ivanbgd Sep 28, 2025
af8daaa
Edit ci
ivanbgd Sep 28, 2025
5257d2d
Edit ci
ivanbgd Sep 28, 2025
b92d855
Add .pre-commit-config.yaml
ivanbgd Sep 28, 2025
53eb1fa
Edit .pre-commit-config.yaml
ivanbgd Sep 28, 2025
dd6a57c
Update CHANGELOG.md & README.md
ivanbgd Sep 28, 2025
0a84897
Update README.md
ivanbgd Sep 28, 2025
72689d6
Update README.md
ivanbgd Sep 28, 2025
115eeea
Update README.md & hooks
ivanbgd Sep 28, 2025
2a4cfa7
Add `audit.yml` GitHub action, modify `ci.yml`, add `.pre-commit-conf…
ivanbgd Sep 30, 2025
6517e8c
Add `audit.yml` GitHub action, modify `ci.yml`, add `.pre-commit-conf…
ivanbgd Sep 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .cargo/audit.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[advisories]
ignore = [
# Warning: unmaintained
# Title: paste - no longer maintained
"RUSTSEC-2024-0436",
]

[output]
quiet = false
deny = ["warnings", "unmaintained"]
47 changes: 47 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Security audit

on:
push:
paths:
- "**/Cargo.lock"
- "**/Cargo.toml"
- "**/deny.toml"
pull_request:
types: [ opened, reopened, synchronize ]
branches:
- main
# schedule:
# - cron: "0 0 * * *"

jobs:

audit-check:
name: Audit check
runs-on: ubuntu-latest
permissions:
issues: write
checks: write
steps:
- uses: actions/checkout@v5
- uses: rustsec/audit-check@v2.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}

cargo-deny:
name: Cargo deny
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: EmbarkStudios/cargo-deny-action@v2
with:
rust-version: "1.89.0"
log-level: warn
command: check
arguments: --all-features

audit-success:
name: Audit success
runs-on: ubuntu-latest
needs: [audit-check, cargo-deny]
steps:
- run: echo "All audit jobs successfully finished."
82 changes: 59 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: CI

on:
push:
branches:
- "*"
pull_request:
types: [ opened, reopened, synchronize ]
branches:
Expand All @@ -18,26 +20,18 @@ permissions:
# Each job runs in a runner environment specified by `runs-on`.
jobs:

test:
name: Test
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: ilammy/setup-nasm@v1

- name: Check out repository code
uses: actions/checkout@v5

# This GitHub Action installs a Rust toolchain using "rustup".
# It is designed for one-line concise usage and good defaults.
- name: Install the Rust toolchain
uses: dtolnay/rust-toolchain@stable

# A GitHub Action that implements smart caching for rust/cargo projects with sensible defaults.
- name: Rust Cache Action
uses: Swatinem/rust-cache@v2

- name: Run tests
run: cargo test
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- name: Linting
run: cargo clippy --all-targets --all-features -- -D warnings

fmt:
name: Format
Expand All @@ -47,18 +41,60 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- uses: Swatinem/rust-cache@v2
- name: Enforce formatting
run: cargo fmt --check
run: cargo fmt --all -- --check --color always

clippy:
name: Clippy
msrv:
name: MSRV check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: ilammy/setup-nasm@v1
- uses: dtolnay/rust-toolchain@stable
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.89.0
components: clippy
- run: cargo fetch
- name: MSRV check with cargo clippy
run: cargo clippy --all-targets --all-features -- -D warnings

publish-check:
name: Publish check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: ilammy/setup-nasm@v1
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Linting
run: cargo clippy -- -D warnings
- run: cargo fetch
- name: cargo publish dry run
run: cargo publish --dry-run

test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v5

- uses: ilammy/setup-nasm@v1

# This GitHub Action installs a Rust toolchain using "rustup".
# It is designed for one-line concise usage and good defaults.
- name: Install the Rust toolchain
uses: dtolnay/rust-toolchain@stable

# A GitHub Action that implements smart caching for rust/cargo projects with sensible defaults.
- name: Rust Cache Action
uses: Swatinem/rust-cache@v2

- name: Run tests
run: cargo test --all --all-targets

ci-success:
name: CI success
runs-on: ubuntu-latest
needs: [clippy, fmt, msrv, publish-check, test]
steps:
- run: echo "All CI jobs successfully finished."
47 changes: 47 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
repos:

- repo: local
hooks:
- id: check
name: check
description: Standard check
entry: cargo check
language: system
types: [ rust ]
pass_filenames: false

- id: clippy
name: clippy
description: More rigorous check
entry: cargo clippy --all-targets --all-features -- -D warnings
language: rust
pass_filenames: false

- id: rustfmt
name: rustfmt
description: Check if all files follow the rustfmt style
entry: cargo fmt --all -- --check --color always
language: rust
types: [ rust ]
pass_filenames: false

- id: test
name: test
description: Run tests
entry: cargo test --all --all-targets
language: rust
types: [ rust ]
pass_filenames: false

- repo: https://github.com/EmbarkStudios/cargo-deny
rev: 0.18.5
hooks:
- id: cargo-deny
args: ["--all-features", "check"]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-added-large-files
- id: check-yaml
- id: end-of-file-fixer
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Some form of concurrent execution, but this might not be necessary as some
dependencies already use `rayon` and `crossbeam`.

## [0.2.4] - 2025-09-08
## [0.2.4] - 2025-09-30

### Added

- GitHub action `audit.yml`, with `audit-check` and `cargo-deny-action` actions
- `audit.toml` for local and CI `cargo audit` configuration
- `deny.toml` for local and CI `cargo deny` configuration
- Pre-commit hooks, `.pre-commit-config.yaml`

### Changed
- Updated several dependencies to newer versions.
- `cargo audit` found a security vulnerability in a dependency (that version has been yanked).
- The build process for the release profile now uses the LTO optimization.

## [0.2.3] - 2024-07-10

Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 17 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
[package]
name = "reduce_image_size"
description = "Reduces size of images in a folder (and optionally sub-folders, recursively)."
version = "0.2.4"
edition = "2024"
authors = ["Ivan Lazarević"]
description = "Reduces size of images in a folder (and optionally sub-folders, recursively)."
repository = "https://github.com/ivanbgd/reduce-image-size-rust"
license = "MIT"
keywords = ["image", "images", "photo", "jpeg", "png"]
readme = "README.md"
categories = ["computer-vision", "multimedia", "multimedia::images", "command-line-utilities"]

[profile.release]
strip = "symbols"
keywords = ["image", "images", "photo", "jpeg", "png"]
edition = "2024"
rust-version = "1.89.0"

[lib]
path = "src/lib.rs"
Expand All @@ -20,10 +19,18 @@ name = "reduce_image_size"
path = "src/main.rs"

[dependencies]
clap = { version = "4.5.9", features = ["derive"] }
clap = { version = "4.5.48", features = ["derive"] }
fast_image_resize = { version = "5.3.0" }
image = "0.25.8"
oxipng = { version = "9.1.1", default-features = false, features = ["parallel"] }
pathdiff = { version = "0.2.1" }
turbojpeg = { version = "1.1.0", features = ["image"] }
oxipng = { version = "9.1.5", default-features = false, features = ["parallel"] }
pathdiff = { version = "0.2.3" }
turbojpeg = { version = "1.3.3", features = ["image"] }
walkdir = "2.5.0"

[profile.dev.package.oxipng]
opt-level = 3

[profile.release]
strip = "symbols"
lto = "fat"
codegen-units = 1
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Reduce Image Size

[![CI](https://github.com/ivanbgd/reduce-image-size-rust/actions/workflows/ci.yml/badge.svg)](https://github.com/ivanbgd/reduce-image-size-rust/actions/workflows/ci.yml)
[![license](https://img.shields.io/badge/License-MIT-blue.svg?style=flat)](LICENSE)
[![Crates.io](https://img.shields.io/crates/v/reduce_image_size.svg)](https://crates.io/crates/reduce_image_size)
[![docs.rs](https://docs.rs/reduce_image_size/badge.svg)](https://docs.rs/reduce_image_size/)
[![CI](https://github.com/ivanbgd/reduce-image-size-rust/actions/workflows/ci.yml/badge.svg)](https://github.com/ivanbgd/reduce-image-size-rust/actions/workflows/ci.yml)
[![Security audit](https://github.com/ivanbgd/reduce-image-size-rust/actions/workflows/audit.yml/badge.svg)](https://github.com/ivanbgd/reduce-image-size-rust/actions/workflows/audit.yml)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)

## Description
Reduces size of images in a folder (and optionally sub-folders, recursively).
Expand Down Expand Up @@ -57,13 +60,37 @@ The file paths in the examples are for Windows.
- `reduce_image_size D:\img_src D:\img_dst --recursive --resize --quality 60 --size L`

## Notes
- Updated and tested in Rust 1.89.0 on Apple silicon with macOS Sequoia 15.3.
- Updated and tested in Rust 1.89.0 and 1.90.0 on Apple silicon with macOS Sequoia 15.3.2.
- First developed in Rust 1.74.1, but also tested later with Rust 1.79.0.
- Tested on x86-64 CPUs on Windows 10 and Windows 11.
- Tested on Apple silicon, M2 Pro, on macOS Sonoma 14.5.
- Also tested on WSL - Ubuntu 22.04.2 LTS (GNU/Linux 5.15.133.1-microsoft-standard-WSL2 x86_64) on Windows 11 @ x86-64.
- Linux wasn't tested directly, but should work, at least on x86-64 CPUs.

## Security

- [cargo audit](https://github.com/rustsec/rustsec/blob/main/cargo-audit/README.md) is supported,
as well as its GitHub action, [audit-check](https://github.com/rustsec/audit-check).
- [cargo deny](https://embarkstudios.github.io/cargo-deny/) is supported,
as well as its GitHub action, [cargo-deny-action](https://github.com/EmbarkStudios/cargo-deny-action).

## Development

### Pre-commit

[pre-commit](https://pre-commit.com/) hooks are supported.

```shell
$ pip install pre-commit # If you don't already have pre-commit installed on your machine. Run once.
$ pre-commit autoupdate # Update hook repositories to the latest versions.
$ pre-commit install # Sets up the pre-commit git hook script for the repository. Run once.
$ pre-commit install --hook-type pre-push # Sets up the pre-push git hook script for the repository. Run once.
$ pre-commit run # For manual running; considers only modified files.
$ pre-commit run --all-files # For manual running; considers all files.
```

After installing it, the provided [pre-commit hook(s)](.pre-commit-config.yaml) will run automatically on `git commit`.

## Running the Application
Executable files for Windows, macOS and Linux can be downloaded from
the [Releases](https://github.com/ivanbgd/reduce-image-size-rust/releases) page of the repository.
Expand Down
Loading
Loading