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

.blackObject

.buildlutObject

.csv(*args) ⇒ Object

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

.exr(*args) ⇒ Object

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

.fmask_butterworth_bandpassObject

.fmask_butterworth_bandrejectObject

.fmask_butterworth_highpassObject

.fmask_butterworth_lowpassObject

.fmask_butterworth_ringpassObject

.fmask_butterworth_ringrejectObject

.fmask_fractal_fltObject

.fmask_gauss_bandpassObject

.fmask_gauss_bandrejectObject

.fmask_gauss_highpassObject

.fmask_gauss_lowpassObject

.fmask_gauss_ringpassObject

.fmask_gauss_ringrejectObject

.fmask_ideal_bandpassObject

.fmask_ideal_bandrejectObject

.fmask_ideal_highpassObject

.fmask_ideal_lowpassObject

.fmask_ideal_ringpassObject

.fmask_ideal_ringrejectObject

.fractsurfObject

.gaussnoiseObject

.identityObject

.identity_ushortObject

.invertlutObject

.jpeg(*args) ⇒ Object

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

.linregObject

.magick(*args) ⇒ Object

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

.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.



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

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

.png(*args) ⇒ Object

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

.ppm(*args) ⇒ Object

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

.textObject

.tiff(*args) ⇒ Object

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

.tone_buildObject

.tone_build_rangeObject

.vips(*args) ⇒ Object

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

#[](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

#absObject

#acosObject

#addObject Also known as: +

#addgnoiseObject

#affineiObject

#affinei_resizeObject

#align_bandsObject

#andObject

#asinObject

#atanObject

#avgObject

#bandjoinObject

#bandmeanObject

#blendObject

#c2amphObject

#c2imagObject

#c2realObject

#c2rectObject

#ceilObject

#clip2fmtObject

#cntlines_hObject

#cntlines_vObject

#codingObject

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

#compassObject

#contrast_surfaceObject

#convObject

#convsepObject

#copy_fileObject

#copy_nativeObject

#copy_swapObject

#correlObject

#cosObject

#cross_phaseObject

#csv(*args) ⇒ Object



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

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

#dataObject

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_labObject

#de_from_labObject

#de_from_xyzObject

#decmc_from_labObject

#deviateObject

#dilateObject

#disp_psObject

#divideObject Also known as: /

#dupObject

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

#embedObject

#equalObject

#erodeObject

#expnObject

#extract_areaObject

#extract_bandObject

#falsecolourObject

#fastcorObject

#filenameString

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

#fliphorObject

#flipverObject

#float_to_radObject

#floorObject

#freqfltObject

#fwfftObject

#gammacorrectObject

#global_balanceObject

#global_balancefObject

#grad_xObject

#grad_yObject

#gradcorObject

#gradientObject

#gridObject

#heqObject

#histObject

#hist_indexedObject

#histcumObject

#histeqObject

#histgrObject

#histndObject

#histnormObject

#histplotObject

#histspecObject

#hspObject

#icc_ac2rcObject

#icc_export_depthObject

#icc_importObject

#icc_import_embeddedObject

#icc_transformObject

#ifthenelseObject

#im_lab_morphObject

#insertObject

#insert_noexpandObject

#invertObject

#invfftObject

#invfftrObject

#jpeg(*args) ⇒ Object



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

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

#killNumeric

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_labqObject

#lab_to_labsObject

#lab_to_lchObject

#lab_to_ucsObject

#lab_to_xyzObject

#lab_to_xyz_tempObject

#label_regionsObject

#labq_to_labObject

#labq_to_labsObject

#labq_to_xyzObject

#labs_to_labObject

#labs_to_labqObject

#lch_to_labObject

#lch_to_ucsObject

#lessObject

#lesseqObject

#lhisteqObject

#linObject

#lindetectObject

#logObject

#log10Object

#lrjoinObject

#lrmergeObject

#lrmerge1Object

#lrmosaicObject

#lrmosaic1Object

#maplutObject

#match_linearObject

#match_linear_searchObject

#maxObject

#maxposObject

#maxpos_avgObject

#maxpos_subpelObject

#maxvalueObject

#measure_areaObject

#minObject

#minposObject

#monotonic?Boolean

Returns:

  • (Boolean)

#moreObject

#moreeqObject

#mpercentObject

#mpercent_histObject

#msbObject

#multiplyObject Also known as: *

#notequalObject

#orObject

#phasecor_fftObject

#png(*args) ⇒ Object



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

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

#pointObject

#powObject

#ppm(*args) ⇒ Object



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

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

#profile_hObject

#profile_vObject

#projectObject

#rad_to_floatObject

#rankObject

#rank_imageObject

#recombObject

#remainderObject

#replicateObject

#ri2cObject

#rightshift_sizeObject

#rintObject

#rot180Object

#rot270Object

#rot90Object

#rotquadObject

#scaleObject

#scalepsObject

#sharpenObject

#shrinkObject

#signObject

#sinObject

#spcorObject

#srgb_to_xyzObject

#statsObject

#stdifObject

#stretch3Object

#subsampleObject

#subtractObject Also known as: -

#tanObject

#tbjoinObject

#tbmergeObject

#tbmerge1Object

#tbmosaicObject

#tbmosaic1Object

#tiff(*args) ⇒ Object



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

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

#tile_cacheObject

#to_maskObject

#tone_analyseObject

#ucs_to_labObject

#ucs_to_lchObject

#ucs_to_xyzObject

#vips(*args) ⇒ Object



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

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

#vtypeObject

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

#wrapObject

#write(*args) ⇒ Object



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

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

#xorObject

#xyz_to_labObject

#xyz_to_lab_tempObject

#xyz_to_srgbObject

#xyz_to_ucsObject

#xyz_to_yxyObject

#yxy_to_xyzObject

#zerox_negObject

#zerox_posObject

#zoomObject

#|Object