<commit_before>

# ims
`import "github.com/wyattjoh/ims/lib"`

* [Overview](#pkg-overview)
* [Index](#pkg-index)

## <a name="pkg-overview">Overview</a>



## <a name="pkg-index">Index</a>
* [func GIFEncoder(i image.Image, w http.ResponseWriter) error](#GIFEncoder)
* [func HandleResize(dir http.Dir) http.HandlerFunc](#HandleResize)
* [func PNGEncode(i image.Image, w http.ResponseWriter) error](#PNGEncode)
* [func ProcessImage(input io.Reader, w http.ResponseWriter, r *http.Request) error](#ProcessImage)
* [func Serve(addr string) error](#Serve)
* [type Encoder](#Encoder)
  * [func GetEncoder(format string, r *http.Request) Encoder](#GetEncoder)
* [type EncoderFunc](#EncoderFunc)
  * [func (f EncoderFunc) Encode(m image.Image, w http.ResponseWriter) error](#EncoderFunc.Encode)
* [type JPEGEncoder](#JPEGEncoder)
  * [func NewJPEGEncoder(r *http.Request) JPEGEncoder](#NewJPEGEncoder)
  * [func (je JPEGEncoder) Encode(i image.Image, w http.ResponseWriter) error](#JPEGEncoder.Encode)


#### <a name="pkg-files">Package files</a>
[encoder.go](/src/github.com/wyattjoh/ims/lib/encoder.go) [server.go](/src/github.com/wyattjoh/ims/lib/server.go) 





## <a name="GIFEncoder">func</a> [GIFEncoder](/src/target/encoder.go?s=1793:1852#L63)
``` go
func GIFEncoder(i image.Image, w http.ResponseWriter) error
```
GIFEncoder takes an image and writes the encoded gif image to it.



## <a name="HandleResize">func</a> [HandleResize](/src/target/server.go?s=1240:1288#L44)
``` go
func HandleResize(dir http.Dir) http.HandlerFunc
```
HandleResize performs the actual resizing.



## <a name="PNGEncode">func</a> [PNGEncode](/src/target/encoder.go?s=1432:1490#L48)
``` go
func PNGEncode(i image.Image, w http.ResponseWriter) error
```
PNGEncode takes an image and writes the encoded png image to it.



## <a name="ProcessImage">func</a> [ProcessImage](/src/target/server.go?s=548:628#L21)
``` go
func ProcessImage(input io.Reader, w http.ResponseWriter, r *http.Request) error
```
ProcessImage uses the github.com/disintegration/imaging lib to perform the
image transformations.



## <a name="Serve">func</a> [Serve](/src/target/server.go?s=2432:2461#L82)
``` go
func Serve(addr string) error
```
Serve creates and starts a new server to provide image resizing services.




## <a name="Encoder">type</a> [Encoder](/src/target/encoder.go?s=329:407#L10)
``` go
type Encoder interface {
    Encode(m image.Image, w http.ResponseWriter) error
}
```
Encoder describes any type that can encode with the image and response
writer.







### <a name="GetEncoder">func</a> [GetEncoder](/src/target/encoder.go?s=1036:1091#L29)
``` go
func GetEncoder(format string, r *http.Request) Encoder
```
GetEncoder parses the `m` query variable and checks to see if it is equal to
"jpeg". If it is, it uses the JPEGEncoder, otherwise, it tries to see if it
can encode the image with another format, otherwise, it just encodes it as
"jpeg".





## <a name="EncoderFunc">type</a> [EncoderFunc](/src/target/encoder.go?s=603:668#L18)
``` go
type EncoderFunc func(m image.Image, w http.ResponseWriter) error
```
EncoderFunc type is an adapter to allow the use of
ordinary functions as image Encoders. If f is a function
with the appropriate signature, EncoderFunc(f) is a
Encoder that calls f.










### <a name="EncoderFunc.Encode">func</a> (EncoderFunc) [Encode](/src/target/encoder.go?s=695:766#L21)
``` go
func (f EncoderFunc) Encode(m image.Image, w http.ResponseWriter) error
```
Encode calls f(m, w).




## <a name="JPEGEncoder">type</a> [JPEGEncoder](/src/target/encoder.go?s=2515:2555#L90)
``` go
type JPEGEncoder struct {
    Quality int
}
```
JPEGEncoder allows the encoding of JPEG's to a http.ResponseWriter.







### <a name="NewJPEGEncoder">func</a> [NewJPEGEncoder](/src/target/encoder.go?s=2228:2276#L78)
``` go
func NewJPEGEncoder(r *http.Request) JPEGEncoder
```
NewJPEGEncoder creates a new JPEGEncoder based on the input request, this
parses the `q` query variable to check to see if it needs to change the
default quality format.





### <a name="JPEGEncoder.Encode">func</a> (JPEGEncoder) [Encode](/src/target/encoder.go?s=2629:2701#L95)
``` go
func (je JPEGEncoder) Encode(i image.Image, w http.ResponseWriter) error
```
Encode writes the encoded image data out to the http.ResponseWriter.








- - -
Generated by [godoc2md](http://godoc.org/github.com/davecheney/godoc2md)
<commit_msg>Updated docs<commit_after>

# ims
`import "github.com/wyattjoh/ims/lib"`

* [Overview](#pkg-overview)
* [Index](#pkg-index)

## <a name="pkg-overview">Overview</a>



## <a name="pkg-index">Index</a>
* [func GIFEncoder(i image.Image, w http.ResponseWriter) error](#GIFEncoder)
* [func HandleResize(dir http.Dir) http.HandlerFunc](#HandleResize)
* [func PNGEncode(i image.Image, w http.ResponseWriter) error](#PNGEncode)
* [func ProcessImage(input io.Reader, w http.ResponseWriter, r *http.Request) error](#ProcessImage)
* [func Serve(addr string, debug bool) error](#Serve)
* [type Encoder](#Encoder)
  * [func GetEncoder(format string, r *http.Request) Encoder](#GetEncoder)
* [type EncoderFunc](#EncoderFunc)
  * [func (f EncoderFunc) Encode(m image.Image, w http.ResponseWriter) error](#EncoderFunc.Encode)
* [type JPEGEncoder](#JPEGEncoder)
  * [func NewJPEGEncoder(r *http.Request) JPEGEncoder](#NewJPEGEncoder)
  * [func (je JPEGEncoder) Encode(i image.Image, w http.ResponseWriter) error](#JPEGEncoder.Encode)


#### <a name="pkg-files">Package files</a>
[encoder.go](/src/github.com/wyattjoh/ims/lib/encoder.go) [server.go](/src/github.com/wyattjoh/ims/lib/server.go) 





## <a name="GIFEncoder">func</a> [GIFEncoder](/src/target/encoder.go?s=1793:1852#L63)
``` go
func GIFEncoder(i image.Image, w http.ResponseWriter) error
```
GIFEncoder takes an image and writes the encoded gif image to it.



## <a name="HandleResize">func</a> [HandleResize](/src/target/server.go?s=1181:1229#L42)
``` go
func HandleResize(dir http.Dir) http.HandlerFunc
```
HandleResize performs the actual resizing.



## <a name="PNGEncode">func</a> [PNGEncode](/src/target/encoder.go?s=1432:1490#L48)
``` go
func PNGEncode(i image.Image, w http.ResponseWriter) error
```
PNGEncode takes an image and writes the encoded png image to it.



## <a name="ProcessImage">func</a> [ProcessImage](/src/target/server.go?s=489:569#L19)
``` go
func ProcessImage(input io.Reader, w http.ResponseWriter, r *http.Request) error
```
ProcessImage uses the github.com/disintegration/imaging lib to perform the
image transformations.



## <a name="Serve">func</a> [Serve](/src/target/server.go?s=2373:2414#L80)
``` go
func Serve(addr string, debug bool) error
```
Serve creates and starts a new server to provide image resizing services.




## <a name="Encoder">type</a> [Encoder](/src/target/encoder.go?s=329:407#L10)
``` go
type Encoder interface {
    Encode(m image.Image, w http.ResponseWriter) error
}
```
Encoder describes any type that can encode with the image and response
writer.







### <a name="GetEncoder">func</a> [GetEncoder](/src/target/encoder.go?s=1036:1091#L29)
``` go
func GetEncoder(format string, r *http.Request) Encoder
```
GetEncoder parses the `m` query variable and checks to see if it is equal to
"jpeg". If it is, it uses the JPEGEncoder, otherwise, it tries to see if it
can encode the image with another format, otherwise, it just encodes it as
"jpeg".





## <a name="EncoderFunc">type</a> [EncoderFunc](/src/target/encoder.go?s=603:668#L18)
``` go
type EncoderFunc func(m image.Image, w http.ResponseWriter) error
```
EncoderFunc type is an adapter to allow the use of
ordinary functions as image Encoders. If f is a function
with the appropriate signature, EncoderFunc(f) is a
Encoder that calls f.










### <a name="EncoderFunc.Encode">func</a> (EncoderFunc) [Encode](/src/target/encoder.go?s=695:766#L21)
``` go
func (f EncoderFunc) Encode(m image.Image, w http.ResponseWriter) error
```
Encode calls f(m, w).




## <a name="JPEGEncoder">type</a> [JPEGEncoder](/src/target/encoder.go?s=2515:2555#L90)
``` go
type JPEGEncoder struct {
    Quality int
}
```
JPEGEncoder allows the encoding of JPEG's to a http.ResponseWriter.







### <a name="NewJPEGEncoder">func</a> [NewJPEGEncoder](/src/target/encoder.go?s=2228:2276#L78)
``` go
func NewJPEGEncoder(r *http.Request) JPEGEncoder
```
NewJPEGEncoder creates a new JPEGEncoder based on the input request, this
parses the `q` query variable to check to see if it needs to change the
default quality format.





### <a name="JPEGEncoder.Encode">func</a> (JPEGEncoder) [Encode](/src/target/encoder.go?s=2629:2701#L95)
``` go
func (je JPEGEncoder) Encode(i image.Image, w http.ResponseWriter) error
```
Encode writes the encoded image data out to the http.ResponseWriter.








- - -
Generated by [godoc2md](http://godoc.org/github.com/davecheney/godoc2md)

{'fraction_non_alphanumeric': 0.15210245948090217, 'fraction_numerical': 0.02584155049302958, 'mean_word_length': 5.2492917847025495, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 63, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6291323', 'n_tokens_mistral': 3277, 'n_tokens_neox': 2960, 'n_words': 791}