Search code examples
wpfimagescalejpegimage-scaling

Scale a .jpg file in WPF


I'd like to open a .jpg file in WPF, scale it down to around 50%, then save it back to the file system. What's a good/efficient way to go about doing that?


Solution

  • If you want to save on the memory usage you should look into specifying DecodePixelWidth/DecodePixelHeight on BitmapImage or the JpegDecoder.

    The scaling can be accomplished using TransformedBitmap.