Convert returns the Data converted to the format to.
(to *Format)
| 96 | |
| 97 | // Convert returns the Data converted to the format to. |
| 98 | func (b *Data) Convert(to *Format) (*Data, error) { |
| 99 | bytes, err := Convert(b.Bytes, int(b.Width), int(b.Height), int(b.Depth), b.Format, to) |
| 100 | if err != nil { |
| 101 | return nil, err |
| 102 | } |
| 103 | return &Data{Bytes: bytes, Width: b.Width, Height: b.Height, Depth: b.Depth, Format: to}, nil |
| 104 | } |
| 105 | |
| 106 | // NewInfo stores the image.Data's content to the database then uses the ID to |
| 107 | // create a new image.Info which describes this image.Data. |