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

ImageRequestOptions ignoring viz_height and viz_width #1564

Closed
bnoffke-uwcu opened this issue Feb 6, 2025 · 3 comments
Closed

ImageRequestOptions ignoring viz_height and viz_width #1564

bnoffke-uwcu opened this issue Feb 6, 2025 · 3 comments

Comments

@bnoffke-uwcu
Copy link

Describe the bug
The viz_height and viz_width options were added to ImageRequestOptions (this is the merge). The resulting class has the properties, but it doesn't actually control the image resolution output.

Versions
Details of your environment, including:

  • Tableau Server version (or note if using Tableau Online): 2024.2.2
  • Python version: 3.11.2
  • TSC library version: v0.36

To Reproduce
Code snippet:

image_req_option = TSC.ImageRequestOptions(viz_height=image_height,viz_width=image_width,maxage=-1)
print(f"TSC Image Height: {image_req_option.viz_height} TSC Image Width: {image_req_option.viz_width}")
self.server.views.populate_image(view, image_req_option)

I set the properties in the req_option, I print the properties to show they are set, then I populate the image with the given image_req_option.

Results
The resulting image only abides by the default behavior, or the High resolution request option. Maybe there's something I'm missing?
Print result:
Image
Output resolution:
Image

@jorwoods
Copy link
Contributor

jorwoods commented Feb 7, 2025

Looks like vizHeight and vizWidth are for PDF, and image has a different way to specify size. I'll work on a PR soon to include the correct parameter.

jorwoods added a commit to jorwoods/server-client-python that referenced this issue Feb 7, 2025
Closes tableau#1564

Retrieving a view image does not support vizHeight and
vizWidth serverside. Supporting it for images as well was
a mistake.
jorwoods added a commit to jorwoods/server-client-python that referenced this issue Feb 7, 2025
Closes tableau#1564

Retrieving a view image does not support vizHeight and
vizWidth serverside. Supporting it for images as well was
a mistake.
@jorwoods
Copy link
Contributor

jorwoods commented Feb 7, 2025

As I noted in #1565, specifying vizHeight and vizWidth for image exports is a mistake. The correct way would be to create a ImageRequestOptions(imageresolution="high"). If you need to resize the image, I would recommend looking at pillow.

@bnoffke-uwcu
Copy link
Author

Thanks for the clarification. It seems like pillow will handle the image after export, which won't have the effect I'm looking for where Tableau would resize items on a dashboard to fit the target resolution. I was hoping the functionality from tabcmd would be represented in TSC:
tabcmd export tableau.org/dashboard/view --png --width 1600 --height 900 -f path/to/picture.png

My use case is to have a dashboard that automatically resizes for the user's window when viewing in Tableau Server, but also be able to export an image of that same view with a specified resolution.

Thanks for putting in the change to remove the properties. I have another workaround in mind (copy of the view with a fixed size defined in the published dashboard).

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

No branches or pull requests

2 participants