Try:
import mahotas.io.freeimage
This should give you a descriptive error message.
HTH,
Luis
On 06/16/2013 05:45 AM, NewPy wrote:
> Thanks for the tips, it works for me now with matplotlib.
>
> I also install FreeImage and add its .so to my LD_LIBRARY_PATH, but
> mahotas.imsave still tries to use matplotlib. How do I use enable
> mahotas to use freeimage to save greyscale image?
> Thanks!
>
>
> On Saturday, June 15, 2013 8:14:17 AM UTC-7, Thouis (Ray) Jones wrote:
>
> You might add cmap=matplotlib.cm.gray (and maybe vmin=0, vmax=1, if
> the incoming image is within [0,1]) to the matplotlib.imsave call,
> to better approximate what freeimage would do.
>
> Ray Jones
>
>
>
> On Sat, Jun 15, 2013 at 9:21 AM, Luis Pedro Coelho
> <
lu...@luispedro.org <javascript:>> wrote:
>
> Ah, you're right!
>
> This is actually matplotlib.pyplot.imsave's implementation.
>
> Mahotas does not implement IO, it always just exposes one of
>
> 1. imread (
http://luispedro.org/__software/imread
> <
http://luispedro.org/software/imread>)
> 2. freeimage
> 3. matplotlib
>
> (It tries these in order 'til it finds one that works).
>
> *
>
> I have just committed a fix so that the imsave for matplotlib at
> leasts works around this and tells the user what's happening.
>
> Thanks
> Luis
>
>
> On 06/15/2013 06:57 AM, NewPy wrote:
>
> Attached are the input and output files for the script
> below. I checked
> with GIMP, it's colored. Thanks
>
> #!/usr/bin/env python
> import mahotas
> s_file='Nuts.png'
> img = mahotas.imread(s_file, as_grey=True)
> mahotas.imsave('Nuts_saved.__png', img)
> exit()
>
>
> On Wednesday, June 12, 2013 10:22:01 PM UTC-7, NewPy wrote:
>
> # read in a grey scale image, imsave convert it to
> color image
> s_file='Nuts.png'
> img = mahotas.imread(s_file, as_grey=True)
> mahotas.imsave('test.png', img)
> exit()
>
> # example 2, instead of getting a black and white
> image, I got red
> and blue strips
> import numpy as np
> import mahotas
> img = np.ones([10,10])
> img[::2,:]=0
> mahotas.imsave('test.png', img)
>
> Thanks!
>
> --
> You received this message because you are subscribed to the
> Google
> Groups "pythonvision" group.
> To unsubscribe from this group and stop receiving emails
> from it, send
> an email to pythonvision...@__
googlegroups.com <javascript:>.
> For more options, visit
>
https://groups.google.com/__groups/opt_out
> <
https://groups.google.com/groups/opt_out>.
>
>
>
>
> --
> Luis Pedro Coelho | EMBL |
http://luispedro.org
>
> --
> You received this message because you are subscribed to the
> Google Groups "pythonvision" group.
> To unsubscribe from this group and stop receiving emails from
> it, send an email to pythonvision...@__
googlegroups.com
> <javascript:>.
> For more options, visit
>
https://groups.google.com/__groups/opt_out
> <
https://groups.google.com/groups/opt_out>.