imazen / imazen/imageflow-go

ConstrainWithin(weight, hight) , Is it the hight not force?

Open
#4 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
20
Forks
8
PR merge metrics
No merged PRs in 30d

Description

I code like this.
```go
func ImageThumb(sBuffer []byte, w float64, h float64) ([]byte, error) {
step := imageflow.NewStep()
data, err := step.Decode(
imageflow.NewBuffer(sBuffer),
// FIXME: hight is not force
).ConstrainWithin(w, h).Encode(imageflow.GetBuffer("thumb"), imageflow.MozJPEG{Quality: 60}).Execute()
if err != nil {
return nil, err
}
//ioutil.WriteFile(fmt.Sprintf("test_%fx%f.jpeg", w, h), data["thumb"], 0644)
return data["thumb"], nil
}
```
But I found , the 'hight' arg is not work well. When call this func, `ImageThumb(sButter, 80 , 80)`
Maybe I can get a image with size 80 * 40 , or any other hight , seems to depend on what the original picture‘s hight

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the ImageThumb example with ConstrainWithin(80, 80) and inspect the resulting image dimensions. Trace the Go binding's ConstrainWithin entry point to determine whether the aspect-ratio-preserving result is expected or indicates a defect. Done means confirming the intended height behavior and documenting or testing the result.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.