Jesse MacVicar
Jesse MacVicar

Reputation: 546

Image Resizer: how to support tiff as an output format

I'm starting to play around with Image Resizer (http://imageresizing.net) to see if it can replace our current framework for processing images. Currently we have options for downloading an image as either a tiff or jpeg, depending on the source format.

However, I receive this error when adding "&format=tiff" to the image resizing parameters:

Image Resizer: No image encoder was found for the request.

Tiff doesn't seem to be a valid output type. I need to find a way to output an image as a tiff, only if the source format is a tiff. Does anyone has any tips on how to accomplish this? A plugin perhaps? Thanks in advance!

Upvotes: 0

Views: 267

Answers (1)

Lilith River
Lilith River

Reputation: 16468

By default, ImageResizer only supports web-friendly image formats for output. Tiff files can be imported, but not exported.

TIFF is just a container format, and doesn't imply anything about the actual encoding, color space, or compression type of the image, so you'll need to specify that (or hard-code it).

You can implement your own Tiff encoder by implementing the ImageResizer.Encoding.IEncoder interface, and using the System.Drawing classes. It should be 2-3 pages of code, mostly boilerplate. Look at /Core/Plugins/Basic/DefaultEncoder.cs for an example implementation. Yours can be much simpler as you only need to add support for one file format.

Upvotes: 1

Related Questions