All Projects → nfnt → Resize

nfnt / Resize

Licence: isc
Pure golang image resizing

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Resize

Bild
Image processing algorithms in pure Go
Stars: ✭ 3,431 (+24.09%)
Mutual labels:  image-processing, resize
Sharp
High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.
Stars: ✭ 21,131 (+664.23%)
Mutual labels:  image-processing, resize
Mort
Storage and image processing server written in Go
Stars: ✭ 420 (-84.81%)
Mutual labels:  image-processing, resize
Pyimsegm
Image segmentation - general superpixel segmentation & center detection & region growing
Stars: ✭ 213 (-92.3%)
Mutual labels:  image-processing
Agimagecontrols
cool tools for image edition
Stars: ✭ 217 (-92.15%)
Mutual labels:  image-processing
Catalyst
Accelerated deep learning R&D
Stars: ✭ 2,804 (+1.41%)
Mutual labels:  image-processing
Node S3 Uploader
Flexible and efficient resize, rename, and upload images to Amazon S3 disk storage. Uses the official AWS Node SDK for transfer, and ImageMagick for image processing. Support for multiple image versions targets.
Stars: ✭ 237 (-91.43%)
Mutual labels:  image-processing
Marvinj
Javascript Image Processing Framework based on Marvin Framework
Stars: ✭ 213 (-92.3%)
Mutual labels:  image-processing
Imageglass
🏞 A lightweight, versatile image viewer
Stars: ✭ 3,284 (+18.77%)
Mutual labels:  image-processing
Thug Memes
Command line Thug Meme generator written in Python
Stars: ✭ 224 (-91.9%)
Mutual labels:  image-processing
Superpixels Revisited
Library containing 7 state-of-the-art superpixel algorithms with a total of 9 implementations used for evaluation purposes in [1] utilizing an extended version of the Berkeley Segmentation Benchmark.
Stars: ✭ 222 (-91.97%)
Mutual labels:  image-processing
Gwu data mining
Materials for GWU DNSC 6279 and DNSC 6290.
Stars: ✭ 217 (-92.15%)
Mutual labels:  image-processing
Image Compress Without Backend
Pure frontend solution to compress images
Stars: ✭ 224 (-91.9%)
Mutual labels:  image-processing
Iipsrv
iipsrv is an advanced high-performance feature-rich image server for web-based streamed viewing and zooming of ultra high-resolution images.
Stars: ✭ 216 (-92.19%)
Mutual labels:  image-processing
Nyximageskit
A set of efficient categories for UIImage class. It allows filtering, resizing, masking, rotating, enhancing... and more.
Stars: ✭ 2,553 (-7.67%)
Mutual labels:  image-processing
Swiftuiimageeffects
Swift port of Apple UIImage+UIImageEffecs category.
Stars: ✭ 213 (-92.3%)
Mutual labels:  image-processing
Graphite
Open source 2D node-based raster/vector graphics editor (Photoshop + Illustrator + Houdini = Graphite)
Stars: ✭ 223 (-91.93%)
Mutual labels:  image-processing
Simplecv
Stars: ✭ 2,522 (-8.79%)
Mutual labels:  image-processing
Obs Kinect
OBS Plugin to use a Kinect (all models supported) in OBS (and setup a virtual green screen based on depth and/or body detection).
Stars: ✭ 217 (-92.15%)
Mutual labels:  image-processing
Zoom Learn Zoom
computational zoom from raw sensor data
Stars: ✭ 224 (-91.9%)
Mutual labels:  image-processing

This package is no longer being updated! Please look for alternatives if that bothers you.

Resize

Image resizing for the Go programming language with common interpolation methods.

Build Status

Installation

$ go get github.com/nfnt/resize

It's that easy!

Usage

This package needs at least Go 1.1. Import package with

import "github.com/nfnt/resize"

The resize package provides 2 functions:

  • resize.Resize creates a scaled image with new dimensions (width, height) using the interpolation function interp. If either width or height is set to 0, it will be set to an aspect ratio preserving value.
  • resize.Thumbnail downscales an image preserving its aspect ratio to the maximum dimensions (maxWidth, maxHeight). It will return the original image if original sizes are smaller than the provided dimensions.
resize.Resize(width, height uint, img image.Image, interp resize.InterpolationFunction) image.Image
resize.Thumbnail(maxWidth, maxHeight uint, img image.Image, interp resize.InterpolationFunction) image.Image

The provided interpolation functions are (from fast to slow execution time)

Which of these methods gives the best results depends on your use case.

Sample usage:

package main

import (
	"github.com/nfnt/resize"
	"image/jpeg"
	"log"
	"os"
)

func main() {
	// open "test.jpg"
	file, err := os.Open("test.jpg")
	if err != nil {
		log.Fatal(err)
	}

	// decode jpeg into image.Image
	img, err := jpeg.Decode(file)
	if err != nil {
		log.Fatal(err)
	}
	file.Close()

	// resize to width 1000 using Lanczos resampling
	// and preserve aspect ratio
	m := resize.Resize(1000, 0, img, resize.Lanczos3)

	out, err := os.Create("test_resized.jpg")
	if err != nil {
		log.Fatal(err)
	}
	defer out.Close()

	// write new image to file
	jpeg.Encode(out, m, nil)
}

Caveats

  • Optimized access routines are used for image.RGBA, image.NRGBA, image.RGBA64, image.NRGBA64, image.YCbCr, image.Gray, and image.Gray16 types. All other image types are accessed in a generic way that will result in slow processing speed.
  • JPEG images are stored in image.YCbCr. This image format stores data in a way that will decrease processing speed. A resize may be up to 2 times slower than with image.RGBA.

Downsizing Samples

Downsizing is not as simple as it might look like. Images have to be filtered before they are scaled down, otherwise aliasing might occur. Filtering is highly subjective: Applying too much will blur the whole image, too little will make aliasing become apparent. Resize tries to provide sane defaults that should suffice in most cases.

Artificial sample

Original image Rings


Nearest-Neighbor

Bilinear

Bicubic

Mitchell-Netravali

Lanczos2

Lanczos3

Real-Life sample

Original image
Original


Nearest-Neighbor

Bilinear

Bicubic

Mitchell-Netravali

Lanczos2

Lanczos3

License

Copyright (c) 2012 Jan Schlicht [email protected] Resize is released under a MIT style license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].