Skip to content

Commit e0340c1

Browse files
committed
Merge branch 'main' of https://github.com/ashwani-rathee/ExifViewer.jl into main
2 parents 2b71c98 + 32bae9a commit e0340c1

File tree

3 files changed

+143
-43
lines changed

3 files changed

+143
-43
lines changed

.github/workflows/docs.yml

+21-35
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,28 @@
1-
name: Documentation
2-
1+
name: docs
32
on:
4-
pull_request:
5-
push:
6-
branches:
7-
- 'master'
8-
- 'release-'
9-
tags: '*'
10-
release:
11-
types: [published]
12-
3+
- push
4+
- pull_request
135
jobs:
14-
build:
15-
runs-on: ${{ matrix.os }}
16-
strategy:
17-
matrix:
18-
julia-version: [1]
19-
os: [ubuntu-latest]
6+
docs:
7+
name: Documentation
8+
runs-on: ubuntu-latest
209
steps:
2110
- uses: actions/checkout@v2
22-
- uses: julia-actions/setup-julia@latest
11+
- uses: julia-actions/setup-julia@v1
2312
with:
24-
version: ${{ matrix.julia-version }}
25-
- name: Cache artifacts
26-
uses: actions/cache@v1
27-
env:
28-
cache-name: cache-artifacts
29-
with:
30-
path: ~/.julia/artifacts
31-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
32-
restore-keys: |
33-
${{ runner.os }}-test-${{ env.cache-name }}-
34-
${{ runner.os }}-test-
35-
${{ runner.os }}-
36-
- name: Install dependencies
37-
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
38-
- name: Build and deploy
13+
version: '1'
14+
- run: |
15+
julia --project=docs -e '
16+
using Pkg
17+
Pkg.develop(PackageSpec(path=pwd()))
18+
Pkg.instantiate()'
19+
- run: |
20+
julia --project=docs -e '
21+
using Documenter: DocMeta, doctest
22+
using ExifViewer
23+
DocMeta.setdocmeta!(ExifViewer, :DocTestSetup, :(using ExifViewer); recursive=true)
24+
doctest(ExifViewer)'
25+
- run: julia --project=docs docs/make.jl
3926
env:
4027
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41-
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
42-
run: julia --project=docs/ docs/make.jl
28+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}

README.md

+110-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,111 @@
1-
# ExifViewer.jl
21

3-
Provides access to exif data in Julia
2+
3+
![](https://i.imgur.com/cvFnyt4.png)
4+
5+
<p style="text-align: center;">
6+
ExifViewer.jl is a Julia wrapper of the C library libexif that provides EXIF support. EXIF is short for Exchangeable Image File, a format that is a standard for storing interchange information in digital photography image files using JPEG compression.
7+
</p>
8+
9+
[![Docs-dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://ashwani-rathee.github.io/ExifViewer.jl) [![Slack](https://img.shields.io/badge/chat-slack-e01e5a)](https://join.slack.com/t/julialang/shared_invite/zt-1hxxb5ryp-Ts_egJ7FRN2muQ7nkTtCNQ) [![License: MIT](https://img.shields.io/badge/License-MIT-success.svg)](https://opensource.org/licenses/MIT) [![Downloads](https://shields.io/endpoint?url=https://pkgs.genieframework.com/api/v1/badge/ExifViewer)](https://pkgs.genieframework.com?packages=ExifViewer)
10+
### Installation
11+
---
12+
If you have not yet installed Julia, please follow the [instructions](https://julialang.org/downloads/platform/) for your operating system.
13+
14+
Stable Version
15+
```julia
16+
# Enter ']' from the REPL to enter Pkg mode.
17+
pkg> add ExifViewer
18+
```
19+
20+
Dev Version
21+
```julia
22+
using Pkg
23+
# Enter ']' from the REPL to enter Pkg mode.
24+
pkg> add https://github.com/ashwani-rathee/ExifViewer.jl.git
25+
```
26+
27+
### Usage
28+
29+
ExifViewer.jl provides method to read EXIF tags from images using `read_tags` methods which can
30+
take input in form of Filepath, IO, and bytes sequence(`Vector{UInt8}`)
31+
32+
`read_tags` reads EXIF tags from the input source data and it returns an empty
33+
dictionary if the source data doesn't contain EXIF tags.
34+
There are couple of keyword arguments that are used by `read_tags` which have been
35+
described below:
36+
37+
#### Keyword Arguments
38+
- `ifds::Union{Int,NTuple,UnitRange}` : Defines which IFD(Image file directory) to search in for the EXIF tags. Default is all ifds i.e. 1:5.
39+
- `read_all::Bool` : Defines if all EXIF tags are to be read or not. By default, `read_all` is true.
40+
- `tags::Vector{LibExif.ExifTag}` : Defines which tags to search, in case `read_all` is false. When `read_all` is false, tags that need to be searched need to defined manually. Tags can be provided using bunch of methods but its suggested to supply a vector of strings with each string representing a EXIF tag i.e. ["`EXIF_TAG_FLASH_PIX_VERSION`", "`EXIF_TAG_ORIENTATION`"]
41+
42+
- `extract_thumbnail::Bool` : Defines whether to read the thumbnail data or not. By default, `extract_thumbnail` is false.
43+
- `read_mnote::Bool` : Defines whether to read the mnote(MakerNote) tags data or not. By default, `read_mnote` is false.
44+
45+
List of all available tags to search is available here: https://libexif.github.io/internals/exif-tag_8h.html
46+
47+
#### Examples
48+
```jl
49+
julia> using TestImages, ExifViewer
50+
julia> filepath = testimage("earth_apollo17.jpg", download_only=true)
51+
julia> io = open(filepath, "r")
52+
julia> read_tags(io; read_all=false, tags=["EXIF_TAG_FLASH_PIX_VERSION", "EXIF_TAG_ORIENTATION"])
53+
Dict{Any, Any} with 2 entries:
54+
"EXIF_TAG_FLASH_PIX_VERSION" => "FlashPix Version 1.0"
55+
"EXIF_TAG_ORIENTATION" => "Top-left"
56+
57+
julia> read_tags(filepath; read_all=false, tags=["EXIF_TAG_FLASH_PIX_VERSION", "EXIF_TAG_ORIENTATION"])
58+
Dict{Any, Any} with 2 entries:
59+
"EXIF_TAG_FLASH_PIX_VERSION" => "FlashPix Version 1.0"
60+
"EXIF_TAG_ORIENTATION" => "Top-left"
61+
62+
julia> data = read(filepath)
63+
julia> read_tags(data, read_all=false, tags=["EXIF_TAG_FLASH_PIX_VERSION", "EXIF_TAG_ORIENTATION"])
64+
Dict{Any, Any} with 2 entries:
65+
"EXIF_TAG_FLASH_PIX_VERSION" => "FlashPix Version 1.0"
66+
"EXIF_TAG_ORIENTATION" => "Top-left"
67+
68+
```
69+
70+
Method to write exif data to files is also provided using `write_tags` and it writes EXIF tags to a
71+
filepath(currently support for jpeg and jpg available).
72+
73+
#### Keyword Arguments
74+
- `filepath::AbstractString` : Name of the file to which image and exif is written.
75+
- `img::AbstractArray` : Image Array whose exif data is being written to the filepath mentioned above.
76+
- `tags::Dict{String,Any}` : EXIF tags and their corresponding values as defined in libexif library
77+
78+
#### Examples
79+
80+
```jl
81+
julia> using ExifViewer, TestImages
82+
julia> img = testimage("mandrill")
83+
84+
julia> tags = Dict{String, Any}(
85+
"EXIF_TAG_MAKE"=>"Canon",
86+
"EXIF_TAG_ORIENTATION"=>"Top-left",
87+
"EXIF_TAG_X_RESOLUTION"=>"300",
88+
"EXIF_TAG_Y_RESOLUTION"=>"300",
89+
)
90+
julia> write_tags("test.jpg"; img, tags=tags)
91+
92+
julia> read_tags("test.jpg")
93+
Dict{String, Any} with 10 entries:
94+
"EXIF_TAG_COLOR_SPACE" => "Uncalibrated"
95+
"EXIF_TAG_COMPONENTS_CONFIGURATION" => "Y Cb Cr -"
96+
"EXIF_TAG_FLASH_PIX_VERSION" => "FlashPix Version 1.0"
97+
"EXIF_TAG_Y_RESOLUTION" => "300"
98+
"EXIF_TAG_ORIENTATION" => "Top-left"
99+
"EXIF_TAG_EXIF_VERSION" => "Exif Version 2.1"
100+
"EXIF_TAG_RESOLUTION_UNIT" => "Inch"
101+
"EXIF_TAG_MAKE" => "Canon"
102+
"EXIF_TAG_YCBCR_POSITIONING" => "Centered"
103+
"EXIF_TAG_X_RESOLUTION" => "300"
104+
```
105+
106+
Note: Some tags are present by default like EXIF version, FLASHPIX version etc as can be seen in example above.
107+
108+
109+
### Contributions and Issues:
110+
111+
If you have questions about ExifViewer.jl, feel free to get in touch via Slack or open an issue :hearts:

docs/make.jl

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
1+
push!(LOAD_PATH,"../src/")
12
using ExifViewer
23
using Documenter
34

4-
format = Documenter.HTML(
5-
prettyurls = get(ENV, "CI", nothing) == "true"
6-
)
5+
DocMeta.setdocmeta!(ExifViewer, :DocTestSetup, :(using ExifViewer); recursive=true)
76

87
makedocs(;
98
modules=[ExifViewer],
9+
authors="Ashwani Rathee",
10+
repo="github.com/ashwani-rathee/ExifViewer.jl/blob/{commit}{path}#{line}",
1011
sitename="ExifViewer.jl",
11-
format=format,
12+
format=Documenter.HTML(;
13+
prettyurls=Base.get(ENV, "CI", "false") == "true",
14+
canonical="https://ashwani-rathee.github.io/ExifViewer.jl",
15+
assets=String[],
16+
),
1217
pages=[
1318
"Home" => "index.md",
1419
],
1520
)
1621

1722
deploydocs(;
1823
repo="github.com/ashwani-rathee/ExifViewer.jl",
19-
devbranch="master",
20-
)
24+
devbranch="main",
25+
push_preview = true
26+
)

0 commit comments

Comments
 (0)