How to build a flashable img.xz

Hi.
I am trying to compress my Image.img with xz. The Problem is etcher wont flash my compressed img.xz.
Are there any limitations or Rules to compress? What is required?
Thank you