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 

### Useful links

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

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)

The examples below assume you have loaded an image and checked the error:

```
photo, err := image.Load(ctx, "example.jpg")
if err != nil {
    return err
}
```

Import `github.com/spatie/image-go` as `image`. Pass a `context.Context` as `ctx` to propagate cancellation to image processing and optimization.

### Sepia and blur

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

```
return photo.Sepia().Blur(50).Save("")
```

### Cropping the Starbucks storefront

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

```
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:

```
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)
