Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: readium/go-toolkit
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: develop
Choose a base ref
...
head repository: readium/go-toolkit
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: image-inference
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 4 commits
  • 9 files changed
  • 1 contributor

Commits on Feb 26, 2025

  1. Copy the full SHA
    c56ac45 View commit details
  2. Add size property to Link

    chocolatkey committed Feb 26, 2025
    Copy the full SHA
    f715407 View commit details
  3. Copy the full SHA
    f9184ca View commit details
  4. Add WIP image analyzer

    chocolatkey committed Feb 26, 2025
    Copy the full SHA
    c132136 View commit details
Showing with 669 additions and 24 deletions.
  1. +32 −0 cmd/analyzer/main.go
  2. +10 −7 go.mod
  3. +223 −3 go.sum
  4. +330 −0 pkg/analyzer/image.go
  5. +3 −0 pkg/manifest/href.go
  6. +5 −0 pkg/manifest/link.go
  7. +13 −3 pkg/mediatype/mediatype_of.go
  8. +52 −10 pkg/mediatype/sniffer_content.go
  9. +1 −1 pkg/mediatype/sniffer_context.go
32 changes: 32 additions & 0 deletions cmd/analyzer/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package main

import (
"encoding/json"
"os"

"github.com/readium/go-toolkit/pkg/analyzer"
"github.com/readium/go-toolkit/pkg/manifest"
)

func main() {
if len(os.Args) < 2 {
panic("usage: " + os.Args[0] + " <test dir image name>")
}

r, err := os.OpenRoot("./test")
if err != nil {
panic(err)
}
defer r.Close()
fs := r.FS()

link, _, err := analyzer.Image(fs, manifest.Link{
Href: manifest.MustNewHREFFromString(os.Args[1], false),
}, true)
if err != nil {
panic(err)
}

bin, _ := json.Marshal(link)
println(string(bin))
}
17 changes: 10 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
module github.com/readium/go-toolkit

go 1.22.0

toolchain go1.23.5
go 1.24.0

require (
github.com/CAFxX/httpcompression v0.0.9
github.com/agext/regexp v1.3.0
github.com/andybalholm/cascadia v1.3.3
github.com/azr/phash v0.2.0
github.com/bbrks/go-blurhash v1.1.1
github.com/deckarep/golang-set v1.8.0
github.com/disintegration/imaging v1.6.2
github.com/go-viper/mapstructure/v2 v2.2.1
github.com/gorilla/mux v1.8.1
github.com/gotd/contrib v0.21.0
github.com/kettek/apng v0.0.0-20220823221153-ff692776a607
github.com/pdfcpu/pdfcpu v0.9.1
github.com/pkg/errors v0.9.1
github.com/readium/xmlquery v0.0.0-20230106230237-8f493145aef4
@@ -21,14 +23,17 @@ require (
github.com/trimmer-io/go-xmp v1.0.0
github.com/vmihailenco/go-tinylfu v0.2.2
github.com/zeebo/xxh3 v1.0.2
go4.org v0.0.0-20230225012048-214862532bf5
golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c
golang.org/x/image v0.23.0
golang.org/x/net v0.34.0
golang.org/x/text v0.21.0
golang.org/x/text v0.22.0
)

require (
github.com/andybalholm/brotli v1.1.1 // indirect
github.com/antchfx/xpath v1.3.3 // indirect
github.com/azr/gift v1.1.2 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
@@ -39,9 +44,7 @@ require (
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.6 // indirect
golang.org/x/image v0.23.0 // indirect
golang.org/x/sys v0.29.0 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
golang.org/x/sys v0.30.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading