Skip to content

Conversation

@arraydude
Copy link
Contributor

This PR fixes streamlit/streamlit-old-private#1174


LOGGER = get_logger(__name__)

IMAGE_MAXIMUM_WIDTH = 610
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comment explaining why 610.

Also, if the reason this is 610 is because this is the maximum width of the main content area in Streamlit, rename this to MAXIMUM_CONTENT_WIDTH.

One more thing: in the line of CSS where this value comes from, add a comment saying that if you change that code you should also change this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was checking this in the code, the content width is handled by columns not an specific width, in the maximum viewport it has a 66% of the parent element, the parent element which has a .container class from bootstrap , in the maximum breakpoint it has 960px, so there's no available CSS for that because it's a dependency , what i can do is leave a comment in the React component which has specified the column length

mime_type = 'image/' + format

image = Image.open(io.BytesIO(data))
w, h = image.size
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a little confusing. width is the width the user specified (if any) and w is the actual image size, right? It would be best to rename these variables to make this clearer.

Example: w and h could be actual_width and actual_height

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that’s true i’m agree with you, i will change this

@arraydude arraydude merged commit dfe1712 into streamlit:develop Aug 28, 2019
@arraydude arraydude deleted the 1174-ResizingImage branch August 28, 2019 17:44
tconkling added a commit to tconkling/streamlit that referenced this pull request Sep 4, 2019
# By Nahuel Emiliano Rosso Fandiño (4) and others
# Via GitHub
* develop:
  Fix WebsocketConnection totalTries count (streamlit#38)
  Adding width and height parameter to st.dataframe (streamlit#33)
  403 Error message (streamlit#37)
  Test frontend in CircleCI (streamlit#35)
  Merge version 0.45.0 (streamlit#34)
  Hash numpy arrays. Use fixed size sample. (streamlit#16)
  st.image() resizing images when are bigger than the maximum (streamlit#30)
  Deprecating data parameter from st.deck_gl_chart() (streamlit#22)
  Standardize cypress viewport across all tests and fixes (streamlit#11)
  Adding unit tests for magic (streamlit#13)

# Conflicts:
#	proto/streamlit/proto/ForwardMsg.proto
tconkling added a commit that referenced this pull request Sep 4, 2019
* Adding unit tests for magic (#13)

* Adding unit tests for magic

* Standardize cypress viewport across all tests and fixes (#11)

- standardize cypress viewport across all tests
- remove snapshot corresponding to missing `mplotlib` test
- fixed issue with snapshots being cutoff or wrong element being captured sporadically
- increased snapshot diff threshold by .5%
- increase snapshot bounding box for `disconnect.py` and `empty_dataframes.py`
- allow multiple valid width values for `vega_lite_chart.py`
- set `devicePixelRatio` to 1 when running `cypress open'
- remove spinner e2e test and core example
- fix various cypress tests
- preload `viz.js` when running `yarn start`

* Deprecating data parameter from st.deck_gl_chart() (#22)

* Deprecating data parameter for st.deck_gl_chart()

* Basic deck_gl example setting viewport

* DOCSTRING

* LINT

* Moving deck_gl_chart test from streamlit_test to deck_gl_test

* Checking kwargs instead of a data parameter

* Fixing comments from thiago

* st.image() resizing images when are bigger than the maximum (#30)

* Resizing image when its bigger than the maximum width

* Resizing image when its bigger than the maximum width

* MAXIMUM_CONTENT_WIDTH documentation

* MAXIMUM_CONTENT_WIDTH documentation

* Hash numpy arrays. Use fixed size sample. (#16)

* Merge version 0.45.0 (#34)

* Restore correct vertical spacing for report elements.

* Break Block.tsx into more functions.

* Tiny refactors in Block.tsx

* Add "key" property to element in DocString, to avoid warnings.

* Fix #1230: OSError not caught when writing cache to disk

* Don't show hashing warning when user imports a module inside a cached function.

* Fix #6: report should loads element by element (was broken since Sidebar PR)

* Try to fix CircleCI issue: Method 'renderElementWithErrorBoundary' expected no return value

* Add typing to function.

* Remove unecessary dockerfiles

* Fix a bunch of examples

* Fix color of syntax error code in modal dialog.

* Remove old style copyright from conftest.py

* Remove st.warning when hashing a class.

* Add astor to Python requirements

* Update widget API in some e2e tests

* Clean up st.foo_widget() signatures in st.help()

* Lint docs/getting_started.md

* Clean up widget examples in docstrings.

* Add comment to slider examples in docs.

* Tweak Streamlit's description in setup.py

* Sort pipfile modules

* Re-add scripts and Makefile rules to publish packages to conda.

* Fix update_version.py to support new conda location and remove old docker folder.

* Make `streamlit config show` pipeable to a file.

* Update docs/ site

* Remove /docs/api invalidation from Makefile

* Improve docstring for st.slider

* Remove st.Cache (capital C) from __init__ while we figure out what to call it.

* Up version to 0.45.0

* Turn off tests for st.Cache (capital C)

* Try turning off tests again

* Test frontend in CircleCI (#35)

* CircleCI: run frontend tests after python tests

* `make jstest`: don't run non-existent 'coverage' script

* Add `make jscoverage` in case we want to use it

* Make sure we generate scssvars

* Conditionally run our frontend tests

* 403 Error message (#37)

* 403 Error message

* ESLint

* Adding width and height parameter to st.dataframe (#33)

This PR proposes to add a width and height parameter to st.dataframe. Protobuf is changed to include an ElementDimensionSpec field to carry this information. This is included as part of the forward message metadata. The message is parsed and height/width information is extracted and passed down to the Dataframe React component in Block.tsx. Width is set in Block.tsx since existing logic applies to a generic element, while height is set in the Dataframe element in some ad hoc logic.

* Fix WebsocketConnection totalTries count (#38)

* Fixing overlap between onload and onreadystatechange

* Removing unused events
@millionhz
Copy link

millionhz commented Jul 11, 2020

I want to display a 4k image but the maximum size limit is not letting me do that, what can I do?

EDIT: I solved this by modifying this value:

from streamlit.elements import image_proto

image_proto.MAXIMUM_CONTENT_WIDTH = 3000

Is this gonna cause any bugs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants