Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add size keywords in Image class #1435

Closed
v923z opened this issue Feb 23, 2012 · 11 comments
Closed

Add size keywords in Image class #1435

v923z opened this issue Feb 23, 2012 · 11 comments
Labels
Milestone

Comments

@v923z
Copy link
Contributor

v923z commented Feb 23, 2012

As discussed on the mailing list, it seems that it would be useful to add size-specific keywords to the image class, something like

Image('foo.png', width=100, height=20)
@kuchi
Copy link

kuchi commented Feb 23, 2012

Don't forget the SVG class too if that makes sense. Might even be nice if we are downsizing the display of a large image to make it linked to show the full size image.

@yarikoptic
Copy link
Contributor

I just thought about the same lacking feature... but then thought that it might be worth just adding generic backend_opts keywords options, e.g.

 Image('foo.png', html_opts=", width=100, height=20")

which would result in a patch:

-            return u'<img src="%s" />' % self.url
+            return u'<img src="%s" %s/>' % (self.url, self.html_opts)

to handle it -- not sure though what would happen for embed=True

but may be such way it would be more scalable to accommodate ad-hoc demands ;-)

@minrk
Copy link
Member

minrk commented Sep 4, 2012

This was closed by #2231

@minrk minrk closed this as completed Sep 4, 2012
@moghimis
Copy link

moghimis commented Dec 5, 2013

What was the actual decision? It seems there is not any of these options implemented?

@minrk
Copy link
Member

minrk commented Dec 5, 2013

This was implemented as described in 1.0 by #2231. The Image constructor accepts width and height kwargs, which affect the display size of the image.

@moghimis
Copy link

moghimis commented Dec 5, 2013

Here is what I am getting, it is fine for image filename alone but with other args it gives error as:

In [16]:
cd  Pictures
/home/nastaran/Pictures
In [16]:

from IPython.core.display import Image  
Image(filename='tt.jpg') 
Out[16]:

In [17]:

from IPython.core.display import Image  
Image(filename='tt.jpg',width=200,height=100)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/home/nastaran/Pictures/<ipython-input-17-b231cb84b059> in <module>()
      1 from IPython.core.display import Image
----> 2 Image(filename='tt.jpg',width=200,height=100)

TypeError: __init__() got an unexpected keyword argument 'width'

In [18]:

from IPython.core.display import Image  
Image(filename='tt.jpg',height=100)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/home/nastaran/Pictures/<ipython-input-18-f99c1bcb0870> in <module>()
      1 from IPython.core.display import Image
----> 2 Image(filename='tt.jpg',height=100)

TypeError: __init__() got an unexpected keyword argument 'height

@Carreau
Copy link
Member

Carreau commented Dec 5, 2013

Are you on master ?

@moghimis
Copy link

moghimis commented Dec 5, 2013

This is the version I am using. I am not sure I understood your question though.

Enthought Python Distribution -- www.enthought.com

Python 2.7.3 | 64-bit | (default, Aug 8 2013, 05:43:23)
Type "copyright", "credits" or "license" for more information.

IPython 0.13.1 -- An enhanced Interactive Python.

@damianavila
Copy link
Member

You are not in master... the current stable version is 1.1.0, and we call master the development version 2.0.0.
I suggest you to use the current stable version...

@Carreau
Copy link
Member

Carreau commented Dec 5, 2013

Yes, the keyword have been added recently, you should be ale o upgrade using EPD, I would also suggest migrating to Canopy that replace EPD now.

@moghimis
Copy link

moghimis commented Dec 5, 2013

I am sorry. I have just updated my Canopy. Works fine. Thanks for your time.
Thanks for all of your efforts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants