rszr 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -1
- data/ext/rszr/image.c +8 -3
- data/lib/rszr/image.rb +2 -2
- data/lib/rszr/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2a807383b99cb581c84c5ba8ae9f4b3c22afd8e2402839d12bbe053d7121886
|
4
|
+
data.tar.gz: 205b2a3c639a0c3ad58bf02e1b8c0d66511accc75f8553a210d8f40d5317725f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd6a39ed7d2e84b8a45a083202731adb5b4a0530c9b2601f1c0835ec0da7fe2f4e9ffd93d2cf3459956ecefbe7ffebaf1686ebabb7dea575293cbe2020b4aa63
|
7
|
+
data.tar.gz: 4fbe1b757974fbb2b4ded496e3f5ac4a4111eb2109242040ed094b1a710ae59487f679954ed5dbdbaef44b04aa44c38f89d6ba7f0f3d0a10a4d37946096163ca
|
data/README.md
CHANGED
@@ -162,9 +162,22 @@ To enable autorotation by default:
|
|
162
162
|
Rszr.autorotate = true
|
163
163
|
```
|
164
164
|
|
165
|
+
### Creating interlaced PNG and progressive JPEG images
|
166
|
+
|
167
|
+
In order to save interlaced PNGs and progressive JPEGs, set the `interlace` option to `true`:
|
168
|
+
|
169
|
+
```ruby
|
170
|
+
image.save('interlaced.png', interlace: true)
|
171
|
+
```
|
172
|
+
|
173
|
+
As of v1.8.0, `imlib2` doesn't support saving progressive JPEG images yet,
|
174
|
+
but a [patch](https://git.enlightenment.org/legacy/imlib2.git/commit/?id=37e8c9578897259211284d3590cc38b7f6a718dc) has been submitted.
|
175
|
+
|
176
|
+
For EL8, there are pre-built RPMs provided by the [onrooby repo](http://downloads.onrooby.com/repo/el/8/x86_64/).
|
177
|
+
|
165
178
|
## Rails / ActiveStorage interface
|
166
179
|
|
167
|
-
Rszr provides a drop-in interface to the
|
180
|
+
Rszr provides a drop-in interface to the [image_processing](https://github.com/janko/image_processing) gem.
|
168
181
|
It is faster than both `mini_magick` and `vips` and way easier to install than the latter.
|
169
182
|
|
170
183
|
```ruby
|
data/ext/rszr/image.c
CHANGED
@@ -165,7 +165,6 @@ static VALUE rszr_image__pixel_get(VALUE self, VALUE rb_x, VALUE rb_y)
|
|
165
165
|
return rb_rgba;
|
166
166
|
}
|
167
167
|
|
168
|
-
|
169
168
|
/*
|
170
169
|
static VALUE rszr_image_get_quality(VALUE self)
|
171
170
|
{
|
@@ -205,6 +204,7 @@ static VALUE rszr_image_set_quality(VALUE self, VALUE rb_quality)
|
|
205
204
|
}
|
206
205
|
*/
|
207
206
|
|
207
|
+
|
208
208
|
static VALUE rszr_image_dup(VALUE self)
|
209
209
|
{
|
210
210
|
rszr_image_handle * handle;
|
@@ -445,7 +445,7 @@ static VALUE rszr_image__crop(VALUE self, VALUE bang, VALUE rb_x, VALUE rb_y, VA
|
|
445
445
|
}
|
446
446
|
|
447
447
|
|
448
|
-
static VALUE rszr_image__save(VALUE self, VALUE rb_path, VALUE rb_format, VALUE rb_quality)
|
448
|
+
static VALUE rszr_image__save(VALUE self, VALUE rb_path, VALUE rb_format, VALUE rb_quality, VALUE rb_interlace)
|
449
449
|
{
|
450
450
|
rszr_image_handle * handle;
|
451
451
|
char * path;
|
@@ -463,6 +463,11 @@ static VALUE rszr_image__save(VALUE self, VALUE rb_path, VALUE rb_format, VALUE
|
|
463
463
|
imlib_image_set_format(format);
|
464
464
|
if (quality)
|
465
465
|
imlib_image_attach_data_value("quality", NULL, quality, NULL);
|
466
|
+
|
467
|
+
imlib_image_remove_attached_data_value("interlacing");
|
468
|
+
if (RTEST(rb_interlace))
|
469
|
+
imlib_image_attach_data_value("interlacing", NULL, 1, NULL);
|
470
|
+
|
466
471
|
imlib_save_image_with_error_return(path, &save_error);
|
467
472
|
|
468
473
|
if (save_error) {
|
@@ -503,7 +508,7 @@ void Init_rszr_image()
|
|
503
508
|
rb_define_private_method(cImage, "_sharpen!", rszr_image__sharpen_bang, 1);
|
504
509
|
rb_define_private_method(cImage, "_pixel", rszr_image__pixel_get, 2);
|
505
510
|
|
506
|
-
rb_define_private_method(cImage, "_save", rszr_image__save,
|
511
|
+
rb_define_private_method(cImage, "_save", rszr_image__save, 4);
|
507
512
|
}
|
508
513
|
|
509
514
|
#endif
|
data/lib/rszr/image.rb
CHANGED
@@ -148,11 +148,11 @@ module Rszr
|
|
148
148
|
|
149
149
|
include Transformations
|
150
150
|
|
151
|
-
def save(path, format: nil, quality: nil)
|
151
|
+
def save(path, format: nil, quality: nil, interlace: false)
|
152
152
|
format ||= format_from_filename(path) || self.format || 'jpg'
|
153
153
|
raise ArgumentError, "invalid quality #{quality.inspect}" if quality && !(0..100).cover?(quality)
|
154
154
|
ensure_path_is_writable(path)
|
155
|
-
_save(path.to_s, format.to_s, quality)
|
155
|
+
_save(path.to_s, format.to_s, quality, interlace)
|
156
156
|
end
|
157
157
|
|
158
158
|
def save_data(format: nil, quality: nil)
|
data/lib/rszr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rszr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthias Grosser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Fast image resizer - do one thing and do it fast.
|
14
14
|
email:
|