Class: VIPS::Image

Inherits:
Object
  • Object
show all
Includes:
VIPSHeader
Defined in:
lib/vips/reader.rb,
lib/vips/writer.rb,
ext/image.c

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.black ⇒ Object

.buildlut ⇒ Object

.csv(*args) ⇒ Object

Load a csv file straight to a VIPS Image.



230
231
232
# File 'lib/vips/reader.rb', line 230

def self.csv(*args)
  CSVReader.new(*args).read
end

.exr(*args) ⇒ Object

Load an exr file straight to a VIPS Image.



225
226
227
# File 'lib/vips/reader.rb', line 225

def self.exr(*args)
  EXRReader.new(*args).read
end

.fmask_butterworth_bandpass ⇒ Object

.fmask_butterworth_bandreject ⇒ Object

.fmask_butterworth_highpass ⇒ Object

.fmask_butterworth_lowpass ⇒ Object

.fmask_butterworth_ringpass ⇒ Object

.fmask_butterworth_ringreject ⇒ Object

.fmask_fractal_flt ⇒ Object

.fmask_gauss_bandpass ⇒ Object

.fmask_gauss_bandreject ⇒ Object

.fmask_gauss_highpass ⇒ Object

.fmask_gauss_lowpass ⇒ Object

.fmask_gauss_ringpass ⇒ Object

.fmask_gauss_ringreject ⇒ Object

.fmask_ideal_bandpass ⇒ Object

.fmask_ideal_bandreject ⇒ Object

.fmask_ideal_highpass ⇒ Object

.fmask_ideal_lowpass ⇒ Object

.fmask_ideal_ringpass ⇒ Object

.fmask_ideal_ringreject ⇒ Object

.fractsurf ⇒ Object

.gaussnoise ⇒ Object

.identity ⇒ Object

.identity_ushort ⇒ Object

.invertlut ⇒ Object

.jpeg(*args) ⇒ Object

Load a jpeg file straight to a VIPS Image.



235
236
237
# File 'lib/vips/reader.rb', line 235

def self.jpeg(*args)
  JPEGReader.new(*args).read
end

.linreg ⇒ Object

.magick(*args) ⇒ Object

Load a file straight to a VIPS Image using the magick library.



240
241
242
# File 'lib/vips/reader.rb', line 240

def self.magick(*args)
  MagickReader.new(*args).read
end

.new(*args) ⇒ Object

Load any file straight to a VIPS Image. VIPS will determine the format based on the file extension. If the extension is not recognized, VIPS will look at the file signature.



262
263
264
# File 'lib/vips/reader.rb', line 262

def self.new(*args)
  Reader.new(*args).read
end

.png(*args) ⇒ Object

Load a png file straight to a VIPS Image.



245
246
247
# File 'lib/vips/reader.rb', line 245

def self.png(*args)
  PNGReader.new(*args).read
end

.ppm(*args) ⇒ Object

Load a ppm file straight to a VIPS Image.



220
221
222
# File 'lib/vips/reader.rb', line 220

def self.ppm(*args)
  PPMReader.new(*args).read
end

.text ⇒ Object

.tiff(*args) ⇒ Object

Load a tiff file straight to a VIPS Image.



250
251
252
# File 'lib/vips/reader.rb', line 250

def self.tiff(*args)
  TIFFReader.new(*args).read
end

.tone_build ⇒ Object

.tone_build_range ⇒ Object

.vips(*args) ⇒ Object

Load a native vips file straight to a VIPS Image.



255
256
257
# File 'lib/vips/reader.rb', line 255

def self.vips(*args)
  VIPSReader.new(*args).read
end

Instance Method Details

#% ⇒ Object

#& ⇒ Object

#** ⇒ Object

#<< ⇒ Object

#>> ⇒ Object

#[](x, y) ⇒ Numeric

Returns the band values at the given x, y location of the image. The upper left corner of the image is at 0, 0, and the lower right corner is at im.x_size - 1, im.y_size - 1.

If it is a one-band image, then this method returns the value without an array.

Returns:

  • (Numeric)


289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'ext/image.c', line 289

static VALUE
img_aref(VALUE obj, VALUE v_x, VALUE v_y)
{
    int x = NUM2INT(v_x);
    int y = NUM2INT(v_y);
    GetImg(obj, data, im);

    if (im_incheck(im) || im_check_uncoded("img_aref", im))
        vips_lib_error();

    if (x >= im->Xsize || x < 0 || y >= im->Ysize || y < 0)
        rb_raise(rb_eIndexError, "Index out of bounds");

    return img_pixel_to_rb(im, x, y);
}

#^ ⇒ Object

#abs ⇒ Object

#acos ⇒ Object

#add ⇒ Object Also known as: +

#addgnoise ⇒ Object

#affinei ⇒ Object

#affinei_resize ⇒ Object

#align_bands ⇒ Object

#and ⇒ Object

#asin ⇒ Object

#atan ⇒ Object

#avg ⇒ Object

#bandjoin ⇒ Object

#bandmean ⇒ Object

#blend ⇒ Object

#c2amph ⇒ Object

#c2imag ⇒ Object

#c2real ⇒ Object

#c2rect ⇒ Object

#ceil ⇒ Object

#clip2fmt ⇒ Object

#cntlines_h ⇒ Object

#cntlines_v ⇒ Object

#coding ⇒ Object

Returns the data coding for this image. Coding can be one of: :NONE, :LABQ, :RAD.



184
185
186
187
188
189
190
191
192
193
# File 'ext/image.c', line 184

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

    if (im)
        return ID2SYM(img_coding_to_id(im->Coding));

    return Qnil;
}

#compass ⇒ Object

#contrast_surface ⇒ Object

#conv ⇒ Object

#convsep ⇒ Object

#copy_file ⇒ Object

#copy_native ⇒ Object

#copy_swap ⇒ Object

#correl ⇒ Object

#cos ⇒ Object

#cross_phase ⇒ Object

#csv(*args) ⇒ Object



259
260
261
# File 'lib/vips/writer.rb', line 259

def csv(*args)
  invoke_writer CSVWriter, *args
end

#data ⇒ Object

Returns the uncompressed data of the image.



339
340
341
342
343
344
345
346
347
348
349
# File 'ext/image.c', line 339

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

    if (im_incheck(im) || im_check_uncoded("img_aref", im))
        return( Qnil );

    return rb_tainted_str_new((const char *) im->data, 
        IM_IMAGE_SIZEOF_LINE(im) * im->Ysize);
}

#de00_from_lab ⇒ Object

#de_from_lab ⇒ Object

#de_from_xyz ⇒ Object

#decmc_from_lab ⇒ Object

#deviate ⇒ Object

#dilate ⇒ Object

#disp_ps ⇒ Object

#divide ⇒ Object Also known as: /

#dup ⇒ Object

#each_pixel {|value, x, y| ... } ⇒ Object

Yields every pixel in the image, with coordinates.

Yields:

  • (value, x, y)


312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
# File 'ext/image.c', line 312

static VALUE
img_each_pixel(VALUE obj)
{
    int x, y;
    VALUE pixel;
    GetImg(obj, data, im);

    if (im_incheck(im) || im_check_uncoded("img_each_pixel", im))
        return( Qnil );

    for(y = 0; y < im->Ysize; y++) {
        for(x = 0; x < im->Xsize; x++) {
            pixel = img_pixel_to_rb(im, x, y);
            rb_yield(rb_ary_new3(3, pixel, INT2FIX(x), INT2FIX(y)));
        }
    }

    return obj;
}

#embed ⇒ Object

#equal ⇒ Object

#erode ⇒ Object

#expn ⇒ Object

#extract_area ⇒ Object

#extract_band ⇒ Object

#falsecolour ⇒ Object

#fastcor ⇒ Object

#filename ⇒ String

Returns the path from which self was read.

Returns:

  • (String)


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

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

    if (im)
        return rb_tainted_str_new2(im->filename);

    return Qnil;
}

#fliphor ⇒ Object

#flipver ⇒ Object

#float_to_rad ⇒ Object

#floor ⇒ Object

#freqflt ⇒ Object

#fwfft ⇒ Object

#gammacorrect ⇒ Object

#global_balance ⇒ Object

#global_balancef ⇒ Object

#grad_x ⇒ Object

#grad_y ⇒ Object

#gradcor ⇒ Object

#gradient ⇒ Object

#grid ⇒ Object

#heq ⇒ Object

#hist ⇒ Object

#hist_indexed ⇒ Object

#histcum ⇒ Object

#histeq ⇒ Object

#histgr ⇒ Object

#histnd ⇒ Object

#histnorm ⇒ Object

#histplot ⇒ Object

#histspec ⇒ Object

#hsp ⇒ Object

#icc_ac2rc ⇒ Object

#icc_export_depth ⇒ Object

#icc_import ⇒ Object

#icc_import_embedded ⇒ Object

#icc_transform ⇒ Object

#ifthenelse ⇒ Object

#im_lab_morph ⇒ Object

#insert ⇒ Object

#insert_noexpand ⇒ Object

#invert ⇒ Object

#invfft ⇒ Object

#invfftr ⇒ Object

#jpeg(*args) ⇒ Object



263
264
265
# File 'lib/vips/writer.rb', line 263

def jpeg(*args)
  invoke_writer JPEGWriter, *args
end

#kill ⇒ Numeric

Returns whether this image has been flagged to stop processing.

Returns:

  • (Numeric)


202
203
204
205
206
207
# File 'ext/image.c', line 202

static VALUE
img_kill(VALUE obj)
{
    GetImg(obj, data, im);
    return INT2FIX(im->kill);
}

#lab_to_labq ⇒ Object

#lab_to_labs ⇒ Object

#lab_to_lch ⇒ Object

#lab_to_ucs ⇒ Object

#lab_to_xyz ⇒ Object

#lab_to_xyz_temp ⇒ Object

#label_regions ⇒ Object

#labq_to_lab ⇒ Object

#labq_to_labs ⇒ Object

#labq_to_xyz ⇒ Object

#labs_to_lab ⇒ Object

#labs_to_labq ⇒ Object

#lch_to_lab ⇒ Object

#lch_to_ucs ⇒ Object

#less ⇒ Object

#lesseq ⇒ Object

#lhisteq ⇒ Object

#lin ⇒ Object

#lindetect ⇒ Object

#log ⇒ Object

#log10 ⇒ Object

#lrjoin ⇒ Object

#lrmerge ⇒ Object

#lrmerge1 ⇒ Object

#lrmosaic ⇒ Object

#lrmosaic1 ⇒ Object

#maplut ⇒ Object

#match_linear ⇒ Object

#match_linear_search ⇒ Object

#max ⇒ Object

#maxpos ⇒ Object

#maxpos_avg ⇒ Object

#maxpos_subpel ⇒ Object

#maxvalue ⇒ Object

#measure_area ⇒ Object

#min ⇒ Object

#minpos ⇒ Object

#monotonic? ⇒ Boolean

Returns:

  • (Boolean)

#more ⇒ Object

#moreeq ⇒ Object

#mpercent ⇒ Object

#mpercent_hist ⇒ Object

#msb ⇒ Object

#multiply ⇒ Object Also known as: *

#notequal ⇒ Object

#or ⇒ Object

#phasecor_fft ⇒ Object

#png(*args) ⇒ Object



267
268
269
# File 'lib/vips/writer.rb', line 267

def png(*args)
  invoke_writer PNGWriter, *args
end

#point ⇒ Object

#pow ⇒ Object

#ppm(*args) ⇒ Object



271
272
273
# File 'lib/vips/writer.rb', line 271

def ppm(*args)
  invoke_writer PPMWriter, *args
end

#profile_h ⇒ Object

#profile_v ⇒ Object

#project ⇒ Object

#rad_to_float ⇒ Object

#rank ⇒ Object

#rank_image ⇒ Object

#recomb ⇒ Object

#remainder ⇒ Object

#replicate ⇒ Object

#ri2c ⇒ Object

#rightshift_size ⇒ Object

#rint ⇒ Object

#rot180 ⇒ Object

#rot270 ⇒ Object

#rot90 ⇒ Object

#rotquad ⇒ Object

#scale ⇒ Object

#scaleps ⇒ Object

#sharpen ⇒ Object

#shrink ⇒ Object

#sign ⇒ Object

#sin ⇒ Object

#spcor ⇒ Object

#srgb_to_xyz ⇒ Object

#stats ⇒ Object

#stdif ⇒ Object

#stretch3 ⇒ Object

#subsample ⇒ Object

#subtract ⇒ Object Also known as: -

#tan ⇒ Object

#tbjoin ⇒ Object

#tbmerge ⇒ Object

#tbmerge1 ⇒ Object

#tbmosaic ⇒ Object

#tbmosaic1 ⇒ Object

#tiff(*args) ⇒ Object



275
276
277
# File 'lib/vips/writer.rb', line 275

def tiff(*args)
  invoke_writer TIFFWriter, *args
end

#tile_cache ⇒ Object

#to_mask ⇒ Object

#tone_analyse ⇒ Object

#ucs_to_lab ⇒ Object

#ucs_to_lch ⇒ Object

#ucs_to_xyz ⇒ Object

#vips(*args) ⇒ Object



279
280
281
# File 'lib/vips/writer.rb', line 279

def vips(*args)
  invoke_writer VIPSWriter, *args
end

#vtype ⇒ Object

Returns the type of image that Vips has assigned to self. This can by any of:

:B_W, :HISTOGRAM, :FOURIER, :XYZ, :LAB, :CMYK, :LABQ, :RGB, :UCS, :LCH, :LABS, :sRGB, :YXY, :RGB16, :GREY16



165
166
167
168
169
170
171
172
173
174
# File 'ext/image.c', line 165

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

    if (im)
        return ID2SYM(img_vtype_to_id(im->Type));

    return Qnil;
}

#wrap ⇒ Object

#write(*args) ⇒ Object



283
284
285
# File 'lib/vips/writer.rb', line 283

def write(*args)
  invoke_writer Writer, *args
end

#xor ⇒ Object

#xyz_to_lab ⇒ Object

#xyz_to_lab_temp ⇒ Object

#xyz_to_srgb ⇒ Object

#xyz_to_ucs ⇒ Object

#xyz_to_yxy ⇒ Object

#yxy_to_xyz ⇒ Object

#zerox_neg ⇒ Object

#zerox_pos ⇒ Object

#zoom ⇒ Object

#| ⇒ Object