Introduction | image-go | Spatie       

 SPATIE  

  Image Go 
===========

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Image-go](https://spatie.be/docs/image-go/v1)  Introduction

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/image-go/v1) 

  Introduction    
- [ Introduction ](https://spatie.be/docs/image-go/v1/introduction)
- [ Postcardware ](https://spatie.be/docs/image-go/v1/postcardware)
- [ Installation and setup ](https://spatie.be/docs/image-go/v1/installation-and-setup)
- [ Supported formats ](https://spatie.be/docs/image-go/v1/formats)
- [ Questions &amp; issues ](https://spatie.be/docs/image-go/v1/questions-and-issues)
- [ Changelog ](https://spatie.be/docs/image-go/v1/changelog)
- [ About us ](https://spatie.be/docs/image-go/v1/about-us)
- [ Upgrading ](https://spatie.be/docs/image-go/v1/upgrading)
- [ Testing ](https://spatie.be/docs/image-go/v1/testing)
- [ Releasing ](https://spatie.be/docs/image-go/v1/releasing)

Usage
-----

- [ Basic usage ](https://spatie.be/docs/image-go/v1/usage/basic-usage)
- [ Saving images ](https://spatie.be/docs/image-go/v1/usage/saving-images)
- [ Retrieving properties ](https://spatie.be/docs/image-go/v1/usage/retrieving-properties)
- [ Colors ](https://spatie.be/docs/image-go/v1/usage/colors)

Image manipulations
-------------------

- [ Overview ](https://spatie.be/docs/image-go/v1/image-manipulations/overview)
- [ Resizing images ](https://spatie.be/docs/image-go/v1/image-manipulations/resizing-images)
- [ Optimizing images ](https://spatie.be/docs/image-go/v1/image-manipulations/optimizing-images)
- [ Adjustments ](https://spatie.be/docs/image-go/v1/image-manipulations/adjustments)
- [ Image canvas ](https://spatie.be/docs/image-go/v1/image-manipulations/image-canvas)
- [ Effects ](https://spatie.be/docs/image-go/v1/image-manipulations/effects)
- [ Adding a watermark ](https://spatie.be/docs/image-go/v1/image-manipulations/adding-a-watermark)
- [ Adding text ](https://spatie.be/docs/image-go/v1/image-manipulations/text)

 Image Go 
==========

 Manipulate images with an expressive API 

 [    Repository ](https://github.com/spatie/image-go) 

    0 

    0 

Introduction
------------

###  On this page 

1. [ Quick examples ](#content-quick-examples)

Image manipulation doesn't have to be hard. This Go package makes it easy to apply common manipulations to images like resizing, cropping and adding effects.

For all available manipulations, please see the [overview](/docs/image-go/v1/image-manipulations/overview).

Quick examples
--------------------------------------------------------------------------------------------------

For all the examples in this documentation we'll use this photo of New York:

![Example image](images/example.jpg)

Import `context` and `github.com/spatie/image-go` for these examples.

### Sepia and blur

By chaining multiple manipulation methods together we can quickly add an effect to our image:

```
func addEffects(ctx context.Context) error {
    photo, err := image.Load(ctx, "example.jpg")
    if err != nil {
        return err
    }
    return photo.Sepia().Blur(50).Save("")
}
```

### Cropping the Starbucks storefront

The `ManualCrop` method allows you to crop specific parts of an image:

```
func cropStorefront(ctx context.Context) error {
    photo, err := image.Load(ctx, "example.jpg")
    if err != nil {
        return err
    }
    return photo.ManualCrop(600, 400, 20, 620).Save("")
}
```

### Converting a transparent PNG to JPG

The image is converted to JPG by saving it with the correct file extension:

```
func convertPNG(ctx context.Context) error {
    photo, err := image.Load(ctx, "github-logo.png")
    if err != nil {
        return err
    }
    return photo.Background("lightblue").
        Fit(image.Fill, 500, 300).
        Border(15, image.BorderExpand, "007698").
        Save("example.jpg")
}
```

The sample photo and reference illustrations are from the PHP documentation. Exact filtering and text rendering can vary with ImageMagick's version and delegates.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
