# Target\_size issue

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftarget-size-issue%2F168739%3E%5C
**Category:** Inference Endpoints on the Hub\
**Created:** [September 28, 2025, 7:02am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftarget-size-issue%2F168739 "2025-09-28T07:02:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![iam-tsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/iam-tsr/32/54346_2.png) [@iam-tsr](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fiam-tsr)%5C
**Post date:** [September 28, 2025, 7:02am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftarget-size-issue%2F168739%2F1 "2025-09-28T07:02:20Z")

</div>

I am using ImageToImageTargetSize paramenter with InferenceClient

from huggingface\_hub.inference.\_generated.types.image\_to\_image import ImageToImageTargetSize

target\_size=ImageToImageTargetSize(256, 256)

But the output is still same as input image size. Can anyone help me to figure out what thing I am doing wrong?

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [September 28, 2025, 8:53am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftarget-size-issue%2F168739%2F2 "2025-09-28T08:53:37Z")

</div>

The parameter seems to be ignored…

Depending on the model, resolution constraints or the input image resolution may take precedence, causing the output resolution parameter to be ignored. Or is it a bug?

```py
from huggingface_hub import InferenceClient, ImageToImageTargetSize

client = InferenceClient(model="Qwen/Qwen-Image-Edit")
url = "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/edit_homepage.jpg" # (1312, 800)

img = client.image_to_image(
    url,
    prompt="cinematic lighting",
    target_size=ImageToImageTargetSize(height=256, width=256),
    provider="fal"
)
print(img.size) # (1312, 800)
img.save("out.jpg")

```

---

<div class="post-metadata">

**Author:** ![iam-tsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/iam-tsr/32/54346_2.png) [@iam-tsr](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fiam-tsr)%5C
**Post date:** [September 28, 2025, 9:18am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftarget-size-issue%2F168739%2F3 "2025-09-28T09:18:40Z")

</div>

I have read the full image to image inference repo files, there i find two output classes out of which `ImageToImageTargetSize` is defined in the main parameter class.

`ImageToImageOutput` is the other one which do the same functioning ig.

Here you can find it - [https://github.com/huggingface/huggingface\_hub/blob/main/src/huggingface\_hub/inference/\_generated/types/image\_to\_image.py](https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/inference/%5C_generated/types/image_to_image.py)

I think it is a bug and I have reported it.

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [September 28, 2025, 10:03am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftarget-size-issue%2F168739%2F4 "2025-09-28T10:03:37Z")

</div>

Similar behavior was observed with `prithivMLmods/Monochrome-Pencil`. If the size specification parameter doesn’t work in Flux Kontext’s LoRA, then there are probably very few Endpoints that support size specification…

Could it be that parameters aren’t being passed correctly when TGI uses Diffusers as the backend…? @michellehbn

---

<div class="post-metadata">

**Author:** ![iam-tsr](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/iam-tsr/32/54346_2.png) [@iam-tsr](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fiam-tsr)%5C
**Post date:** [September 30, 2025, 3:55am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftarget-size-issue%2F168739%2F5 "2025-09-30T03:55:46Z")

</div>

The bug has been fixed and released in [`huggingface_hub==0.35.3`](https://github.com/huggingface/huggingface_hub/releases/tag/v0.35.3)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png) [@system](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsystem)%5C
**Post date:** [September 30, 2025, 3:56pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Ftarget-size-issue%2F168739%2F6 "2025-09-30T15:56:15Z")

</div>

Closed on September 30, 2025, 3:56pm UTC

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.
