rszr 1.0.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea3437991dd4694e35653020632c3fc360f787e1d391834780fdf118991a90ce
4
- data.tar.gz: 37ccc3f8693e4fe9d41939cfc2d3786ef72ed24e344059f1dd4e4492efcae862
3
+ metadata.gz: c2a807383b99cb581c84c5ba8ae9f4b3c22afd8e2402839d12bbe053d7121886
4
+ data.tar.gz: 205b2a3c639a0c3ad58bf02e1b8c0d66511accc75f8553a210d8f40d5317725f
5
5
  SHA512:
6
- metadata.gz: 35b8219e81c0f89e4b51719617c13edf71421d7e3ed4e1998f8e26fc017545da76c5164c0bbd63c16e5c617cfdd4f5cb1f07a8e0bbdc83b7bb90ea7fbbd71907
7
- data.tar.gz: fd4361d89e0ff577032da1dea39686c035604d98e5b6b935ca8de8f1289bdfe6cf5678c8842406c0b9c5829cfab2c03af8350670638824a99deeb176e4675428
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 `image_processing` gem.
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/extconf.rb CHANGED
@@ -1,10 +1,9 @@
1
1
  require 'mkmf'
2
2
  require 'rbconfig'
3
3
 
4
- imlib2_config = with_config('imlib2-config', 'imlib2-config')
4
+ pkg_config('imlib2')
5
5
 
6
- $CFLAGS << ' -DX_DISPLAY_MISSING ' << `#{imlib2_config} --cflags`.chomp
7
- $LDFLAGS << ' ' << `#{imlib2_config} --libs`.chomp
6
+ $CFLAGS << ' -DX_DISPLAY_MISSING'
8
7
  $LDFLAGS.gsub!(/\ -lX11\ -lXext/, '') if RUBY_PLATFORM =~ /darwin/
9
8
 
10
9
  unless find_header('Imlib2.h')
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, 3);
511
+ rb_define_private_method(cImage, "_save", rszr_image__save, 4);
507
512
  }
508
513
 
509
514
  #endif
data/ext/rszr/rszr.h CHANGED
@@ -3,7 +3,6 @@
3
3
 
4
4
  #include "ruby.h"
5
5
  #include <Imlib2.h>
6
- #include <libexif/exif-data.h>
7
6
 
8
7
  extern VALUE mRszr;
9
8
  void Init_rszr();
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
@@ -1,3 +1,3 @@
1
1
  module Rszr
2
- VERSION = '1.0.0'
2
+ VERSION = '1.2.0'
3
3
  end
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.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthias Grosser
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-31 00:00:00.000000000 Z
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:
@@ -42,7 +42,7 @@ homepage: https://github.com/mtgrosser/rszr
42
42
  licenses:
43
43
  - MIT
44
44
  metadata: {}
45
- post_install_message:
45
+ post_install_message:
46
46
  rdoc_options: []
47
47
  require_paths:
48
48
  - lib
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - imlib2
62
62
  rubygems_version: 3.1.4
63
- signing_key:
63
+ signing_key:
64
64
  specification_version: 4
65
65
  summary: Fast image resizer
66
66
  test_files: []