Module: VIPS::Header

Included in:
Writer
Defined in:
ext/image.c,
ext/header.c

Instance Method Summary collapse

Instance Method Details

#band_fmtObject

Get the band format of the image.



124
125
126
127
128
129
130
131
132
133
# File 'ext/header.c', line 124

static VALUE
header_band_fmt(VALUE obj)
{
	GetImg(obj, data, im);

    if (im)
        return ID2SYM(header_band_fmt_to_id(im->BandFmt));

    return Qnil;
}

#bandsNumeric

Get the number of bands in the image.

Returns:

  • (Numeric)


106
107
108
109
110
111
112
113
114
115
# File 'ext/header.c', line 106

static VALUE
header_bands(VALUE obj)
{
	GetImg(obj, data, im);

    if (im)
        return INT2FIX(im->Bands);

    return Qnil;
}

#exifString

Returns a binary string containing the raw exif header data.

Returns:

  • (String)


338
339
340
341
342
# File 'ext/header.c', line 338

static VALUE
header_exif(VALUE obj)
{
    return header_meta_get(obj, IM_META_EXIF_NAME);
}

#exif?Boolean

Indicates whether the image has an exif header attached to it.

Returns:

  • (Boolean)


351
352
353
354
355
# File 'ext/header.c', line 351

static VALUE
header_exif_p(VALUE obj)
{
    return header_meta_p(obj, IM_META_EXIF_NAME);
}

#get(name) ⇒ String

Return metadata item ‘name’ as a string.

Returns:

  • (String)


390
391
392
393
394
# File 'ext/header.c', line 390

static VALUE
header_get(VALUE obj, VALUE name)
{
    return header_meta_get_string(obj, StringValuePtr(name));
}

#iccString

Returns a binary string containing the raw icc header data.

Returns:

  • (String)


364
365
366
367
368
# File 'ext/header.c', line 364

static VALUE
header_icc(VALUE obj)
{
    return header_meta_get(obj, IM_META_ICC_NAME);
}

#icc?Boolean

Indicates whether the image has an icc header attached to it.

Returns:

  • (Boolean)


377
378
379
380
381
# File 'ext/header.c', line 377

static VALUE
header_icc_p(VALUE obj)
{
    return header_meta_p(obj, IM_META_ICC_NAME);
}

#n_elementsNumeric

Returns the number of elements in an image row, i.e. bands * x_size.

Returns:

  • (Numeric)


271
272
273
274
275
276
277
278
279
280
# File 'ext/header.c', line 271

static VALUE
header_n_elements(VALUE obj)
{
    GetImg(obj, data, im);

    if (im)
        return INT2FIX(IM_IMAGE_N_ELEMENTS(im));

    return Qnil;
}

#set(name, value) ⇒ Object

Set metadata item ‘name’ to value.



403
404
405
406
407
408
409
410
# File 'ext/header.c', line 403

static VALUE
header_set(VALUE obj, VALUE name, VALUE value)
{
    header_meta_set_string(obj, 
                StringValuePtr(name), StringValuePtr(value));

    return Qnil;
}

#sizeArray

Get the size of the image in pixels.

Returns:

  • (Array)


88
89
90
91
92
93
94
95
96
97
# File 'ext/header.c', line 88

static VALUE
header_size(VALUE obj)
{
	GetImg(obj, data, im);

    if (im)
    	return rb_ary_new3(2, INT2FIX(im->Xsize), INT2FIX(im->Ysize));

    return Qnil;
}

#sizeof_elementNumeric

Returns the size of a single image band item, in bytes.

Returns:

  • (Numeric)


216
217
218
219
220
221
222
223
224
225
# File 'ext/header.c', line 216

static VALUE
header_sizeof_element(VALUE obj)
{
    GetImg(obj, data, im);

    if (im)
        return INT2FIX(IM_IMAGE_SIZEOF_ELEMENT(im));

    return Qnil;
}

#sizeof_lineNumeric

Returns the size of all pixels in the row of the image, uncompressed, in bytes.

Returns:

  • (Numeric)


253
254
255
256
257
258
259
260
261
262
# File 'ext/header.c', line 253

static VALUE
header_sizeof_line(VALUE obj)
{
    GetImg(obj, data, im);

    if (im)
        return INT2FIX(IM_IMAGE_SIZEOF_LINE(im));

    return Qnil;
}

#sizeof_pelNumeric

Returns the size of a pixel in the image, in bytes.

Returns:

  • (Numeric)


234
235
236
237
238
239
240
241
242
243
# File 'ext/header.c', line 234

static VALUE
header_sizeof_pel(VALUE obj)
{
    GetImg(obj, data, im);

    if (im)
        return INT2FIX(IM_IMAGE_SIZEOF_PEL(im));

    return Qnil;
}

#x_offsetNumeric

Get the x-offset of the image.

Returns:

  • (Numeric)


178
179
180
181
182
183
184
185
186
187
# File 'ext/header.c', line 178

static VALUE
header_x_offset(VALUE obj)
{
	GetImg(obj, data, im);

    if (im)
        return INT2FIX(im->Xoffset);

    return Qnil;
}

#x_resNumeric

Get the x-resolution of the image.

Returns:

  • (Numeric)


142
143
144
145
146
147
148
149
150
151
# File 'ext/header.c', line 142

static VALUE
header_x_res(VALUE obj)
{
	GetImg(obj, data, im);

    if (im)
        return rb_float_new(im->Xres);

    return Qnil;
}

#x_sizeNumeric

Get the width in pixels of the image.

Returns:

  • (Numeric)


52
53
54
55
56
57
58
59
60
61
# File 'ext/header.c', line 52

static VALUE
header_x_size(VALUE obj)
{
	GetImg(obj, data, im);

    if (im)
        return INT2FIX(im->Xsize);

    return Qnil;
}

#y_offsetNumeric

Get the y-offset of the image.

Returns:

  • (Numeric)


196
197
198
199
200
201
202
203
204
205
# File 'ext/header.c', line 196

static VALUE
header_y_offset(VALUE obj)
{
	GetImg(obj, data, im);

    if (im)
        return INT2FIX(im->Yoffset);

    return Qnil;
}

#y_resNumeric

Get the y-resolution of the image.

Returns:

  • (Numeric)


160
161
162
163
164
165
166
167
168
169
# File 'ext/header.c', line 160

static VALUE
header_y_res(VALUE obj)
{
	GetImg(obj, data, im);

    if (im)
        return rb_float_new(im->Yres);

    return Qnil;
}

#y_sizeNumeric

Get the height in pixels of the image.

Returns:

  • (Numeric)


70
71
72
73
74
75
76
77
78
79
# File 'ext/header.c', line 70

static VALUE
header_y_size(VALUE obj)
{
	GetImg(obj, data, im);

    if (im)
        return INT2FIX(im->Ysize);

    return Qnil;
}