Class: VIPS::Image

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

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) black

+ (Object) buildlut

+ (Object) csv(*args)

Load a csv file straight to a VIPS Image.



189
190
191
# File 'lib/vips/reader.rb', line 189

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

+ (Object) exr(*args)

Load an exr file straight to a VIPS Image.



184
185
186
# File 'lib/vips/reader.rb', line 184

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

+ (Object) 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)

Load a jpeg file straight to a VIPS Image.



194
195
196
# File 'lib/vips/reader.rb', line 194

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

+ (Object) linreg

+ (Object) magick(*args)

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



199
200
201
# File 'lib/vips/reader.rb', line 199

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

+ (Object) new(*args)

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.



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

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

+ (Object) png(*args)

Load a png file straight to a VIPS Image.



204
205
206
# File 'lib/vips/reader.rb', line 204

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

+ (Object) ppm(*args)

Load a ppm file straight to a VIPS Image.



179
180
181
# File 'lib/vips/reader.rb', line 179

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

+ (Object) text

+ (Object) tiff(*args)

Load a tiff file straight to a VIPS Image.



209
210
211
# File 'lib/vips/reader.rb', line 209

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

+ (Object) tone_build

+ (Object) tone_build_range

+ (Object) vips(*args)

Load a native vips file straight to a VIPS Image.



214
215
216
# File 'lib/vips/reader.rb', line 214

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

Instance Method Details

- (Object) %

- (Object) &

- (Object) **

- (Object) <<

- (Object) >>

- (Numeric) [](x, y)

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) ^

- (Object) abs

- (Object) acos

- (Object) add Also known as: +

- (Object) 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

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;
}

- (Object) 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)



236
237
238
# File 'lib/vips/writer.rb', line 236

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

- (Object) data

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);
}

- (Object) de00_from_lab

- (Object) de_from_lab

- (Object) de_from_xyz

- (Object) decmc_from_lab

- (Object) deviate

- (Object) dilate

- (Object) disp_ps

- (Object) divide Also known as: /

- (Object) dup

- (Object) each_pixel {|value, x, y| ... }

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;
}

- (Object) embed

- (Object) equal

- (Object) erode

- (Object) expn

- (Object) extract_area

- (Object) extract_band

- (Object) falsecolour

- (Object) fastcor

- (String) filename

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;
}

- (Object) 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)



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

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

- (Numeric) kill

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);
}

- (Object) 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

- (Boolean) monotonic?

Returns:

  • (Boolean)

- (Object) more

- (Object) moreeq

- (Object) mpercent

- (Object) mpercent_hist

- (Object) msb

- (Object) multiply Also known as: *

- (Object) notequal

- (Object) or

- (Object) phasecor_fft

- (Object) png(*args)



244
245
246
# File 'lib/vips/writer.rb', line 244

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

- (Object) point

- (Object) pow

- (Object) ppm(*args)



248
249
250
# File 'lib/vips/writer.rb', line 248

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

- (Object) 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 Also known as: -

- (Object) tan

- (Object) tbjoin

- (Object) tbmerge

- (Object) tbmerge1

- (Object) tbmosaic

- (Object) tbmosaic1

- (Object) tiff(*args)



252
253
254
# File 'lib/vips/writer.rb', line 252

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

- (Object) tile_cache

- (Object) to_mask

- (Object) tone_analyse

- (Object) ucs_to_lab

- (Object) ucs_to_lch

- (Object) ucs_to_xyz

- (Object) vips(*args)



256
257
258
# File 'lib/vips/writer.rb', line 256

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

- (Object) vtype

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;
}

- (Object) wrap

- (Object) write(*args)



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

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

- (Object) 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) |