Skip to content
Merged
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
312 commits
Select commit Hold shift + click to select a range
bace18e
Use new configuration API for TIFF codec
Andy-Wilkinson Jul 5, 2017
ceff225
Merge branch 'master' into tiff-codec
JimBobSquarePants Feb 8, 2018
9bb598f
Merge branch 'master' into tiff-codec
JimBobSquarePants Feb 9, 2018
6d4e02e
Merge branch 'master' of https://github.com/SixLabors/ImageSharp into…
JimBobSquarePants Mar 4, 2018
10b814c
Update codebase to catch up with changes to main repo.
JimBobSquarePants Mar 4, 2018
1628863
Use environment specific newline in test
JimBobSquarePants Mar 4, 2018
9031bff
Merge branch 'master' into tiff-codec
JimBobSquarePants Mar 4, 2018
74b8a5b
Merge branch 'master' of https://github.com/SixLabors/ImageSharp into…
JimBobSquarePants Mar 14, 2018
01fbd07
Fix namespace reference in tests
JimBobSquarePants Mar 14, 2018
d385156
Merge branch 'master' into tiff-codec
JimBobSquarePants Aug 31, 2018
a2625b7
Merge remote-tracking branch 'upstream/master' into tiff-codec
JimBobSquarePants Oct 17, 2018
3fd86a2
Update tests/Images/External
JimBobSquarePants Oct 18, 2018
83caea0
Merge remote-tracking branch 'upstream/master' into tiff-codec
JimBobSquarePants Dec 6, 2018
a5b1e67
Update IPixel method calls to match new signatures
JimBobSquarePants Dec 6, 2018
879051a
Update external references
JimBobSquarePants Dec 6, 2018
c46fc03
Merge pull request #119 from Andy-Wilkinson/tiff-codec
JimBobSquarePants Dec 10, 2018
f9fcd77
Merge branch 'master' into tiff-codec
JimBobSquarePants Jan 28, 2019
6c424d3
Merge remote-tracking branch 'upstream/master' into tiff-codec
IldarKhayrutdinov Aug 21, 2020
7a0461b
Compilation errors fixes. Temporarily disable obsolete metadata relat…
IldarKhayrutdinov Aug 21, 2020
712104a
Update license
IldarKhayrutdinov Aug 21, 2020
2457d20
Move tiff classes into Formats.Tiff namespace. Mark tests with category.
IldarKhayrutdinov Aug 11, 2019
25a8203
Add Tiff to configurations.
IldarKhayrutdinov Aug 21, 2019
768ff6b
Deep refactoring and improves for tiff classes.
IldarKhayrutdinov Aug 25, 2020
a341782
Rename
IldarKhayrutdinov Aug 25, 2020
1d77c2e
Improve decoders - performance and memory usage.
IldarKhayrutdinov Aug 27, 2020
a9e3d89
Update README.md
IldarKhayrutdinov Aug 28, 2020
6fe3872
Merge pull request #1330 from IldarKhayrutdinov/tiff-codec_rebased
JimBobSquarePants Aug 28, 2020
6ca9f4f
Merge branch 'master' into tiff-format
JimBobSquarePants Sep 6, 2020
1e4f706
removing accidentally added file
IldarKhayrutdinov Sep 29, 2020
599f24f
#12 LZW bug fix
IldarKhayrutdinov Sep 28, 2020
32b5c11
Merge pull request #1364 from IldarKhayrutdinov/tiff-format
JimBobSquarePants Sep 29, 2020
2da3c6a
Small improve tiff decoder. Add TiffThrowHelper.
IldarKhayrutdinov Oct 22, 2020
5edec6d
Lzw test fix.
IldarKhayrutdinov Oct 22, 2020
55e4ded
Merge pull request #1400 from IldarKhayrutdinov/tiff-format
JimBobSquarePants Oct 22, 2020
28a88eb
Merge branch 'master' into tiff-format
JimBobSquarePants Nov 16, 2020
9f08585
Add support for de-compressing CCITT t4 tiffs
brianpopow Nov 21, 2020
3e4b5b2
Use memory allocator in t4 bitreader
brianpopow Nov 21, 2020
7514df6
Use Dictionarys for terminating and makeup codes
brianpopow Nov 21, 2020
250ba56
Add test images for fax3 compressed tiff
brianpopow Nov 21, 2020
0bb8165
Fix issue with CCITT T4 with white runs of length 0 at the start of a…
brianpopow Nov 22, 2020
fbce81b
Handle white as zero based on photometric interpretation
brianpopow Nov 22, 2020
8122bed
Add support for decompressing huffman encoded tiffs
brianpopow Nov 22, 2020
72ada95
Add Tiff specification pdf's
brianpopow Nov 22, 2020
c84ffba
T4 decompression: Clear buffer at start
brianpopow Nov 23, 2020
838a1f7
First attempt writing uncompressed tiff
brianpopow Nov 24, 2020
ae34c3c
Add Tiff EncodeAsync
brianpopow Nov 25, 2020
d5980ea
Set bits per pixel in tiff metadata
brianpopow Nov 25, 2020
d90c17d
Add support for writing 8bit gray tiff images
brianpopow Nov 25, 2020
a7deb8b
Add Tiff encoder Tests
brianpopow Nov 25, 2020
c7511c7
Add support for writing palette color tiff's
brianpopow Nov 26, 2020
a0e406b
Add tiff encoding mode enum
brianpopow Nov 26, 2020
4e5be46
Add support for encoding deflate compressed tiff's
brianpopow Nov 27, 2020
edcdc08
Fix issue with encoding paletted tiff when quantized palette is small…
brianpopow Nov 27, 2020
d0d57ca
Allow deflate compression for gray tiff
brianpopow Nov 27, 2020
add82fc
Allow deflate compression for paletted tiff's
brianpopow Nov 27, 2020
46fa87f
Fix broken tiff spec pdf
brianpopow Nov 27, 2020
11abaef
Add option to write bi-level tiff's
brianpopow Nov 27, 2020
262b63f
Add option to use deflate compression for bicolor images
brianpopow Nov 27, 2020
3f612b7
Split up WriteBiColor in Deflate and no compression
brianpopow Nov 28, 2020
a89c4f5
Add T4 BitWriter: So far only works for run length up to 63
brianpopow Nov 28, 2020
6ea7675
Add makeup codes for run length above 63
brianpopow Nov 28, 2020
719c7fa
Add ccitt fax3 test images
brianpopow Nov 29, 2020
3406764
Fix compression namespace
brianpopow Nov 29, 2020
0d5f255
Add support for encoding modified huffman RLE
brianpopow Nov 29, 2020
d3a8f5e
Add support for encoding packed bits compressed tiff's
brianpopow Nov 30, 2020
b04b9f4
Fix issue with packed bits and bi color tiffs
brianpopow Nov 30, 2020
b5c6839
Untangle writing compressed and none compressed color map tiff
brianpopow Nov 30, 2020
7275b6c
Add option to use PackBits with paletted tiff's
brianpopow Nov 30, 2020
778c5ba
Fix namespaces
brianpopow Nov 30, 2020
6851e4b
Fix warnings
brianpopow Nov 30, 2020
e7b77e3
Merge remote-tracking branch 'origin/master' into tiff-format
brianpopow Dec 1, 2020
22f7ec2
Change paletted tiff encoder tests
brianpopow Dec 1, 2020
0033108
Add support for undoing horizontal prediction: Works with deflate, st…
brianpopow Dec 1, 2020
57fe8ea
Change tiff namespace to SixLabors.ImageSharp.Formats.Experimental.Tiff
brianpopow Dec 1, 2020
8e85b1d
Fix issue writing too large color palette
brianpopow Dec 1, 2020
48c8346
Fix issue comparing to wrong image in encode paletted color tiff tests
brianpopow Dec 1, 2020
db7a996
Merge remote-tracking branch 'origin/master' into tiff-format
brianpopow Dec 2, 2020
74771b3
Fix broken test images
brianpopow Dec 2, 2020
f0b121e
Merge branch 'master' into tiff-format
JimBobSquarePants Dec 2, 2020
ed894cd
Fix build
JimBobSquarePants Dec 2, 2020
707d9f0
Use ReadFull extension to read the data from the stream
brianpopow Dec 2, 2020
73fdeee
Fix issue with huffman RLE where last bits of a row could get ignored
brianpopow Dec 2, 2020
163f499
Refactor Tiff decoder tests: split large "testall" test into smaller …
brianpopow Dec 3, 2020
56ac3f8
Add support for encoding tiff with deflate and horizontal predictor
brianpopow Dec 3, 2020
624a36c
#12 Tiff specific fixes for lzw
IldarKhayrutdinov Dec 3, 2020
7ac6fa6
Add support for encoding tiff's with lzw compression
brianpopow Dec 3, 2020
8e34f98
LzwEncoder now uses the memory allocator
brianpopow Dec 3, 2020
3a4c0d0
Perform tests files
IldarKhayrutdinov Dec 3, 2020
287c03f
Merge pull request #1457 from IldarKhayrutdinov/tiff-format
brianpopow Dec 3, 2020
b00104d
Rework horizontal predictor: Fixes issue with paletted images which u…
brianpopow Dec 4, 2020
9c05a3a
Move apply horizontal prediction to appropriate class
brianpopow Dec 4, 2020
c119adb
Allow horizontal prediction with palette and deflate
brianpopow Dec 4, 2020
f6f673e
Add option to use lzw with paletted image
brianpopow Dec 4, 2020
cbb6911
Add compression to the tiff metadata
brianpopow Dec 4, 2020
998d629
Add tiff encoder option to choose the deflate compression level
brianpopow Dec 4, 2020
2f15756
Merge remote-tracking branch 'origin/master' into tiff-format
brianpopow Dec 4, 2020
2525507
This reverts changes from commit 20fcf84311246ef08f98fa9b554b9eeb2600…
brianpopow Dec 5, 2020
c09d1f7
Duplicate PngCompressionLevel as DeflateCompressionLevel, mark PngCom…
brianpopow Dec 5, 2020
333ed01
Rename TiffByteOrder To ByteOrder, moved it to Common folder
brianpopow Dec 5, 2020
0e42ebb
Remove Tiff ImageExtension, this is already generated.
brianpopow Dec 5, 2020
cff52ba
Remove writing padding bytes, this seems not necessary
brianpopow Dec 5, 2020
f2c262d
Remove TiffUtils, use Stream extensions instead
brianpopow Dec 5, 2020
514facd
Merge branch 'master' into tiff-format
JimBobSquarePants Dec 6, 2020
a28b9c5
Fix little endian test file
brianpopow Dec 7, 2020
4175fb8
Add tests for tiff encoder options
brianpopow Dec 7, 2020
f9d953c
Simplified setting the compression in the tiff encoder
brianpopow Dec 7, 2020
5db5dd1
Move ZLib related classes from PNG folder to ImageSharp/Compression f…
brianpopow Dec 7, 2020
4bf3d16
Reworked lzw encoder with a tree based approach based on a java imple…
brianpopow Dec 8, 2020
c04c561
Merge branch 'master' into tiff-format
brianpopow Dec 8, 2020
57b19f5
Do not register Tiff in the default config: The user must do this man…
brianpopow Dec 8, 2020
901979b
Register tiff decoder/encoder in tiff meta data tests
brianpopow Dec 8, 2020
2f1f775
Use configuration instance in tiff tests instead of changing the defa…
brianpopow Dec 9, 2020
bc1bc8f
Update tiff benchmarks
IldarKhayrutdinov Dec 8, 2020
7282c7b
Improve performance tiff colors
IldarKhayrutdinov Dec 8, 2020
b4fd1bd
Use common zlib class for tiff deflate compressor. Stop using SubStre…
IldarKhayrutdinov Dec 8, 2020
16726ca
Update tiff benchmarks
IldarKhayrutdinov Dec 9, 2020
8d4dd2f
Cleanup
IldarKhayrutdinov Dec 9, 2020
f11bb87
Update exception message
IldarKhayrutdinov Dec 9, 2020
75b8569
Tiff colors improvements
IldarKhayrutdinov Dec 9, 2020
a3eb174
Remove not needed ToRgba()
brianpopow Dec 9, 2020
59bea78
Merge pull request #1467 from IldarKhayrutdinov/tiff-format
brianpopow Dec 9, 2020
8930260
Merge branch 'master' into tiff-format
brianpopow Dec 9, 2020
688d3dd
WIP Metadata refactory - implement TiffEncoderEntriesCollector; imple…
IldarKhayrutdinov Dec 10, 2020
23830a6
Add helper method to register the TIFF format
brianpopow Dec 11, 2020
827a365
Merge branch 'master' into tiff-format
brianpopow Dec 11, 2020
9d39c38
Improvements of tiff metadata - API and saving
IldarKhayrutdinov Dec 12, 2020
a16fa9e
Update README.md
IldarKhayrutdinov Dec 12, 2020
c14b7eb
Move resolution related methods to the extensions
IldarKhayrutdinov Dec 12, 2020
4bb6358
Move AddTiff to extension method
brianpopow Dec 13, 2020
3e73a38
netstandard 1.3 compatibility fix
IldarKhayrutdinov Dec 14, 2020
bc07090
Renaming
IldarKhayrutdinov Dec 14, 2020
7a0127f
Merge pull request #1471 from IldarKhayrutdinov/tiff_meta
brianpopow Dec 15, 2020
0915c79
A little cleanup:
brianpopow Dec 15, 2020
2faa1a2
Remove ByteOrder from tiff encoder options
brianpopow Dec 15, 2020
22c1e3f
Merge branch 'master' into tiff-format
brianpopow Dec 15, 2020
d07faed
Merge branch 'master' into tiff-format
JimBobSquarePants Dec 16, 2020
34fc4e8
Use ExifProfile for tiff frame metadata
IldarKhayrutdinov Dec 18, 2020
14d261f
Use exif reader for tiff tags reading, minor fixes for exif values.
IldarKhayrutdinov Jan 6, 2021
afa8a1b
Exif reader fixes
IldarKhayrutdinov Jan 7, 2021
d3bfc5f
Merge branch 'master' into tiff-format
JimBobSquarePants Jan 21, 2021
3600b3d
Exif/Tiff readers improvements
IldarKhayrutdinov Jan 25, 2021
c70ce8b
Implement benchmarks for Tiff encoder, rework decoder benchmarks
IldarKhayrutdinov Jan 25, 2021
ef068e6
Use directly ExifProfile methods instead TiffFrameMetadataExtensions
IldarKhayrutdinov Jan 26, 2021
ef24158
Change exception type
IldarKhayrutdinov Jan 26, 2021
d927ebb
Merge pull request #1496 from IldarKhayrutdinov/tiff-format-benchmarks
JimBobSquarePants Jan 26, 2021
6f8be2e
Merge branch 'master' into tiff-format
brianpopow Jan 26, 2021
d462759
Add gitignore for generated tiff's, add Markdown/Html exporter attrib…
brianpopow Jan 26, 2021
0e5938f
Parse T4 Options: honor eol padding, if present
brianpopow Jan 29, 2021
d8e086c
Merge branch 'tiff-format' into tiff-format
brianpopow Jan 29, 2021
fba1e60
entries.FrameTags => entries.ExifProfile
brianpopow Jan 29, 2021
9c62ab1
Merge pull request #1494 from IldarKhayrutdinov/tiff-format
JimBobSquarePants Jan 29, 2021
eebe08f
Fix conflict resolution mistake: Configuration was declared twice
brianpopow Jan 29, 2021
7d51106
Tiff decoder can now handle special case, when rowsPerStrip has the d…
brianpopow Jan 30, 2021
cab2e05
A little cleanup
brianpopow Jan 31, 2021
7152238
- Return default values, if compression, photometricInterpretation or…
brianpopow Jan 31, 2021
4e64aab
Split TiffWriter to the specialized classes
IldarKhayrutdinov Jan 30, 2021
2c11119
Add color factory, update decoder methods and tests
IldarKhayrutdinov Jan 30, 2021
98dde8e
Rename decompressors classes
IldarKhayrutdinov Jan 31, 2021
8d01c60
Cleanup
IldarKhayrutdinov Feb 1, 2021
e44d5ec
Merge pull request #1527 from IldarKhayrutdinov/tiff-format-refactory
brianpopow Feb 1, 2021
b6ce06d
Throw Exception, if StripOffsets or StripByteCounts is missing
brianpopow Feb 1, 2021
42fd0a8
Make sure we ignore any strips that are not needed for the image (if …
brianpopow Feb 2, 2021
2ee1150
Merge branch 'master' into tiff-format
brianpopow Feb 2, 2021
fbefe30
Do not read more than buffer.Length for uncompressed tiff
brianpopow Feb 2, 2021
d3a43a3
Throw Exception when packed bits compressed data is not enough
brianpopow Feb 2, 2021
f0670af
Handle TIFF image with incorrect IPTC data type (long instead of byte)
brianpopow Feb 2, 2021
7068ca1
Treat IPTC Undefined data type as byte array
brianpopow Feb 3, 2021
6ff1ed0
Merge branch 'master' into tiff-format
brianpopow Feb 3, 2021
2fa3da4
If no encoding mode is specified in the options, RGB will be used.
brianpopow Feb 4, 2021
8d92305
Merge branch 'master' into tiff-format
brianpopow Feb 4, 2021
586f8e5
Report 1-bit mode bug. Enable test images. Change test files.
IldarKhayrutdinov Feb 6, 2021
48796f8
Add benchmarks results
IldarKhayrutdinov Feb 7, 2021
9e13988
Support multi strip encoding for tiff. Improve performance and memory…
IldarKhayrutdinov Feb 6, 2021
74dacb6
Report palette lzw bug
IldarKhayrutdinov Feb 6, 2021
ace0d18
Update benchmark results
IldarKhayrutdinov Feb 7, 2021
5f02fe5
DebugGuard fixes
IldarKhayrutdinov Feb 7, 2021
785bbc9
Remove excess benchmark reports
IldarKhayrutdinov Feb 7, 2021
7292206
Update readme
IldarKhayrutdinov Feb 8, 2021
7c97634
Change BinaryDither to FloydSteinberg
brianpopow Feb 12, 2021
3b4bc1d
Remove TiffEncoderPixelStorageMethod, add CRC writing for deflate. Co…
IldarKhayrutdinov Feb 13, 2021
d3033b3
Replace lzw decompression implementation
brianpopow Feb 14, 2021
e27eb8c
Merge branch 'master' into tiff-format
brianpopow Feb 14, 2021
0e1e8fe
Use tolerant comparer for color palette tests
brianpopow Feb 14, 2021
f17c117
Merge remote-tracking branch 'upstream/tiff-format' into tiff-format
IldarKhayrutdinov Feb 14, 2021
4b210bb
Rename tests
IldarKhayrutdinov Feb 14, 2021
8cc2ce3
Correct test
IldarKhayrutdinov Feb 14, 2021
677800f
PackBits bug fix
IldarKhayrutdinov Feb 14, 2021
60dcaac
Remove excess clearing
IldarKhayrutdinov Feb 14, 2021
20726c3
Clarify some DebugGuard messages and a little cleanup
brianpopow Feb 15, 2021
2ec4787
Merge pull request #1537 from IldarKhayrutdinov/tiff-format
brianpopow Feb 15, 2021
572f616
Add PhotometricInterpretation to the tiff metadata
brianpopow Feb 15, 2021
8cee9a4
Add setter for DeflateCompressionLevel
brianpopow Feb 15, 2021
397d6ae
Merge branch 'master' into tiff-format
brianpopow Feb 15, 2021
4583765
Merge branch 'master' into tiff-format
JimBobSquarePants Feb 17, 2021
f597132
Merge branch 'master' into tiff-format
JimBobSquarePants Feb 17, 2021
c12f6a7
Merge branch 'master' into tiff-format
JimBobSquarePants Feb 17, 2021
3a46719
Merge branch 'master' into tiff-format
brianpopow Feb 17, 2021
6a8806f
Merge branch 'master' into tiff-format
JimBobSquarePants Feb 19, 2021
b0e965f
- Seal tiff writer
brianpopow Feb 23, 2021
8077172
Introduce TiffBitsPerSample enum
brianpopow Feb 25, 2021
ffa38bc
Remove properties from TiffFrame meta data which can be received dire…
brianpopow Feb 25, 2021
1dbe583
Allow encoding 4bit color palette images
brianpopow Mar 1, 2021
966d743
Rename tiff bits per pixels enum values
brianpopow Mar 1, 2021
8f3f35c
Re-add tests for color palette and deflate/lzw compression
brianpopow Mar 1, 2021
22e92ad
Rename TiffBitsPerSample enum values
brianpopow Mar 1, 2021
6bb1c80
Add explicit bit values to BitsPerSample
brianpopow Mar 3, 2021
b561ca2
Merge branch 'master' into tiff-format
brianpopow Mar 3, 2021
b588253
Use BinaryPrimitives instead of BitConverter and scratch buffer to av…
brianpopow Mar 5, 2021
f9570d3
Remove TiffFrameMetadataResolutionExtensions class
IldarKhayrutdinov Mar 8, 2021
4b28acf
Remove TiffEncoderCompression, use TiffCompression enum instead
brianpopow Mar 11, 2021
2a91b63
Merge branch 'master' into tiff-format
brianpopow Mar 11, 2021
3c1dc94
Fix build errors in benchmark project
brianpopow Mar 11, 2021
ecd6398
Merge pull request #1570 from IldarKhayrutdinov/tiff-format
JimBobSquarePants Mar 13, 2021
180af3c
Merge master branch
brianpopow Mar 15, 2021
8bba013
Add Tiff Encoder/Decoder to AoT seeds
brianpopow Mar 15, 2021
387eeba
Merge branch 'master' into tiff-format
brianpopow Apr 23, 2021
1388cfd
Merge branch 'master' into tiff-format
JimBobSquarePants Apr 23, 2021
13fbde9
Add setters for tiff metadata properties
brianpopow Apr 27, 2021
de3d036
Merge branch 'master' into tiff-format
brianpopow Apr 27, 2021
ebfda2c
Merge branch 'master' into tiff-format
brianpopow May 6, 2021
fa6401c
Change tiff namespace to SixLabors.ImageSharp.Formats.Tiff;
brianpopow May 7, 2021
de6e9dd
Use enum for the horizontal predictor method
brianpopow May 7, 2021
5fcb5fc
Review changes
brianpopow May 7, 2021
10a3e5e
Update HorizontalPredictor.cs
JimBobSquarePants May 8, 2021
10a12f7
Add TODO to TiffLZWDecoder
JimBobSquarePants May 8, 2021
4516ec4
Rename generic type classes to include the type in the filename
brianpopow May 9, 2021
a67bdc2
Remove the Func from SetSingle and SetArray
brianpopow May 9, 2021
fa68e1b
Read and write Exif Profile
brianpopow May 9, 2021
85a65ae
Remove width and height from tiff frame metadata
brianpopow May 10, 2021
875db67
Remove Tiff specific values from the EXIF profile
brianpopow May 10, 2021
587910f
Remove PhotometricInterpretation and Compression from tiff metadata, …
brianpopow May 10, 2021
275a6cc
Remove Exif profile from the image metadata: each frame will have its…
brianpopow May 10, 2021
411c7d6
Add setters for TiffFrameMetaData properties, initialize properties f…
brianpopow May 12, 2021
04b6f3f
Remove ExifProfile from TiffFrameMetadata, Add ExifProfile and XmpPro…
brianpopow May 14, 2021
09f4957
Make TiffFrameMetadata internal
brianpopow May 14, 2021
9ab7dcc
Merge branch 'master' into tiff-format
brianpopow May 14, 2021
fab1f3a
Make XMP internal, minor cleanup
JimBobSquarePants May 15, 2021
b0ecabb
Remove BitsPerPixel from TiffMetaData, its already present in TiffFra…
brianpopow May 18, 2021
6ba3f10
Remove setting XMP profile twice
brianpopow May 18, 2021
b9018d3
Merge branch 'master' into tiff-format
brianpopow May 18, 2021
e2bd192
Move IPTC and ICC Profile to image frame metadata
brianpopow May 18, 2021
a242475
Fix failing IPTC test
brianpopow May 18, 2021
8461c72
Remove properties from TiffFrameMetadata, which can be accessed by th…
brianpopow May 19, 2021
4094be1
Attempt at making frame metadata public
JimBobSquarePants May 19, 2021
dcb3e6f
Remove BitsPerSample from TiffFrameMetadata
brianpopow May 19, 2021
508844a
Fix failing tests
brianpopow May 19, 2021
d22692e
Change TiffEncoder to use TiffPhotometricInterpretation instead of En…
brianpopow May 20, 2021
11a4e20
Add Compression, PhotometricInterpretation and Predictor to TiffFrame…
brianpopow May 21, 2021
ccc3f9b
Rework setting tiff encoder parameters according to review
brianpopow May 23, 2021
787d630
Rework sanitize and set encoder options: BitsPerPixel should be the p…
brianpopow May 25, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion ImageSharp.sln
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28902.138
Expand Down
7 changes: 6 additions & 1 deletion src/ImageSharp/Advanced/AotCompilerTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using SixLabors.ImageSharp.Formats.Jpeg.Components;
using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.Formats.Tga;
using SixLabors.ImageSharp.Formats.Tiff;
using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
Expand Down Expand Up @@ -56,7 +57,7 @@ internal static class AotCompilerTools
/// necessary methods to complete the SaveAsGif call. That's it, otherwise you should NEVER need this method!!!
/// </remarks>
[Preserve]
private static void SeedEverything()
private static void SeedPixelFormats()
{
try
{
Expand Down Expand Up @@ -199,6 +200,7 @@ private static void AotCompileImageEncoderInternals<TPixel>()
default(JpegEncoderCore).Encode<TPixel>(default, default, default);
default(PngEncoderCore).Encode<TPixel>(default, default, default);
default(TgaEncoderCore).Encode<TPixel>(default, default, default);
default(TiffEncoderCore).Encode<TPixel>(default, default, default);
}

/// <summary>
Expand All @@ -214,6 +216,7 @@ private static void AotCompileImageDecoderInternals<TPixel>()
default(JpegDecoderCore).Decode<TPixel>(default, default, default);
default(PngDecoderCore).Decode<TPixel>(default, default, default);
default(TgaDecoderCore).Decode<TPixel>(default, default, default);
default(TiffDecoderCore).Decode<TPixel>(default, default, default);
}

/// <summary>
Expand All @@ -229,6 +232,7 @@ private static void AotCompileImageEncoders<TPixel>()
AotCompileImageEncoder<TPixel, JpegEncoder>();
AotCompileImageEncoder<TPixel, PngEncoder>();
AotCompileImageEncoder<TPixel, TgaEncoder>();
AotCompileImageEncoder<TPixel, TiffEncoder>();
}

/// <summary>
Expand All @@ -244,6 +248,7 @@ private static void AotCompileImageDecoders<TPixel>()
AotCompileImageDecoder<TPixel, JpegDecoder>();
AotCompileImageDecoder<TPixel, PngDecoder>();
AotCompileImageDecoder<TPixel, TgaDecoder>();
AotCompileImageDecoder<TPixel, TiffDecoder>();
}

/// <summary>
Expand Down
23 changes: 23 additions & 0 deletions src/ImageSharp/Common/ByteOrder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) Six Labors.
// Licensed under the Apache License, Version 2.0.

namespace SixLabors.ImageSharp
{
/// <summary>
/// The byte order of the data stream.
/// </summary>
public enum ByteOrder
{
/// <summary>
/// The big-endian byte order (Motorola).
/// Most-significant byte comes first, and ends with the least-significant byte.
/// </summary>
BigEndian,

/// <summary>
/// The little-endian byte order (Intel).
/// Least-significant byte comes first and ends with the most-significant byte.
/// </summary>
LittleEndian
}
}
50 changes: 49 additions & 1 deletion src/ImageSharp/Common/Helpers/UnitConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ internal static class UnitConverter
/// </summary>
private const double InchesInMeter = 1 / 0.0254D;

/// <summary>
/// The default resolution unit value.
/// </summary>
private const PixelResolutionUnit DefaultResolutionUnit = PixelResolutionUnit.PixelsPerInch;

/// <summary>
/// Scales the value from centimeters to meters.
/// </summary>
Expand Down Expand Up @@ -89,7 +94,50 @@ public static PixelResolutionUnit ExifProfileToResolutionUnit(ExifProfile profil
IExifValue<ushort> resolution = profile.GetValue(ExifTag.ResolutionUnit);

// EXIF is 1, 2, 3 so we minus "1" off the result.
return resolution is null ? default : (PixelResolutionUnit)(byte)(resolution.Value - 1);
return resolution is null ? DefaultResolutionUnit : (PixelResolutionUnit)(byte)(resolution.Value - 1);
}

/// <summary>
/// Sets the exif profile resolution values.
/// </summary>
/// <param name="exifProfile">The exif profile.</param>
/// <param name="unit">The resolution unit.</param>
/// <param name="horizontal">The horizontal resolution value.</param>
/// <param name="vertical">The vertical resolution value.</param>
[MethodImpl(InliningOptions.ShortMethod)]
public static void SetResolutionValues(ExifProfile exifProfile, PixelResolutionUnit unit, double horizontal, double vertical)
{
switch (unit)
{
case PixelResolutionUnit.AspectRatio:
case PixelResolutionUnit.PixelsPerInch:
case PixelResolutionUnit.PixelsPerCentimeter:
break;
case PixelResolutionUnit.PixelsPerMeter:
{
unit = PixelResolutionUnit.PixelsPerCentimeter;
horizontal = UnitConverter.MeterToCm(horizontal);
vertical = UnitConverter.MeterToCm(vertical);
}

break;
default:
unit = PixelResolutionUnit.PixelsPerInch;
break;
}

exifProfile.SetValue(ExifTag.ResolutionUnit, (ushort)(unit + 1));

if (unit == PixelResolutionUnit.AspectRatio)
{
exifProfile.RemoveValue(ExifTag.XResolution);
exifProfile.RemoveValue(ExifTag.YResolution);
}
else
{
exifProfile.SetValue(ExifTag.XResolution, new Rational(horizontal));
exifProfile.SetValue(ExifTag.YResolution, new Rational(vertical));
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#endif

#pragma warning disable IDE0007 // Use implicit type
namespace SixLabors.ImageSharp.Formats.Png.Zlib
namespace SixLabors.ImageSharp.Compression.Zlib
{
/// <summary>
/// Calculates the 32 bit Adler checksum of a given buffer according to
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Six Labors.
// Licensed under the Apache License, Version 2.0.

namespace SixLabors.ImageSharp.Formats.Png.Zlib
namespace SixLabors.ImageSharp.Compression.Zlib
{
/// <content>
/// Contains precalulated tables for scalar calculations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using System.Runtime.Intrinsics.X86;
#endif

namespace SixLabors.ImageSharp.Formats.Png.Zlib
namespace SixLabors.ImageSharp.Compression.Zlib
{
/// <summary>
/// Calculates the 32 bit Cyclic Redundancy Check (CRC) checksum of a given buffer
Expand Down
81 changes: 81 additions & 0 deletions src/ImageSharp/Compression/Zlib/DeflateCompressionLevel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// Copyright (c) Six Labors.
// Licensed under the Apache License, Version 2.0.

namespace SixLabors.ImageSharp.Compression.Zlib
{
/// <summary>
/// Provides enumeration of available deflate compression levels.
/// </summary>
public enum DeflateCompressionLevel
{
/// <summary>
/// Level 0. Equivalent to <see cref="NoCompression"/>.
/// </summary>
Level0 = 0,

/// <summary>
/// No compression. Equivalent to <see cref="Level0"/>.
/// </summary>
NoCompression = Level0,

/// <summary>
/// Level 1. Equivalent to <see cref="BestSpeed"/>.
/// </summary>
Level1 = 1,

/// <summary>
/// Best speed compression level.
/// </summary>
BestSpeed = Level1,

/// <summary>
/// Level 2.
/// </summary>
Level2 = 2,

/// <summary>
/// Level 3.
/// </summary>
Level3 = 3,

/// <summary>
/// Level 4.
/// </summary>
Level4 = 4,

/// <summary>
/// Level 5.
/// </summary>
Level5 = 5,

/// <summary>
/// Level 6. Equivalent to <see cref="DefaultCompression"/>.
/// </summary>
Level6 = 6,

/// <summary>
/// The default compression level. Equivalent to <see cref="Level6"/>.
/// </summary>
DefaultCompression = Level6,

/// <summary>
/// Level 7.
/// </summary>
Level7 = 7,

/// <summary>
/// Level 8.
/// </summary>
Level8 = 8,

/// <summary>
/// Level 9. Equivalent to <see cref="BestCompression"/>.
/// </summary>
Level9 = 9,

/// <summary>
/// Best compression level. Equivalent to <see cref="Level9"/>.
/// </summary>
BestCompression = Level9,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System;
using System.Runtime.CompilerServices;

namespace SixLabors.ImageSharp.Formats.Png.Zlib
namespace SixLabors.ImageSharp.Compression.Zlib
{
internal static class DeflateThrowHelper
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Memory;

namespace SixLabors.ImageSharp.Formats.Png.Zlib
namespace SixLabors.ImageSharp.Compression.Zlib
{
/// <summary>
/// This class compresses input with the deflate algorithm described in RFC 1951.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// <auto-generated/>
using System;

namespace SixLabors.ImageSharp.Formats.Png.Zlib
namespace SixLabors.ImageSharp.Compression.Zlib
{
/// <summary>
/// This class contains constants used for deflation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Memory;

namespace SixLabors.ImageSharp.Formats.Png.Zlib
namespace SixLabors.ImageSharp.Compression.Zlib
{
/// <summary>
/// Strategies for deflater
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Memory;

namespace SixLabors.ImageSharp.Formats.Png.Zlib
namespace SixLabors.ImageSharp.Compression.Zlib
{
/// <summary>
/// Performs Deflate Huffman encoding.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.IO;
using SixLabors.ImageSharp.Memory;

namespace SixLabors.ImageSharp.Formats.Png.Zlib
namespace SixLabors.ImageSharp.Compression.Zlib
{
/// <summary>
/// A special stream deflating or compressing the bytes that are
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Memory;

namespace SixLabors.ImageSharp.Formats.Png.Zlib
namespace SixLabors.ImageSharp.Compression.Zlib
{
/// <summary>
/// Stores pending data for writing data to the Deflater.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
using System;
using System.IO;
using System.Runtime.CompilerServices;
using SixLabors.ImageSharp.Formats.Png;
using SixLabors.ImageSharp.Memory;

namespace SixLabors.ImageSharp.Formats.Png.Zlib
namespace SixLabors.ImageSharp.Compression.Zlib
{
/// <summary>
/// Provides methods and properties for compressing streams by using the Zlib Deflate algorithm.
Expand Down Expand Up @@ -39,9 +40,19 @@ internal sealed class ZlibDeflateStream : Stream
/// <summary>
/// The stream responsible for compressing the input stream.
/// </summary>
// private DeflateStream deflateStream;
private DeflaterOutputStream deflateStream;

/// <summary>
/// Initializes a new instance of the <see cref="ZlibDeflateStream"/> class.
/// </summary>
/// <param name="memoryAllocator">The memory allocator to use for buffer allocations.</param>
/// <param name="stream">The stream to compress.</param>
/// <param name="level">The compression level.</param>
public ZlibDeflateStream(MemoryAllocator memoryAllocator, Stream stream, DeflateCompressionLevel level)
: this(memoryAllocator, stream, (PngCompressionLevel)level)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="ZlibDeflateStream"/> class.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.IO.Compression;
using SixLabors.ImageSharp.IO;

namespace SixLabors.ImageSharp.Formats.Png.Zlib
namespace SixLabors.ImageSharp.Compression.Zlib
{
/// <summary>
/// Provides methods and properties for deframing streams from PNGs.
Expand Down
4 changes: 2 additions & 2 deletions src/ImageSharp/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ public int StreamProcessingBufferSize
}

/// <summary>
/// Gets a set of properties for the Congiguration.
/// Gets a set of properties for the Configuration.
/// </summary>
/// <remarks>This can be used for storing global settings and defaults to be accessable to processors.</remarks>
/// <remarks>This can be used for storing global settings and defaults to be accessible to processors.</remarks>
public IDictionary<object, object> Properties { get; } = new ConcurrentDictionary<object, object>();

/// <summary>
Expand Down
Loading