<p>We are using a WCF service layer to return images from a repository.  Some of the images are color, multi-page, nearly all are TIFF format.  We experience slowness - one of many issues.</p>

<p>1.) What experiences have you had with returning images via WCF
2.) Do you have any suggestions tips for returning large images?
3.) All messages are serialized via SOAP correct?<br>
4.) Does wcf do a poor job of compressing the large tiff files?</p>

<p>Thanks all!</p>

In a previous project I worked we had a similar issue. We had a Web Service in C# that received requests for medias. A media can range from files to images and was stored in a database using BLOB columns. Initially the web method that handled media retrieval requests read the chunk from the BLOB and returned in to the caller. This was one round trip to the server. The problem with this approach is that the client has no feedback of the progress of the operation.
There is no problem in computer
  science that cannot be solved by an
  extra level of indirection.
We started by refactoring the method in three methods.
Method1
setup the conversation between caller and the web service. This includes information about the request (like media Id) and capabilities exchange. The web service responded with a ticked Id which is used for the caller for future requests. This initial call is used for resource allocation.
Method2
is called consecutively until there is more that to be retrieved for the media. The call includes information about the current offset and the ticked Id that was provided when
Method1
was called. The return updates the current position.
Method3
is called to finish request when
Method2
reports that the reading of the request media has completed. This frees allocated resources.
This approach is practical because you can give immediate feedback to the user about the progress of the operation. You have a bonus that is to split the requests to
Method2
in different threads. The progress than can be reported by chunk as some BitTorrent clients do.
Depending on the size of the BLOB you can choose to load it from the database on one go or
reading it also by chunks
. This means that you could use a balanced mechanism that based on a given watermark (BLOB size) chooses to load it in one go or by chunks.
If there is still a performance issue consider packaging the results using
GZipStream
or read about
message encoders
and specifically pay attention to the binary and Message Transmission Optimization Mechanism (MTOM).