diff options
| author | 2024-08-02 11:46:41 +0000 | |
|---|---|---|
| committer | 2024-08-02 12:46:41 +0100 | |
| commit | 94e87610c4ce9bbb1c614a61bab29c1422fed11b (patch) | |
| tree | 2e06b8ce64212140e796f6077ba841b6cc678501 /vendor/github.com/dsoprea/go-utility/v2/image | |
| parent | [feature] Allow import of following and blocks via CSV (#3150) (diff) | |
| download | gotosocial-94e87610c4ce9bbb1c614a61bab29c1422fed11b.tar.xz | |
[chore] add back exif-terminator and use only for jpeg,png,webp (#3161)
* add back exif-terminator and use only for jpeg,png,webp
* fix arguments passed to terminateExif()
* pull in latest exif-terminator
* fix test
* update processed img
---------
Co-authored-by: tobi <tobi.smethurst@protonmail.com>
Diffstat (limited to 'vendor/github.com/dsoprea/go-utility/v2/image')
| -rw-r--r-- | vendor/github.com/dsoprea/go-utility/v2/image/README.md | 9 | ||||
| -rw-r--r-- | vendor/github.com/dsoprea/go-utility/v2/image/media_parser_type.go | 34 |
2 files changed, 43 insertions, 0 deletions
diff --git a/vendor/github.com/dsoprea/go-utility/v2/image/README.md b/vendor/github.com/dsoprea/go-utility/v2/image/README.md new file mode 100644 index 000000000..1509ff666 --- /dev/null +++ b/vendor/github.com/dsoprea/go-utility/v2/image/README.md @@ -0,0 +1,9 @@ +[](https://godoc.org/github.com/dsoprea/go-utility/image) +[](https://travis-ci.org/dsoprea/go-utility) +[](https://coveralls.io/github/dsoprea/go-utility?branch=master) +[](https://goreportcard.com/report/github.com/dsoprea/go-utility) + +# media_parser_type + +Common image-parsing interfaces. Used for JPEG, PNG, and HEIC parsers used by +go-exif-knife. diff --git a/vendor/github.com/dsoprea/go-utility/v2/image/media_parser_type.go b/vendor/github.com/dsoprea/go-utility/v2/image/media_parser_type.go new file mode 100644 index 000000000..8776a1fdd --- /dev/null +++ b/vendor/github.com/dsoprea/go-utility/v2/image/media_parser_type.go @@ -0,0 +1,34 @@ +package riimage + +import ( + "io" + + "github.com/dsoprea/go-exif/v3" +) + +// MediaContext is an accessor that knows how to extract specific metadata from +// the media. +type MediaContext interface { + // Exif returns the EXIF's root IFD. + Exif() (rootIfd *exif.Ifd, data []byte, err error) +} + +// MediaParser prescribes a specific structure for the parser types that are +// imported from other projects. We don't use it directly, but we use this to +// impose structure. +type MediaParser interface { + // Parse parses a stream using an `io.ReadSeeker`. `mc` should *actually* be + // a `ExifContext`. + Parse(r io.ReadSeeker, size int) (mc MediaContext, err error) + + // ParseFile parses a stream using a file. `mc` should *actually* be a + // `ExifContext`. + ParseFile(filepath string) (mc MediaContext, err error) + + // ParseBytes parses a stream direct from bytes. `mc` should *actually* be + // a `ExifContext`. + ParseBytes(data []byte) (mc MediaContext, err error) + + // Parses the data to determine if it's a compatible format. + LooksLikeFormat(data []byte) bool +} |
