Method Image.GIF.encode_trans()
- Method encode_trans
string encode(object img)
string encode(object img, int colors)
string encode(object img, object colortable)
string encode_trans(object img, object alpha)
string encode_trans(object img, int tr_r, int tr_g, int tr_b)
string encode_trans(object img, int colors, object alpha)
string encode_trans(object img, int colors, int tr_r, int tr_g, int tr_b)
string encode_trans(object img, int colors, object alpha, int tr_r, int tr_g, int tr_b)
string encode_trans(object img, object colortable, object alpha)
string encode_trans(object img, object colortable, int tr_r, int tr_g, int tr_b)
string encode_trans(object img, object colortable, object alpha, int a_r, int a_g, int a_b)
string encode_trans(object img, object colortable, int transp_index)- Description
-
Create a complete GIF file.
The latter (encode_trans) functions add transparency capabilities.
Example:
img=<ref>Image.Image</ref>([...]); [...] // make your very-nice image write(<ref>Image.GIF.encode</ref>(img)); // write it as GIF on stdout
- Parameter img
-
The image which to encode.
- Parameter colors
- Parameter colortable
-
These arguments decides what colors the image should be encoded with. If a number is given, a colortable with be created with (at most) that amount of colors. Default is '256' (GIF maximum amount of colors).
- Parameter alpha
-
Alpha channel image (defining what is transparent); black color indicates transparency. GIF has only transparent or nontransparent (no real alpha channel). You can always dither a transparency channel: Image.Colortable(my_alpha, ({({0,0,0}),({255,255,255})}))
->full()
->floyd_steinberg()
->map(my_alpha) - Parameter tr_r
- Parameter tr_g
- Parameter tr_b
-
Use this (or the color closest to this) color as transparent pixels.
- Parameter a_r
- Parameter a_g
- Parameter a_b
-
Encode transparent pixels (given by alpha channel image) to have this color. This option is for making GIFs for the decoders that doesn't support transparency.
- Parameter transp_index
-
Use this color no in the colortable as transparent color.
- Note
-
For advanced users:
Image.GIF.encode_trans(img,colortable,alpha);
is equivalent of usingImage.GIF.header_block(img->xsize(),img->ysize(),colortable)+ Image.GIF.render_block(img,colortable,0,0,0,alpha)+ Image.GIF.end_block();
and is actually implemented that way.