{"action":"opened","issue":{"url":"https://api.github.com/repos/OpenImageIO/oiio/issues/1224","labels_url":"https://api.github.com/repos/OpenImageIO/oiio/issues/1224/labels{/name}","comments_url":"https://api.github.com/repos/OpenImageIO/oiio/issues/1224/comments","events_url":"https://api.github.com/repos/OpenImageIO/oiio/issues/1224/events","html_url":"https://github.com/OpenImageIO/oiio/issues/1224","id":109037356,"number":1224,"title":"oiiotool: Inconsistent behavior with --fit (bug or feature?)","user":{"login":"justinfx","id":282566,"avatar_url":"https://avatars.githubusercontent.com/u/282566?v=3","gravatar_id":"","url":"https://api.github.com/users/justinfx","html_url":"https://github.com/justinfx","followers_url":"https://api.github.com/users/justinfx/followers","following_url":"https://api.github.com/users/justinfx/following{/other_user}","gists_url":"https://api.github.com/users/justinfx/gists{/gist_id}","starred_url":"https://api.github.com/users/justinfx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinfx/subscriptions","organizations_url":"https://api.github.com/users/justinfx/orgs","repos_url":"https://api.github.com/users/justinfx/repos","events_url":"https://api.github.com/users/justinfx/events{/privacy}","received_events_url":"https://api.github.com/users/justinfx/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-30T08:08:47Z","updated_at":"2015-09-30T08:08:47Z","closed_at":null,"body":"i've encountered some unexpected behavior with oiiotool's `--fit` command, under a specific circumstance, and I am looking for clarification on whether this is intended behavior or a bug.\r\n\r\nWhen attempting to fit a source image to a target resolution where one dimension is unchanged and the other is larger than the source, padding does not occur and you are given the original source res as output.\r\n\r\nTested both with 1.5.11 and again master.\r\n\r\n**Steps to reproduce**\r\n\r\n```\r\n# basic 1.78 aspect source image\r\noiiotool --create 2048x1152 3 -o /tmp/width.png\r\n\r\n# Fit image to different sizes\r\noiiotool /tmp/width.jpg --fit:pad=1 2048x871 -o /tmp/out_235.jpg\r\noiiotool /tmp/width.jpg --fit:pad=1 1920x1080 -o /tmp/out_hd1080.jpg\r\noiiotool /tmp/width.jpg --fit:pad=1 2048x1536 -o /tmp/out_133.jpg\r\n```\r\n\r\n**What I expect**\r\n\r\n```\r\n      /tmp/out_235.jpg:  2048x871\r\n/tmp/out_hd1080.jpg:  1920x1080\r\n      /tmp/out_133.jpg:  2048x1536\r\n```\r\n\r\n**What I get**\r\n\r\n```\r\n      /tmp/out_235.jpg:  2048x871\r\n/tmp/out_hd1080.jpg:  1920x1080\r\n      /tmp/out_133.jpg:  2048x1152\r\n```\r\n\r\nAn interesting variation on the case that doesn't work as expected:\r\n\r\n```\r\noiiotool /tmp/width.jpg --fit:pad=1 2047x1536 -o /tmp/out_133.jpg\r\n# 2047x1536\r\noiiotool /tmp/width.jpg --fit:pad=1 2049x1536 -o /tmp/out_133.jpg\r\n# 2049x1536\r\n```\r\n\r\nSo, if I make sure that both dimensions change, even by one pixel, then it will do the padding to the larger dimensions. The way that I need to work around this, involves using a `--cut` to really pad the image out as expected. This requires needing to provide a proper offset value, and I have found I can only use this approach conditionally when I know that only one target dimension is larger and the other is the same:\r\n\r\n```\r\noiiotool /tmp/width.jpg --fit:pad=1 2048x1536 --cut 2048x1536+0-192 -o /tmp/out_133.jpg\r\n```"}}