format_parser 0.23.1 → 0.24.0
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/format_parser/version.rb +1 -1
- data/lib/parsers/tiff_parser.rb +7 -1
- data/spec/parsers/tiff_parser_spec.rb +4 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cef6e8b3f4c3914ef022e7ff0e92d38357670315c0804efe8a2967f7f4228f53
|
4
|
+
data.tar.gz: '09a817b4fc688a3695800f4602a5901613b591d7a30ba26b86988720da7e13a9'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 979804c2a7381d09e1f4952396321e185a917587d44409b1f7d45be0e05b466601eb7281e3d463785c6c18d79ba48ff3858bcd60c0f6791e2d394c4fa40ed684
|
7
|
+
data.tar.gz: a58cd8cab20fa8b8b7886a36479bd03fb6f5a4afbf9435d09318da502de50f6f257e45b012a56c79b4309dbaaf96feedb6b2b12016979bffa1336c528a591e3b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 0.24.0
|
2
|
+
* The TIFF parser will now return :arw as format for Sony ARW files insted of :tif so that the caller can decide whether it
|
3
|
+
wants to deal with RAW processing or not
|
4
|
+
|
1
5
|
## 0.23.1
|
2
6
|
* Updated gem exifr to fix problems related to jpeg files from Olympos microscopes, which often have bad thumbnail data
|
3
7
|
|
data/lib/parsers/tiff_parser.rb
CHANGED
@@ -26,7 +26,7 @@ class FormatParser::TIFFParser
|
|
26
26
|
h = exif_data.height || exif_data.pixel_y_dimension
|
27
27
|
|
28
28
|
FormatParser::Image.new(
|
29
|
-
format: :tif,
|
29
|
+
format: arw?(exif_data) ? :arw : :tif, # Specify format as arw for Sony ARW format images, else tif
|
30
30
|
width_px: w,
|
31
31
|
height_px: h,
|
32
32
|
display_width_px: exif_data.rotated? ? h : w,
|
@@ -43,5 +43,11 @@ class FormatParser::TIFFParser
|
|
43
43
|
safe_read(io, 2) == 'CR'
|
44
44
|
end
|
45
45
|
|
46
|
+
# Similar to how exiftool determines the image type as ARW, we are implementing a check here
|
47
|
+
# https://github.com/exiftool/exiftool/blob/e969456372fbaf4b980fea8bb094d71033ac8bf7/lib/Image/ExifTool/Exif.pm#L929
|
48
|
+
def arw?(exif_data)
|
49
|
+
exif_data.compression == 6 && exif_data.new_subfile_type == 1 && exif_data.make == 'SONY'
|
50
|
+
end
|
51
|
+
|
46
52
|
FormatParser.register_parser new, natures: :image, formats: :tif
|
47
53
|
end
|
@@ -47,12 +47,15 @@ describe FormatParser::TIFFParser do
|
|
47
47
|
expect(parsed.intrinsics[:exif]).not_to be_nil
|
48
48
|
end
|
49
49
|
|
50
|
-
it '
|
50
|
+
it 'parses Sony ARW fixture as arw format file' do
|
51
51
|
arw_path = fixtures_dir + '/ARW/RAW_SONY_ILCE-7RM2.ARW'
|
52
52
|
|
53
53
|
parsed = subject.call(File.open(arw_path, 'rb'))
|
54
54
|
|
55
55
|
expect(parsed).not_to be_nil
|
56
|
+
expect(parsed.nature).to eq(:image)
|
57
|
+
expect(parsed.format).to eq(:arw)
|
58
|
+
|
56
59
|
expect(parsed.width_px).to eq(7952)
|
57
60
|
expect(parsed.height_px).to eq(5304)
|
58
61
|
expect(parsed.intrinsics[:exif]).not_to be_nil
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: format_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.24.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Noah Berman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-09-
|
12
|
+
date: 2020-09-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ks
|
@@ -292,7 +292,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
292
292
|
- !ruby/object:Gem::Version
|
293
293
|
version: '0'
|
294
294
|
requirements: []
|
295
|
-
rubygems_version: 3.0.
|
295
|
+
rubygems_version: 3.0.6
|
296
296
|
signing_key:
|
297
297
|
specification_version: 4
|
298
298
|
summary: A library for efficient parsing of file metadata
|