fastimage 2.2.5 → 2.2.6

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: cfa3d72608b0c236038f0d4917930580df5474e5b46b61bcbb5758190e0050e3
4
- data.tar.gz: 759948e3de376e61a038c6a710b1d15a39d0459c2c20efa7fefbf3692bcc26b7
3
+ metadata.gz: d7667683a4bbc8ac16d583fb3ed7c93e6a58a25c19bf8df909ab7dae8d4ef782
4
+ data.tar.gz: 0baf5dcf6af104d0edd38baf65b7b35c972e6fc4271363d52855071e22b97a82
5
5
  SHA512:
6
- metadata.gz: 49a8af8f7dbed9c9c2de250a67cd9ff2810c7b0a5a41d79c5069b777331573de9633163cbc3a95b7a5710e695065a6266e37a255cfeb3ed380ddd29076ce34d9
7
- data.tar.gz: 4c9136b413828a5ef790befb5b16144fdc277979c5e28b855886888ea513aa7343900269c302feb495639cd5647f0e58dcdb1a67dd812f4d1357c42adaf1ebe5
6
+ metadata.gz: 9261157ade925ba5be4761028b4d70a698f1cc4d54e4ef0fcb7f4b23b6120ae6f9c42516b0dc17f915c423d168a4ef66c805a686ea20e3ca311556ce3e930593
7
+ data.tar.gz: 2d319a0aa6c4e7c7a3d951b3025d6215ac999bc2efe5d054720dac9c063cb3e2939e35e30660cf360bfae5f88285b91bb8029ec594c64ca1eb9e3e4144fa6b4c
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class FastImage
2
- VERSION = "2.2.5"
4
+ VERSION = '2.2.6'
3
5
  end
data/lib/fastimage.rb CHANGED
@@ -544,12 +544,9 @@ class FastImage
544
544
  case @stream.peek(3).bytes.to_a.last
545
545
  when 0
546
546
  # http://www.ftyps.com/what.html
547
- # HEIC is composed of nested "boxes". Each box has a header composed of
548
- # - Size (32 bit integer)
549
- # - Box type (4 chars)
550
- # - Extended size: only if size === 1, the type field is followed by 64 bit integer of extended size
551
- # - Payload: Type-dependent
552
547
  case @stream.peek(12)[4..-1]
548
+ when "ftypavif"
549
+ :avif
553
550
  when "ftypheic"
554
551
  :heic
555
552
  when "ftypmif1"
@@ -584,7 +581,14 @@ class FastImage
584
581
  end
585
582
  alias_method :parse_size_for_cur, :parse_size_for_ico
586
583
 
587
- class Heic # :nodoc:
584
+ # HEIC/AVIF are a special case of the general ISO_BMFF format, in which all data is encapsulated in typed boxes,
585
+ # with a mandatory ftyp box that is used to indicate particular file types. Is composed of nested "boxes". Each
586
+ # box has a header composed of
587
+ # - Size (32 bit integer)
588
+ # - Box type (4 chars)
589
+ # - Extended size: only if size === 1, the type field is followed by 64 bit integer of extended size
590
+ # - Payload: Type-dependent
591
+ class IsoBmff # :nodoc:
588
592
  def initialize(stream)
589
593
  @stream = stream
590
594
  end
@@ -735,14 +739,19 @@ class FastImage
735
739
  end
736
740
  end
737
741
 
742
+ def parse_size_for_avif
743
+ bmff = IsoBmff.new(@stream)
744
+ bmff.width_and_height
745
+ end
746
+
738
747
  def parse_size_for_heic
739
- heic = Heic.new(@stream)
740
- heic.width_and_height
748
+ bmff = IsoBmff.new(@stream)
749
+ bmff.width_and_height
741
750
  end
742
751
 
743
752
  def parse_size_for_heif
744
- heic = Heic.new(@stream)
745
- heic.width_and_height
753
+ bmff = IsoBmff.new(@stream)
754
+ bmff.width_and_height
746
755
  end
747
756
 
748
757
  class Gif # :nodoc:
metadata CHANGED
@@ -1,11 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastimage
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.5
4
+ version: 2.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Sykes
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
  date: 2021-02-28 00:00:00.000000000 Z
@@ -82,7 +82,7 @@ homepage: http://github.com/sdsykes/fastimage
82
82
  licenses:
83
83
  - MIT
84
84
  metadata: {}
85
- post_install_message:
85
+ post_install_message:
86
86
  rdoc_options:
87
87
  - "--charset=UTF-8"
88
88
  require_paths:
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  version: '0'
100
100
  requirements: []
101
101
  rubygems_version: 3.1.6
102
- signing_key:
102
+ signing_key:
103
103
  specification_version: 4
104
104
  summary: FastImage - Image info fast
105
105
  test_files: []