finish python vips8
This commit is contained in:
parent
4c51e6aa0b
commit
9a2c38e107
5
TODO
5
TODO
@ -1,11 +1,6 @@
|
||||
|
||||
- python:
|
||||
|
||||
- try getting / setting / deleting metadata such as an ICC profile or
|
||||
an exif tag
|
||||
|
||||
- try vips benchmark in vips8 python, how much slower?
|
||||
|
||||
- could import like this:
|
||||
|
||||
from gi.repository import Vips
|
||||
|
@ -1272,7 +1272,8 @@ vips_check_matrix( const char *domain, VipsImage *im, VipsImage **out )
|
||||
{
|
||||
*out = NULL;
|
||||
|
||||
if( im->Xsize > 100000 || im->Ysize > 100000 ) {
|
||||
if( im->Xsize > 100000 ||
|
||||
im->Ysize > 100000 ) {
|
||||
vips_error( domain, "%s", _( "matrix image too large" ) );
|
||||
return( -1 );
|
||||
}
|
||||
|
20
python/try11.py
Executable file
20
python/try11.py
Executable file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
|
||||
#import logging
|
||||
#logging.basicConfig(level = logging.DEBUG)
|
||||
|
||||
from gi.repository import Vips
|
||||
|
||||
from vips8 import vips
|
||||
|
||||
a = Vips.Image.new_from_file(sys.argv[1])
|
||||
|
||||
ipct = a.get("ipct-data")
|
||||
|
||||
print "ipct = ", ipct.get()
|
||||
|
||||
a.remove("ipct-data")
|
||||
|
||||
a.write_to_file("x.jpg")
|
18
python/vips.py
Executable file
18
python/vips.py
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
from vipsCC import *
|
||||
|
||||
im = VImage.VImage (sys.argv[1])
|
||||
|
||||
im = im.extract_area (100, 100, im.Xsize () - 200, im.Ysize () - 200)
|
||||
|
||||
im = im.affinei_all ("bilinear", 0.9, 0, 0, 0.9, 0, 0)
|
||||
|
||||
mask = VMask.VIMask (3, 3, 8, 0,
|
||||
[-1, -1, -1,
|
||||
-1, 16, -1,
|
||||
-1, -1, -1])
|
||||
im = im.conv (mask)
|
||||
|
||||
im.write (sys.argv[2])
|
19
python/vips8.py
Executable file
19
python/vips8.py
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
|
||||
from gi.repository import Vips
|
||||
from vips8 import vips
|
||||
|
||||
im = Vips.Image.new_from_file(sys.argv[1])
|
||||
|
||||
im = im.crop(100, 100, im.width - 200, im.height - 200)
|
||||
|
||||
im = im.affine([0.9, 0, 0, 0.9])
|
||||
|
||||
mask = Vips.Image.new_from_array([[-1, -1, -1],
|
||||
[-1, 16, -1],
|
||||
[-1, -1, -1]], scale = 8)
|
||||
im = im.conv(mask)
|
||||
|
||||
im.write_to_file(sys.argv[2])
|
@ -240,8 +240,9 @@ def vips_image_new_from_array(cls, array, scale = 1, offset = 0):
|
||||
|
||||
image = cls.new_matrix_from_array(width, height, array)
|
||||
|
||||
image.set('scale', scale)
|
||||
image.set('offset', offset)
|
||||
# be careful to set them as double
|
||||
image.set('scale', float(scale))
|
||||
image.set('offset', float(offset))
|
||||
|
||||
return image
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user