pqiv icon indicating copy to clipboard operation
pqiv copied to clipboard

Question: How to define window size

Open mmahmoudian opened this issue 2 years ago • 4 comments

I'm sorry if this is duplicated or I have just missed it. I tried to find this in manpage and the Github issues but I came out empty.

I usually have images with various sizes on my computer, some are few pixels and some are thousands of pixels. The pqiv *.png would change the window size and when the image is very small, it basically very hard to locate the window on the screen, especially when --transparent-background is used. I wonder if there is a way to define absolute or minimum/maximum sizes for the window.

In my searches I found a comment that suggested --action "set_scale_mode_fit_px(INT, INT)" but this would affect the montage window, but does not enforce the on all images.

while testing I realized it actually does a pretty good job at keeping the window dimension stable while working with SVGs, but it does not work as good for png files.

mmahmoudian avatar Apr 12 '22 13:04 mmahmoudian

set_scale_mode_fit_px is supposed to provide this feature. I don't understand what exactly doesn't work. Could you elaborate?

phillipberndt avatar Apr 16 '22 16:04 phillipberndt

Thanks for the response and sorry for the delay in my response :)

To demo what I mean, I downloaded all the CC0 images from the first page of the following URL:

https://wordpress.org/openverse/search/image?q=software&license=cc0&extension=png

and ran pqiv --action "set_scale_mode_fit_px(100, 200)" ./Pictures/test_pqiv/*.png . The expected behavior is to have a 100x200 pixel window with persistent dimension, but what we get is a dynamically changing window dimension:

https://user-images.githubusercontent.com/390889/164441498-e1735c31-edd4-4d63-8d23-71602200d54c.mp4

mmahmoudian avatar Apr 21 '22 10:04 mmahmoudian

Ah. pqiv still maintains the aspect ratio of the image and resize the window accordingly to fit within the bounding box specified by the parameter.

What's your expected behavior in case the aspect ratio doesn't fit?

phillipberndt avatar Apr 21 '22 11:04 phillipberndt

I'm looking for/suggesting a feature to maintain the window size and shrink* the image to fit and fill the surrounding with transparent space (which is controlled by --background-pattern).

  • There are two ways in my mind to address this. either always "scale to fit", so that also smaller images get enlarged, or "scale large to fit" to only reduce the size of images that does not entirely fit into the window dimension, but does not enlarge the smaller images. I personally prefer the "scale large to fit".

mmahmoudian avatar Apr 21 '22 11:04 mmahmoudian