Camera proxy resize + crop not working

I’m trying to resize AND crop a camera snapshot to send it as notification image to my android device. I’m trying to get a 2:1 image: from an original 1280 × 960, a resized to 1024 × 768, and then cropped to 1024 x 512

However, this is not working:

camera:
  - platform: proxy
    entity_id: camera.timbre_sub
    name: timbre_sub_resized
    max_image_width: 1024
    image_quality: 60
  - platform: proxy
    entity_id: camera.timbre_sub_resized
    mode: crop
    name: timbre_sub_cropped
    image_top: 256
    max_image_height: 512

The image I get in timbre_sub_cropped is basically the resized one: 1024 × 768, the second proxy camera is not doing the crop. Anyone has ideas on why?

For anyone also struggling with this, after more investigation, seems that the reverse order works: first do the crop then the resize:

camera:
  - platform: proxy
    entity_id: camera.timbre_sub
    name: timbre_sub_cropped
    mode: crop
    image_top: 320
    max_image_height: 1440
    image_quality: 60
  - platform: proxy
    entity_id: camera. timbre_sub_cropped
    name: timbre_sub_resized
    max_image_width: 1024

Even more interesting, if I change the image_quality parameter to the resizing action again it doesn’t work:

camera:
  - platform: proxy
    entity_id: camera.timbre_sub
    name: timbre_sub_cropped
    mode: crop
    image_top: 320
    max_image_height: 1440
  - platform: proxy
    entity_id: camera. timbre_sub_cropped
    name: timbre_sub_resized
    max_image_width: 1024
    image_quality: 60

Hope it helps anyone else.

It seems this component has been neglected. There are various issues on GitHub. This is one that’s been bugging me: Cannot specify stream_quality or image_quality for proxy camera integration · Issue #84576 · home-assistant/core · GitHub.

Does the proxy produce a new entity Id or just change the existing one? Ideally I’d like to use both images.

I also found crop not to be working in 2024.10.2

My solution is to use a script and a shell command.

The Script:

alias: Doods Crop GarageDoor
sequence:
  - action: camera.snapshot
    target:
      entity_id: camera.camera_front_main
    data:
      filename: /config/www/doods_garagepersondoor.jpg
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - action: shell_command.doods_crop_garagedoor
    metadata: {}
    data: {}
description: ""

The shell command:

shell_command:
  doods_crop_garagedoor: ffmpeg -y -i /config/www/doods_garagepersondoor.jpg -vf "crop=650:650:102:1182" /config/www/doods_garagepersondoor_cropped.jpg

Then, as I am using doods for image recognition, I had to create a dummy camera as such

camera:
  - platform: local_file
    file_path: /config/www/doods_garagepersondoor_cropped.jpg
    name: doods-garagepersondoor

Hope this helps someone!