Resizing

Moderator: jsachs

Post Reply
Marpel
Posts: 692
Joined: September 13th, 2009, 3:19 pm
What is the make/model of your primary camera?: Nikon D810
Location: Port Coquitlam, British Columbia

Resizing

Post by Marpel »

Caught myself trapped in a rabbit hole, trying to understand the Resizing (Upsizing in particular) process.

I enlarged an image by a single pixel in both dimensions.

I then zoomed in drastically (so I could actually see enlarged pixels and the zoom ratio was the same) to both images to compare exactly what happens, and where, in the image.

After playing around in the images, I discovered that each of the four corners was an exact match to the other image and as one scrolls away from the corners, more of a change is evident. That suggests to me, and my layman's mind, that up-rezzing is like the four corners are "held" and pulled outwards, like a rubber sheet, stretching the inner portions of the image. Is this somewhat correct? I did not try this on images enlarged more than noted, but suspect it may be similar??

I also noted that (also with a single pixel enlargement), in one image which had solid lines of one colour (4 or 5 pixels wide) in the centre area, that the solid colours changed to a gradation between the solid colour and the adjacent different colour. I understand this but was surprised that the gradation change encompassed so many pixels and the former solid colour was no longer solid (although viewed at full size, that was not obvious).

As an aside, and FYI, I also discovered that when I zoomed in (I ultimately tried this on three images, the original, a copy of the original and the single pixel enlargement to confirm), that it seemed arbitrary how and where the zooming in occurred. This happened whether the first zoom on all three was 1:1 and then using the "plus" key multiple times or just using the "plus" key. Sometimes the zooming started and continued into the centre of the image (verified by a grid showing centre), while sometimes the zoom immediately jumped off centre either at the 1:1 or the subsequent "plus" key (usually jumped up and to the right of centre). I tried this repeatedly and found sometimes it varied even on the same image.

Marv
jsachs
Posts: 4216
Joined: January 22nd, 2009, 11:03 pm

Re: Resizing

Post by jsachs »

PWP uses different resizing algorithms for zooming the display and the Resize transformation. The zooming algorithm is designed more for speed than accuracy while Resize is the reverse.

To oversimplify, down-sampling by a factor of 2 involves averaging groups of 4 pixels in the input image to produce each pixel in the output image. Up-sampling by a factor of 2 involves interpolating pixels between each existing pixel. In either case each pixel in the output image is a weighted sum of the corresponding pixels in the input image. For other factors, calculating the weights is more complicated but the general idea is still the same. To improve performance, resizing is normally done in two passes -- first resampling each row and then resampling columns of the resampled rows. The rubber sheet analogy is a more or less accurate way to think of it, but does not reflect the way it is calculated.

There are different resizing algorithms -- if you want to preserve sharp-edged horizontal or vertical lines, nearest-neighbor resizing is best, but this produces stair-step artifacts in skew lines.

When zooming in on the cursor location, it centers the image on this point, but not if this would show the area beyond the edges of the image.
Jonathan Sachs
Digital Light & Color
Marpel
Posts: 692
Joined: September 13th, 2009, 3:19 pm
What is the make/model of your primary camera?: Nikon D810
Location: Port Coquitlam, British Columbia

Re: Resizing

Post by Marpel »

Jonathan,

Thanks for the explanation on resizing.

And not sure if I am misunderstanding your zoom description, but I am talking about zooming into the image by only clicking on the 1:1 button and/or the "plus" button (that are located at the top right of the work area), not by placing the cursor in the image then using the scroll wheel.

When using the buttons only, some times the zoom actually stays on the centre of the image, while other times, it will jump off centre (up and to the right if I recall) and zoom into a spot that is not the centre of the image. Even when done on the same image (see below).

And I should mention that, in the past I have encountered some PWP glitches after opening and transforming multiple images (as if the program was getting overloaded??). In this case, I:

- opened an image, cropped it down (so the zooming to pixel level was not so tedious)
- copied the cropped image, enlarged that copy by a pixel
- copied the cropped image again
- placed a grid on both the second copy and enlargement (to better visually align both image zoom locations)
- then repeatedly zoomed in and out of the three images (crop, crop copy with grid, enlargement with grid) many times to try and confirm how/when the off-centre zoom occurred (It appeared random and occurred intermittently to all three)

My point is, I don't know if the multiple steps a/a caused the zoom glitch.

Marv
jsachs
Posts: 4216
Joined: January 22nd, 2009, 11:03 pm

Re: Resizing

Post by jsachs »

When you zoom in via the zoom tool bar, it tries to keep the scroll bar position the same as you zoom in. If you zoom out all the way and then zoom in, the scroll bars are centered so it zooms in on the center.
Jonathan Sachs
Digital Light & Color
Marpel
Posts: 692
Joined: September 13th, 2009, 3:19 pm
What is the make/model of your primary camera?: Nikon D810
Location: Port Coquitlam, British Columbia

Re: Resizing

Post by Marpel »

Took me a while to digest your explanation. And I think my initial convoluted description may have caused confusion (at least on my part). This point is directly related to zooming using the Zoom Tool Bar, and I have simplified it and only used a single image this time.

I open an image, and use the Zoom Tool Bar button to zoom 1:1, then use Alt + Arrow to move a couple clicks in any direction (to inspect the image up close). I then use the Zoom Tool Bar button to zoom back to initial size (full view or whatever it is called).

If I then click on the 1:1 button again, the image zooms back to the location where I had Alt + Arrowed to, not to centre of image.

However, if, when I zoomed back out the first time to full view, then clicked again on that same button, then click 1:1, the image zooms to centre of the image. As if it required a double click on the return to full view button, to "reset" things.

In my initial post, I had a few images open and was going back and forth between images and clicking 1:1, then using Alt + Arrow, then back to normal view, so I became confused as to why the 1:1 would zoom away from the centre of the images.

Just wondering if the second 1:1 zoom is intended to go off centre unless a double tap on full view is done? Looked in Help and it did not mention this, at least that I could find.

Marv
jsachs
Posts: 4216
Joined: January 22nd, 2009, 11:03 pm

Re: Resizing

Post by jsachs »

When the entire image is visible and you zoom in, it zooms in on the center.

If only part of the image is visible and you zoom in, it tries to maintain the position of the scroll bars.
Jonathan Sachs
Digital Light & Color
Marpel
Posts: 692
Joined: September 13th, 2009, 3:19 pm
What is the make/model of your primary camera?: Nikon D810
Location: Port Coquitlam, British Columbia

Re: Resizing

Post by Marpel »

Jonathan,

I think we are like two ships passing in the night here and missing on communication. And not wanting to make this a huge deal,

However, I am talking about zooming in when the entire image is visible.

- Entire image visible - zoom in with 1:1 button (view is zoomed in to centre of image: Point A) - use Alt + Arrow to move sideways (or other direction) to a different location: Point B - use Zoom Tool Bar by clicking on the button that zooms out so entire image is visible - Click on 1:1 again - view zooms in back to Point B, not Point A as one would expect. If, however, immediately after the Zoom out to view entire image button is clicked, that same button is clicked a second time, then 1:1 will zoom to Point A (as expected).

Not trying to be a weenie...

Marv
jsachs
Posts: 4216
Joined: January 22nd, 2009, 11:03 pm

Re: Resizing

Post by jsachs »

I think it's coming back to me now that this was a feature someone requested so you could flip back and forth between the full view and a 1:1 detail view of a specific area.

13-Oct-2023 – Picture Window 8.0.395
When switching between zoom to fit and zoom to 1:1, the scrolling location of the 1:1 view is now preserved.
Jonathan Sachs
Digital Light & Color
Marpel
Posts: 692
Joined: September 13th, 2009, 3:19 pm
What is the make/model of your primary camera?: Nikon D810
Location: Port Coquitlam, British Columbia

Re: Resizing

Post by Marpel »

Perfect, thanks for your patience.

Didn't know if it was intended or not and couldn't find any literature that stated either way.
Post Reply