Comments (6)
As i had trouble finding examples using golang.org/x/image/draw to scale an image i cobbled together this basic example:
// Scale will use the provided scaler to resize src to the bounds in rect
// It will always return an RGBA image
func Scale(src image.Image, rect image.Rectangle, scale draw.Scaler) image.Image {
dst := image.NewRGBA(rect)
scale.Scale(dst, rect, src, src.Bounds(), draw.Over, nil)
return dst
}
Usage:
scaled := Scale(src, image.Rect(0, 0, 200, 200), draw.ApproxBiLinear)
full credit goes to this gist https://gist.github.com/logrusorgru/570d64fd6a051e0441014387b89286ca
from resize.
A candidate for https://github.com/gofrs see gofrs/help-requests#3
from resize.
Why not open it up to the community?
from resize.
Thanks for everything, it just work for me ! I hope somebody will continue to maintain it...
Maybe you could tag it to make it friendly with vgo ? It can also help for an eventual fork.
from resize.
Thx.
from resize.
@nfnt thanks for your time, it's an awesome tool 😄 it's a pitty see you go
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
- 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.