goimageprocessor

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2023 License: MIT Imports: 6 Imported by: 0

README

About Apps

This apps is processor with go native for compress and resize images, before using this apps your image must be in base64 format.

Install Apps

  $ go get -u github.com/riskifeb/goImageProcessor

Running Gin

First you need to import goImageProcessor package for using goImageProcessor, one simplest example likes the follow main.go:

package main

import (
  "fmt"
  "encoding/base64"

  "github.com/riskifeb/goImageProcessor"
)

func main() {

  // this image must be base64 formated
  var image := "/9j/4AAQSkZJRgABAQEASABIAAD/4gIcSUNDX1BST0ZJTEUAAQEAAAIMbGNtcwIQAABtbnRyU..."

  // ImageProcessor({imageBase64}, {width}, {quality})
  imageBytes, err := goImageProcessor.ImageProcessor(image, 500, 50)
  if(err != nil) {
    panic(err)
  }
  //convert to string
  imageResultString := base64.StdEncoding.EncodeToString(imageBytes.Bytes())

  fmt.Println("data:image/jpeg;base64,"+imageResultString)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ImageProcessor

func ImageProcessor(data string, width, quality int) (*bytes.Buffer, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL