From 16b8301f5ba007d7f35a777397e7bbd5482d0269 Mon Sep 17 00:00:00 2001 From: Tomas Aparicio Date: Sat, 11 Apr 2015 14:20:26 +0200 Subject: [PATCH] feat(docs): update docs --- README.md | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 78 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2b678ab..572afe6 100644 --- a/README.md +++ b/README.md @@ -243,7 +243,7 @@ Determines the image type format by name (jpeg, png, webp or tiff) ```go func Initialize() ``` -Explicit thread-safe start of libvips. You should only call this function if you +Explicit thread-safe start of libvips. Only call this function if you've previously shutdown libvips #### func IsTypeNameSupported @@ -260,6 +260,13 @@ func IsTypeSupported(t ImageType) bool ``` Check if a given image type is supported +#### func PrintMemoryStats + +```go +func PrintMemoryStats() +``` +Print Go memory and garbage collector stats. Useful for debugging + #### func Read ```go @@ -285,7 +292,7 @@ already initialized, the function is no-op ```go func VipsDebug() ``` -Output to stdout collected data for debugging purposes +Output to stdout vips collected data. Useful for debugging #### func Write @@ -309,6 +316,16 @@ const ( ) ``` +#### type Color + +```go +type Color struct { + R, G, B uint8 +} +``` + +Color represents a traditional RGB color scheme + #### type Direction ```go @@ -411,6 +428,13 @@ func (i *Image) Flop() ([]byte, error) ``` Flop the image about the horizontal X axis +#### func (*Image) Image + +```go +func (i *Image) Image() []byte +``` +Get image buffer + #### func (*Image) Metadata ```go @@ -460,6 +484,20 @@ func (i *Image) Type() string ``` Get image type format (jpeg, png, webp, tiff) +#### func (*Image) Watermark + +```go +func (i *Image) Watermark(w Watermark) ([]byte, error) +``` +Add text as watermark on the given image + +#### func (*Image) Zoom + +```go +func (i *Image) Zoom(level int) ([]byte, error) +``` +Zoom the image by the given factor + #### type ImageMetadata ```go @@ -531,6 +569,7 @@ Determines the image type format (jpeg, png, webp or tiff) type Interpolator int ``` + ```go const ( BICUBIC Interpolator = iota @@ -558,18 +597,55 @@ type Options struct { Extend int Quality int Compression int + Zoom int Crop bool Enlarge bool Embed bool Flip bool Flop bool + NoAutoRotate bool Rotate Angle Gravity Gravity + Watermark Watermark Type ImageType Interpolator Interpolator } ``` + +#### type VipsMemoryInfo + +```go +type VipsMemoryInfo struct { + Memory int64 + MemoryHighwater int64 + Allocations int64 +} +``` + + +#### func VipsMemory + +```go +func VipsMemory() VipsMemoryInfo +``` +Get memory info stats from vips (cache size, memory allocs...) + +#### type Watermark + +```go +type Watermark struct { + Width int + DPI int + Margin int + Opacity float32 + NoReplicate bool + Text string + Font string + Background Color +} +``` + ## Special Thanks - [John Cupitt](https://github.com/jcupitt)