fast_resize 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50cddc83a608aca540d2cd79db11f89cf5143cabbaa790b00a52514e37d0bf87
4
- data.tar.gz: 25ccb548c17f7b408098040ae0e32f2527653637c605e41daeb6e25c4692b405
3
+ metadata.gz: 2faf27ff3db63ef46e8371e6496ce55e4ee87fffef6d07c47b48c60b1baf8d9e
4
+ data.tar.gz: 1458f2620b1bcabb8e57f75ac385e61202a6e8e0dd4884c2fdb1038c1d8b1992
5
5
  SHA512:
6
- metadata.gz: 9ad5ea5b9ff6668a134056ef1b07b8362c452e9ad1a08b6eba54e3a90c832e9b2ab18d39471e325053774ae8a40945c8c11ade93f4e1403df16c8a473954285d
7
- data.tar.gz: f96258c219287d2c497b2011832df371d2813b8f2145d87180dbaeadeb65620a122e4dc6cb0621f4f8911386450cfecb37ec01c22fd5f1e34598584b9fae5bb7
6
+ metadata.gz: b78b183a0a77623a5e8a485153ad833295294b5227a60bb7361438755305ffd49f23438df98d316f4572fb9cc28b9b5441a12d225d64455e5357b5db4b44dfc4
7
+ data.tar.gz: 90676b601b3b6428ba3bd304721079d6ec0c8e801cf37b601572358fe15b1104f39ed9429b67b8e892f6348e86159a64b38e29d4ba7f373f66340fd5c0761c08
data/README.md CHANGED
@@ -8,7 +8,6 @@ Resize 1,000 images in **2 seconds**. Up to **2.9x faster** than libvips, **3.1x
8
8
 
9
9
  [![GitHub Stars](https://img.shields.io/github/stars/tranhuucanh/fast_resize?style=social)](https://github.com/tranhuucanh/fast_resize/stargazers)
10
10
  [![GitHub Forks](https://img.shields.io/github/forks/tranhuucanh/fast_resize?style=social)](https://github.com/tranhuucanh/fast_resize/network/members)
11
- [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/tranhuucanh/fast_resize)
12
11
 
13
12
  [Installation](#-installation) • [Quick Start](#-quick-start) • [Documentation](#-documentation) • [Benchmarks](#-performance-benchmarks)
14
13
 
@@ -16,10 +15,12 @@ Resize 1,000 images in **2 seconds**. Up to **2.9x faster** than libvips, **3.1x
16
15
 
17
16
  ### 🛠️ Tech Stack & Stats
18
17
 
19
- [![License](https://img.shields.io/badge/License-BSD--3--Clause-blue.svg)](LICENSE)
20
18
  [![C++](https://img.shields.io/badge/C++-14-blue.svg)](https://isocpp.org/)
19
+ [![C](https://img.shields.io/badge/C-99-blue.svg)](https://en.wikipedia.org/wiki/C99)
20
+ [![Ruby](https://img.shields.io/badge/Ruby-2.5+-red.svg)](https://www.ruby-lang.org/)
21
21
  [![CMake](https://img.shields.io/badge/CMake-3.15+-064F8C.svg)](https://cmake.org/)
22
22
  [![Shell](https://img.shields.io/badge/Shell-Bash-4EAA25.svg)](https://www.gnu.org/software/bash/)
23
+ [![License](https://img.shields.io/badge/License-BSD--3--Clause-blue.svg)](LICENSE)
23
24
 
24
25
  💎 **Ruby:** [![Gem](https://img.shields.io/badge/Gem-fast_resize-red.svg)](https://rubygems.org/gems/fast_resize) [![Gem Downloads](https://badgen.net/rubygems/dt/fast_resize)](https://rubygems.org/gems/fast_resize)
25
26
 
@@ -58,6 +59,13 @@ Resize 1,000 images in **2 seconds**. Up to **2.9x faster** than libvips, **3.1x
58
59
  | **[libvips](https://www.libvips.org/)** | The gold standard for high-performance image processing. Used by Sharp (Node.js), Shopify, and Wikipedia. Widely recognized as one of the fastest image processing libraries available. | FastResize is **1.7x - 2.9x faster** |
59
60
  | **[imageflow](https://www.imageflow.io/)** | A Rust-based image manipulation engine designed for high throughput and accuracy. Known for powering modern large-scale image resizing pipelines. | FastResize is **1.1x - 3.1x faster** |
60
61
 
62
+ <div align="center">
63
+
64
+ 💡 **Want to dive deeper?** Explore full details about FastResize →
65
+ <a target="_blank" href="https://deepwiki.com/tranhuucanh/fast_resize"><img src="https://deepwiki.com/badge.svg" alt="Ask DeepWiki" style="display:inline; vertical-align: middle;" /></a>
66
+
67
+ </div>
68
+
61
69
  ---
62
70
 
63
71
  ## 🔥 Performance Benchmarks
@@ -357,7 +365,6 @@ FastResize is built on industry-standard, high-performance libraries:
357
365
  - 🚀 **Zero-copy Pipeline** - Minimal memory allocation
358
366
  - 💪 **Multi-threaded** - Parallel batch processing
359
367
  - 🔥 **Memory-mapped I/O** - Efficient file reading
360
- - 🎯 **libjpeg-turbo** - 2-6x faster JPEG than standard libjpeg
361
368
 
362
369
  ---
363
370
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.3
1
+ 1.0.4
@@ -50,7 +50,7 @@ def check_prebuilt_binary
50
50
  when /arm64|aarch64/
51
51
  'macos-arm64'
52
52
  when /x86_64|x64/
53
- 'macos-x86_64'
53
+ nil # macOS x86_64 no longer supported
54
54
  else
55
55
  nil
56
56
  end
@@ -0,0 +1,41 @@
1
+ # FastResize - The Fastest Image Resizing Library On The Planet
2
+ # Copyright (C) 2025 Tran Huu Canh (0xTh3OKrypt) and FastResize Contributors
3
+ #
4
+ # Resize 1,000 images in 2 seconds. Up to 2.9x faster than libvips,
5
+ # 3.1x faster than imageflow. Uses 3-4x less RAM than alternatives.
6
+ #
7
+ # Author: Tran Huu Canh (0xTh3OKrypt)
8
+ # Email: tranhuucanh39@gmail.com
9
+ # Homepage: https://github.com/tranhuucanh/fast_resize
10
+ #
11
+ # BSD 3-Clause License
12
+ #
13
+ # Redistribution and use in source and binary forms, with or without
14
+ # modification, are permitted provided that the following conditions are met:
15
+ #
16
+ # 1. Redistributions of source code must retain the above copyright notice,
17
+ # this list of conditions and the following disclaimer.
18
+ #
19
+ # 2. Redistributions in binary form must reproduce the above copyright notice,
20
+ # this list of conditions and the following disclaimer in the documentation
21
+ # and/or other materials provided with the distribution.
22
+ #
23
+ # 3. Neither the name of the copyright holder nor the names of its
24
+ # contributors may be used to endorse or promote products derived from
25
+ # this software without specific prior written permission.
26
+ #
27
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
31
+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33
+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35
+ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36
+ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
37
+ # THE POSSIBILITY OF SUCH DAMAGE.
38
+
39
+ # Compatibility alias: allows both require 'fast_resize' and require 'fastresize'
40
+ require_relative 'fastresize'
41
+
@@ -55,7 +55,7 @@ module FastResize
55
55
  when /arm64|aarch64/
56
56
  'macos-arm64'
57
57
  when /x86_64|x64/
58
- 'macos-x86_64'
58
+ raise "macOS x86_64 is no longer supported. Please use Apple Silicon (M1/M2/M3) or compile from source."
59
59
  else
60
60
  raise "Unsupported macOS architecture: #{arch}"
61
61
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FastResize
4
- VERSION = "1.0.3"
4
+ VERSION = "1.0.4"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fast_resize
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tran Huu Canh (0xTh3OKrypt)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-12-04 00:00:00.000000000 Z
11
+ date: 2025-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -79,6 +79,7 @@ files:
79
79
  - README.md
80
80
  - VERSION
81
81
  - bindings/ruby/ext/fastresize/extconf.rb
82
+ - bindings/ruby/lib/fast_resize.rb
82
83
  - bindings/ruby/lib/fastresize.rb
83
84
  - bindings/ruby/lib/fastresize/platform.rb
84
85
  - bindings/ruby/lib/fastresize/version.rb
@@ -103,13 +104,6 @@ files:
103
104
  - bindings/ruby/prebuilt/macos-arm64/include/stb_image_resize2.h
104
105
  - bindings/ruby/prebuilt/macos-arm64/include/stb_image_write.h
105
106
  - bindings/ruby/prebuilt/macos-arm64/lib/libfastresize.a
106
- - bindings/ruby/prebuilt/macos-x86_64.tar.gz
107
- - bindings/ruby/prebuilt/macos-x86_64/bin/fast_resize
108
- - bindings/ruby/prebuilt/macos-x86_64/include/fastresize.h
109
- - bindings/ruby/prebuilt/macos-x86_64/include/stb_image.h
110
- - bindings/ruby/prebuilt/macos-x86_64/include/stb_image_resize2.h
111
- - bindings/ruby/prebuilt/macos-x86_64/include/stb_image_write.h
112
- - bindings/ruby/prebuilt/macos-x86_64/lib/libfastresize.a
113
107
  homepage: https://github.com/tranhuucanh/fast_resize
114
108
  licenses:
115
109
  - BSD-3-Clause
@@ -1,189 +0,0 @@
1
- /*
2
- * FastResize - The Fastest Image Resizing Library On The Planet
3
- * Copyright (C) 2025 Tran Huu Canh (0xTh3OKrypt) and FastResize Contributors
4
- *
5
- * Resize 1,000 images in 2 seconds. Up to 2.9x faster than libvips,
6
- * 3.1x faster than imageflow. Uses 3-4x less RAM than alternatives.
7
- *
8
- * Author: Tran Huu Canh (0xTh3OKrypt)
9
- * Email: tranhuucanh39@gmail.com
10
- * Homepage: https://github.com/tranhuucanh/fast_resize
11
- *
12
- * BSD 3-Clause License
13
- *
14
- * Redistribution and use in source and binary forms, with or without
15
- * modification, are permitted provided that the following conditions are met:
16
- *
17
- * 1. Redistributions of source code must retain the above copyright notice,
18
- * this list of conditions and the following disclaimer.
19
- *
20
- * 2. Redistributions in binary form must reproduce the above copyright notice,
21
- * this list of conditions and the following disclaimer in the documentation
22
- * and/or other materials provided with the distribution.
23
- *
24
- * 3. Neither the name of the copyright holder nor the names of its
25
- * contributors may be used to endorse or promote products derived from
26
- * this software without specific prior written permission.
27
- *
28
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
29
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
32
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
33
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
35
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
36
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
37
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
38
- * THE POSSIBILITY OF SUCH DAMAGE.
39
- */
40
-
41
- #ifndef FASTRESIZE_H
42
- #define FASTRESIZE_H
43
-
44
- #include <string>
45
- #include <vector>
46
-
47
- namespace fastresize {
48
-
49
- // ============================================
50
- // Core Structures
51
- // ============================================
52
-
53
- struct ResizeOptions {
54
- // Resize mode
55
- enum Mode {
56
- SCALE_PERCENT, // Scale by percentage
57
- FIT_WIDTH, // Fixed width, height auto
58
- FIT_HEIGHT, // Fixed height, width auto
59
- EXACT_SIZE // Exact width & height
60
- } mode;
61
-
62
- // Dimensions
63
- int target_width; // Target width (pixels)
64
- int target_height; // Target height (pixels)
65
- float scale_percent; // Scale percentage (0.0-1.0)
66
-
67
- // Options
68
- bool keep_aspect_ratio; // Preserve aspect ratio (default: true)
69
- bool overwrite_input; // Overwrite input file (default: false)
70
-
71
- // Quality
72
- int quality; // JPEG/WEBP quality 1-100 (default: 85)
73
-
74
- // Filter
75
- enum Filter {
76
- MITCHELL, // Default, good balance
77
- CATMULL_ROM, // Sharp edges
78
- BOX, // Fast, lower quality
79
- TRIANGLE // Bilinear
80
- } filter;
81
-
82
- // Constructor with defaults
83
- ResizeOptions()
84
- : mode(EXACT_SIZE)
85
- , target_width(0)
86
- , target_height(0)
87
- , scale_percent(1.0f)
88
- , keep_aspect_ratio(true)
89
- , overwrite_input(false)
90
- , quality(85)
91
- , filter(MITCHELL)
92
- {}
93
- };
94
-
95
- struct ImageInfo {
96
- int width;
97
- int height;
98
- int channels; // 1=Gray, 3=RGB, 4=RGBA
99
- std::string format; // "jpg", "png", "webp", "bmp"
100
- };
101
-
102
- // ============================================
103
- // Single Image Resize
104
- // ============================================
105
-
106
- // Resize single image (auto-detect format)
107
- bool resize(
108
- const std::string& input_path,
109
- const std::string& output_path,
110
- const ResizeOptions& options
111
- );
112
-
113
- // Resize with explicit format
114
- bool resize_with_format(
115
- const std::string& input_path,
116
- const std::string& output_path,
117
- const std::string& output_format, // "jpg", "png", "webp", "bmp"
118
- const ResizeOptions& options
119
- );
120
-
121
- // Get image info without loading
122
- ImageInfo get_image_info(const std::string& path);
123
-
124
- // ============================================
125
- // Batch Processing
126
- // ============================================
127
-
128
- struct BatchItem {
129
- std::string input_path;
130
- std::string output_path;
131
- ResizeOptions options; // Per-image options
132
- };
133
-
134
- struct BatchOptions {
135
- int num_threads; // Thread pool size (0 = auto-detect, default: 0)
136
- bool stop_on_error; // Stop if any image fails (default: false)
137
- bool max_speed; // Enable Phase C pipeline (faster but uses more RAM, default: false)
138
-
139
- BatchOptions()
140
- : num_threads(0) // Phase A Optimization #7: Auto-detect thread count
141
- , stop_on_error(false)
142
- , max_speed(false) // Phase C: Default to balanced mode (no extra RAM)
143
- {}
144
- };
145
-
146
- struct BatchResult {
147
- int total; // Total images
148
- int success; // Successfully processed
149
- int failed; // Failed to process
150
- std::vector<std::string> errors; // Error messages
151
- };
152
-
153
- // Batch resize - same options for all images
154
- BatchResult batch_resize(
155
- const std::vector<std::string>& input_paths,
156
- const std::string& output_dir,
157
- const ResizeOptions& options,
158
- const BatchOptions& batch_opts = BatchOptions()
159
- );
160
-
161
- // Batch resize - individual options per image
162
- BatchResult batch_resize_custom(
163
- const std::vector<BatchItem>& items,
164
- const BatchOptions& batch_opts = BatchOptions()
165
- );
166
-
167
- // ============================================
168
- // Error Handling
169
- // ============================================
170
-
171
- // Get last error message
172
- std::string get_last_error();
173
-
174
- // Error codes
175
- enum ErrorCode {
176
- OK = 0,
177
- FILE_NOT_FOUND,
178
- UNSUPPORTED_FORMAT,
179
- DECODE_ERROR,
180
- RESIZE_ERROR,
181
- ENCODE_ERROR,
182
- WRITE_ERROR
183
- };
184
-
185
- ErrorCode get_last_error_code();
186
-
187
- } // namespace fastresize
188
-
189
- #endif // FASTRESIZE_H