Giter Site home page Giter Site logo

file-processor's Introduction

File Processor

A GO library for manipulating and processing images

GoDoc GoDoc Gitter License: MIT FOSSA Status

Prerequisites

This package needs at least Go 1.15.6

Installation

 go get -u github.com/rayne22/file-processor

Easy right...

Usage

Import package using

import "github.com/rayne22/file-processor/process"

Image Resizing

  • process.ResizeImage produces a scaled image based on the width and height provided using the interpolation. If there is need to preserve the aspect ratio, the width or height can be set to 0.
Struct
type UploadedImage struct {
	Path        string `json:"path"`
	ImageName   string `json:"image_name"`
	Width       uint   `json:"width"`
	Height      uint   `json:"height"`
	Request     multipart.File
	ImageHeader *multipart.FileHeader
}
Function
func (u *UploadedImage) ResizeImage() string 

Example

processor := process.UploadedImage{}  //Initializing the Struct


processor.Height = 200  // Adding height
processor.Width = 200  // Adding width
processor.Path = "temp"  // Adding temporary image storage directory

processor.Request = file //  If image is being posted through a form, the file is stored in this field
processor.ImageHeader = fileHeader // If image is being posted through a form, the fileHeader is stored in this field

_= processor.ResizeImage() // Function for resizing images

NB: The above code should be inside a function

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

FOSSA Status

file-processor's People

Contributors

fossabot avatar rayne22 avatar

Watchers

 avatar

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.