Comments (5)
curiously enough this code works fine:
package main
import (
"github.com/disintegration/imaging"
"github.com/nfnt/resize"
"os"
)
func main() {
reader, _ := os.Open("test/1.jpg")
defer reader.Close()
m, _ := imaging.Decode(reader)
m = resize.Resize(32, 32, m, resize.Bicubic)
file, _ := os.OpenFile("test/1.png", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
imaging.Encode(file, m, imaging.PNG)
defer file.Close()
}
but disintegration/imaging
library has its own resize function, so there is no point in using them both together.
from resize.
I can see the artifacts in the resulting image but judging from your code it seems that the resize package is not responsibly for that. The only thing that's changed is the call to imaging.Encode
which wraps png.Encode
, i.e. both samples /should/ do exactly the same. How did you create the expected image?
from resize.
expected image was created using resize function from imagine library using the code similar to my second example.
i think the reason for such strange behaviour is that im loading image using imagine.Decode
. it always converts image to NRGBA format and sets image boundaries to start from (0,0).
P.S. have you tried to run my code? can you reproduce the issue?
from resize.
I had the same problem: Upscaling this image resulted in an very white and strange coloring.
from resize.
Fixed with commit dc93e1b. This would only happen with JPEG images, as these use chroma subsampling.
from resize.
Related Issues (20)
- Benchmark HOT 2
- Don't reverse alpha premultiplication, it's fundamentally wrong HOT 6
- Resized image lost all metadata HOT 1
- 1px black border after resize png images HOT 2
- debian control file have hardcoded version. HOT 1
- Transparent images cause black coloring HOT 1
- panic: index out of range when resize some picture HOT 4
- ycc.go:126: undefined: image.YCbCrSubsampleRatio440 HOT 1
- Panic on Resize HOT 6
- Please version this repository HOT 1
- Increased file size after resizing (downscaling) HOT 4
- image not show on mobile browser after resizing HOT 1
- Panic on resize 2 HOT 2
- Detecting file format HOT 3
- Resizing animated gif HOT 1
- I'm no longer updating this package. HOT 6
- Error output is generated
- png image format is not recognized HOT 1
- High memory usage when processing many high-resolution images
- can you supper tiff
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 resize.