locked
Image dimensions are increased from original size RRS feed

Answers

  • Hi,

    I'm still not convinced that this is a fault of the WCF Data Services. First of all the product doesn't differentiate between images and other files. For it it's just a stream of bytes and we haven't heard about data corruption yet. Second it would require non-trivial amount of code to resize the image (I assume it's a jpg, so it would require decoding the jpg file, running the resize algorithm, encoding in jpg again).

    Can you try to attach a debugger to your service and verify that your IDataServiceStreamingProvider does the right thing. Meaning it gets the image data from the right place and that the data it gives really does store the small image?

    Thanks,


    Vitek Karas [MSFT]
    Friday, July 16, 2010 2:26 PM
    Moderator

All replies

  • Hi Rob,

    I may be wrong but I believe that the dimensions for the image are dictated by exif data for the image.
    Was this image uploaded by the DataService client ?
    How are you serializing the stream into an image on the server ?

    Phani


    Phani Raj Astoria http://blogs.msdn.com/PhaniRaj
    Tuesday, July 13, 2010 5:31 PM
    Moderator
  • I'm not sure what "exif" refers to. But I created a client that blobs and uploads an image to the SQL image Type.

    This same service has served images of different sizes and dimension perfectly before. But for some reason it's magnifying some photos.

    Note: There are no "resizing" capabilities in my upload code.

    Tuesday, July 13, 2010 7:44 PM
  • It might be the browser changing the size for "better viewing". Could try donwloading the imagine into a file (in IE right click - Save Picture As) and double click the file to open in your favorite image editor and then see how it will show up.

    Thanks,


    Vitek Karas [MSFT]
    Thursday, July 15, 2010 11:28 AM
    Moderator
  • I downloaded the image and opened it in an image editor. it was still 600px X 600px, and not the original size.

    Bummer because I was hoping to serve REST data and images using WCF Data Services. Looks like it can't serve images very well :( 

    Friday, July 16, 2010 2:15 PM
  • Hi,

    I'm still not convinced that this is a fault of the WCF Data Services. First of all the product doesn't differentiate between images and other files. For it it's just a stream of bytes and we haven't heard about data corruption yet. Second it would require non-trivial amount of code to resize the image (I assume it's a jpg, so it would require decoding the jpg file, running the resize algorithm, encoding in jpg again).

    Can you try to attach a debugger to your service and verify that your IDataServiceStreamingProvider does the right thing. Meaning it gets the image data from the right place and that the data it gives really does store the small image?

    Thanks,


    Vitek Karas [MSFT]
    Friday, July 16, 2010 2:26 PM
    Moderator
  • You are correct!!! My bad. It was in my code.

    THANK YOU FOR RESPONDING VITEK!!!

    You helped me to look at the problem from a different angle :>

    Friday, July 16, 2010 7:57 PM
  • I'm glad you've been able to fix it!

    And relieved that it's not a bug in our code ;-)


    Vitek Karas [MSFT]
    Friday, July 16, 2010 9:10 PM
    Moderator