Coder Social home page Coder Social logo

Comments (3)

hhoppe avatar hhoppe commented on July 26, 2024

Hi Eric!

I can't seem to be able to reproduce it.
In Colab, I tried:

import mediapy as media
images = {f'image{index}': media.color_ramp((512, 512)) for index in range(32)}
media.show_images(images)

and it shows 32 images of size (512, 512, 3).
When I right-click Save_as_image on one of them, it does save as a 512x512 image.

In Jupyter Lab, it shows 32 shrunk images such that all of them appear in the window width.
But again when I shift-right-click Save_as_image it is natively 512x512.
(The scaling there might be adjustable using CSS styles.)

Please give us more details. Perhaps try Chrome Developer Tools (Control-Shift-i) to examine the native image resolution?
Is there any OS display scaling (e.g., Windows "Make everything bigger") or Chrome Zoom scaling?

from mediapy.

erictabellion avatar erictabellion commented on July 26, 2024

Hi Hugues!

All the input image resolutions I reported were obtained printing the np.ndarray.shape.
All the display resolutions I reported were obtained after right-clicking on the image displayed by mediapy and selecting "Open in a new tab" in Google Chrome. I then hover the mouse over the new tab and a tooltip appears showing the native resolution of the image being displayed among other things. right-click+save the image produces an image file of that resolution.

In my use-case I get an image_batch from my ML pipeline data-loader, with shape (1, 32, 512, 512, 3) and dtype=np.float32. I display it with:

def display_image_row(image_row):
  image_dict = {}
  for col in range(image_row.shape[0]):
    image_dict[f'{col}'] = image_row[col]
  media.show_images(image_dict, height=512, downsample=False, ylabel='row0')

display_image_row(image_batch[0])

Whether or not I convert the input image_batch first to uint8, I get the same issue.

image_batch = image_batch * 255
image_batch = image_batch.astype(np.uint8)

from mediapy.

hhoppe avatar hhoppe commented on July 26, 2024

Are you using Colab? Please see my shared Colab notebook in https://colab.research.google.com/drive/1pkTsS0v40kbf66d6a_rfMS1V6VrS247d?usp=sharing
which seems to work fine with both np.uint8 and np.float32 and with/without the height and downsample flags.

from mediapy.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.