Giter VIP home page Giter VIP logo

Comments (6)

bigtallbill avatar bigtallbill commented on August 16, 2024 10

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.

ernsheong avatar ernsheong commented on August 16, 2024 3

A candidate for https://github.com/gofrs see gofrs/help-requests#3

from resize.

ernsheong avatar ernsheong commented on August 16, 2024 2

Why not open it up to the community?

from resize.

flibustenet avatar flibustenet commented on August 16, 2024

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.

zeusro avatar zeusro commented on August 16, 2024

Thx.

from resize.

ealipio avatar ealipio commented on August 16, 2024

@nfnt thanks for your time, it's an awesome tool 😄 it's a pitty see you go

from resize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.