File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change 9
9
* add a Valgrind suppressions file [ John Cupitt]
10
10
* fix .monotonic? [ John Cupitt]
11
11
* fix .data on coded images [ John Cupitt]
12
+ * add .size, see issue #58 [ John Cupitt]
12
13
13
14
# Version 0.3.8
14
15
Original file line number Diff line number Diff line change @@ -78,6 +78,24 @@ header_y_size(VALUE obj)
78
78
return Qnil ;
79
79
}
80
80
81
+ /*
82
+ * call-seq:
83
+ * im.size -> [width, height]
84
+ *
85
+ * Get the size of the image in pixels.
86
+ */
87
+
88
+ static VALUE
89
+ header_size (VALUE obj )
90
+ {
91
+ GetImg (obj , data , im );
92
+
93
+ if (im )
94
+ return rb_ary_new3 (2 , INT2FIX (im -> Xsize ), INT2FIX (im -> Ysize ));
95
+
96
+ return Qnil ;
97
+ }
98
+
81
99
/*
82
100
* call-seq:
83
101
* im.bands -> number
@@ -403,6 +421,7 @@ init_Header( void )
403
421
404
422
rb_define_method (mVIPSHeader , "x_size" , header_x_size , 0 );
405
423
rb_define_method (mVIPSHeader , "y_size" , header_y_size , 0 );
424
+ rb_define_method (mVIPSHeader , "size" , header_size , 0 );
406
425
rb_define_method (mVIPSHeader , "bands" , header_bands , 0 );
407
426
rb_define_method (mVIPSHeader , "band_fmt" , header_band_fmt , 0 );
408
427
rb_define_method (mVIPSHeader , "x_res" , header_x_res , 0 );
You can’t perform that action at this time.
0 commit comments