All the image are stored in database in varbinary
format. Now, I want the list of images whose size is less than 1MB. Is there anyway to get the image size when it is in varbinary format? If we get number of bytes using DATALENGTH()
in SQL Server, will this be equal to the image size when that varbinary
data is converted into image file?
Asked
Active
Viewed 1,233 times
0
-
1"will this be equal to the image size when that varbinary data is converted into image file?" - probably. But to truly answer that, we'd have to know *how you converted the image files to store them in the database in the first place*. – Damien_The_Unbeliever Dec 16 '16 at 07:42
-
1Exactly, when [the solution](http://stackoverflow.com/q/7324190/3682162) is ready out there on SO. – Vikrant Dec 16 '16 at 07:43
-
First, the image was converted to 'Base64 format, then from Base64 I convert it into byte. This byte is stored in Database in varbinary format. – Kishore L Dec 16 '16 at 07:49
-
I was worried that there would be unnecessary conversions here and your comment suggests that there are. Depending on exactly what you've done, you've possible bloated up the amount of space used in the database by 4/3. – Damien_The_Unbeliever Dec 16 '16 at 08:29
-
@Damien_The_Unbeliever Thank you for pointing that out. Is there any other efficient way we can store images? How does storing the image in byte[] bloat up the amount of space used in database? – Kishore L Dec 17 '16 at 11:03