Comments (2)
Hello, I think it's because rgbe.Decode
uses a bufio.NewReader
with a buffer of 4096 bytes. The next image has been partially read during the decoding of the first image.
Decoder assumes that only one image is read.
Alternatively, you can use a bytes.Reader
that is seekable:
package main
import (
"bytes"
"image"
"io"
"os"
"github.com/mdouchement/hdr"
"github.com/mdouchement/hdr/codec/rgbe"
)
func main() {
f, err := os.Open("memorial_o876.hdr")
check(err)
defer f.Close()
m, _, err := image.Decode(f)
check(err)
img := m.(hdr.Image)
var buf bytes.Buffer
err = rgbe.Encode(&buf, img)
check(err)
n := buf.Len()
err = rgbe.Encode(&buf, img)
check(err)
r := bytes.NewReader(buf.Bytes())
_, err = rgbe.Decode(r)
check(err)
_, err = r.Seek(int64(n), io.SeekStart) // Set the start of the second image
check(err)
_, err = rgbe.Decode(r)
check(err)
}
func check(err error) {
if err != nil {
panic(err)
}
}
from hdr.
Oh god, I didn't expect a response so fast and so complete.
So this a feature, not a bug!
That was how I intended to go through the issue, but I couldn't sleep without understanding why I had to do that.
Thank you very much for your time!
from hdr.
Related Issues (13)
- [iCAM06] White adaptation with Bilateral filter is as good and faster
- Add Gopkg files HOT 1
- Go 1.11 Modules
- GolangCI-Lint
- Think about github.com/golang-standards/project-layout HOT 1
- Named package (aka no `util` package)
- tmo.LumPixFloor could be a function and not an array
- Replace with **drago03** TMO for better results.
- implementation of the fattal02 TMO HOT 1
- Add buffer reader on RGBE parser HOT 1
- [iCAM06] Smart percentile function
- [iCAM06] Bad White Adaptation due to StackBlur
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hdr.