This is a migrated thread and some comments may be shown as answers.

Binary Image Resizing and Properties

1 Answer 89 Views
BinaryImage
This is a migrated thread and some comments may be shown as answers.
Allen
Top achievements
Rank 2
Allen asked on 09 Mar 2010, 10:41 PM
I have a scenario like a few others listed in the forum where I have users than can upload any size image and I need to generate multiple sizes from the image.  I have seen examples of other posts on how to capture the image and that is working just fine.  However, I am having some trouble with the resizing.  Because of some of the manipulation that I need to do to the image regarding quality and because I do not know the file format (after the fact), I am wondering if there is a way to read some of the properties about the original file.  Specifically, because I have to deal with encoding, I need to get the image's original file format in order to alter the image quality or resolution.  I can obviously read the extension during the file upload, but the image processing may not always happen at that time and I don't really want to have an extra database field if it isn't needed.  So, is there a reasonable way to parse out of the file format from the binary image's "datavalue" or byte array?

1 Answer, 1 is accepted

Sort by
0
Allen
Top achievements
Rank 2
answered on 09 Mar 2010, 11:08 PM
Ok.  Ignore the previous post. :(  The issue I was having is apparently a "feature-bug" in the .NET framework.  I was trying to use the RawFormat property of the altered bitmap to save it back to a binary format.  It appears that when you begin processing a bitmap, the RawFormat value becomes an "internal" GUID which does not match any of the format enumerations.  What works in this case is to save your RawFormat value to a variable before processing the image and then using that value when converting back to binary.  Sorry for the bogus post and the confusion.
Tags
BinaryImage
Asked by
Allen
Top achievements
Rank 2
Answers by
Allen
Top achievements
Rank 2
Share this question
or