Skip to content

Commit 0e4f615

Browse files
feat(images): add dedicated libvips compression engine
Use MozJPEG, lossless PNG and Deflate TIFF encoding in the compress action, with system HEIC encoding. Publish successful output regardless of size and show actual per-image byte changes. Bundle the pinned arm64 macOS 13 runtime, corresponding source archives and license notices. Add reproducible build/signing integration, updated contracts and compression regression coverage. Validation: make verify; Release build; native resource fixture; hardened-runtime sandbox encoding and readback. Refs #7
1 parent f029331 commit 0e4f615

51 files changed

Lines changed: 5243 additions & 24 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎App/FileMint/ResourceToolsView.swift‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,16 @@ struct ResourceToolsView: View {
283283
if let result = model.result {
284284
Text("\(text(result.cancelled ? .cancelled : result.failure != nil ? .failed : .completed)) · \(result.completed)/\(model.inputs.count)")
285285
.font(.system(size: 11, weight: .medium)).fixedSize(horizontal: false, vertical: true)
286+
if model.tool == .compress,
287+
let compression = result.compressions.first(where: { $0.source == model.selectedInput?.url }) {
288+
VStack(alignment: .leading, spacing: 6) {
289+
Text("\(text(.originalSize)): \(ByteCountFormatter.string(fromByteCount: compression.originalBytes, countStyle: .file))")
290+
Text("\(text(.compressedSize)): \(ByteCountFormatter.string(fromByteCount: compression.outputBytes, countStyle: .file))")
291+
Text("\(text(.sizeChange)): \(compression.changeFraction.formatted(.percent.precision(.fractionLength(1)).sign(strategy: .always(includingZero: true))))")
292+
}.font(.system(size: 11)).monospacedDigit().foregroundStyle(.secondary)
293+
.fixedSize(horizontal: false, vertical: true)
294+
.help("\(compression.originalBytes) B → \(compression.outputBytes) B")
295+
}
286296
if result.completed == 0, result.failure != nil, model.tool != .removeMetadata {
287297
Button(text(.editOptions)) { model.editOptions() }.buttonStyle(MintButtonStyle())
288298
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>AvailableLibraries</key>
6+
<array>
7+
<dict>
8+
<key>BinaryPath</key>
9+
<string>FileMintCompression.framework/Versions/A/FileMintCompression</string>
10+
<key>LibraryIdentifier</key>
11+
<string>macos-arm64</string>
12+
<key>LibraryPath</key>
13+
<string>FileMintCompression.framework</string>
14+
<key>SupportedArchitectures</key>
15+
<array>
16+
<string>arm64</string>
17+
</array>
18+
<key>SupportedPlatform</key>
19+
<string>macos</string>
20+
</dict>
21+
</array>
22+
<key>CFBundlePackageType</key>
23+
<string>XFWK</string>
24+
<key>XCFrameworkFormatVersion</key>
25+
<string>1.0</string>
26+
</dict>
27+
</plist>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/FileMintCompression
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Headers
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Modules
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Versions/Current/Resources
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// SPDX-License-Identifier: LGPL-2.1-or-later
2+
#ifndef FILEMINT_COMPRESSION_H
3+
#define FILEMINT_COMPRESSION_H
4+
#include <stddef.h>
5+
#include <stdint.h>
6+
7+
#ifdef __cplusplus
8+
extern "C" {
9+
#endif
10+
11+
// Synchronous, borrowed 8-bit sRGB premultiplied RGBA, tightly packed rows.
12+
// The caller owns the validated pixels and a private staging path for the
13+
// entire call. No source paths, metadata, decoding or format discovery API.
14+
enum FMCompressionFormat {
15+
FMCompressionJPEG = 1,
16+
FMCompressionPNG = 2,
17+
FMCompressionTIFF = 3
18+
};
19+
__attribute__((visibility("default")))
20+
int fm_compression_encode(const uint8_t *rgba, size_t length,
21+
int width, int height, int format, int quality,
22+
const char *staging_path);
23+
__attribute__((visibility("default")))
24+
const char *fm_compression_version(void);
25+
26+
#ifdef __cplusplus
27+
}
28+
#endif
29+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
framework module FileMintCompression {
2+
umbrella header "FileMintCompression.h"
3+
export *
4+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleExecutable</key>
6+
<string>FileMintCompression</string>
7+
<key>CFBundleIdentifier</key>
8+
<string>io.github.daigua.filemint.compression</string>
9+
<key>CFBundleName</key>
10+
<string>FileMintCompression</string>
11+
<key>CFBundlePackageType</key>
12+
<string>FMWK</string>
13+
<key>CFBundleShortVersionString</key>
14+
<string>1.0</string>
15+
<key>CFBundleVersion</key>
16+
<string>1</string>
17+
<key>LSMinimumSystemVersion</key>
18+
<string>13.0</string>
19+
</dict>
20+
</plist>

0 commit comments

Comments
 (0)